diff options
author | Neil <nyamatongwe@gmail.com> | 2019-03-20 19:18:57 +1100 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2019-03-20 19:18:57 +1100 |
commit | a09fe66e667ed2b91a4c953e74cf6b1abaaa919f (patch) | |
tree | ee20504b3c678e28da9c8510669479d135bb7240 /win32/PlatWin.cxx | |
parent | 37e58367e8b48e53032f1849de570668811e81fb (diff) | |
download | scintilla-mirror-a09fe66e667ed2b91a4c953e74cf6b1abaaa919f.tar.gz |
Implement WStringFromUTF8 to simplify code that creates wstring objects for
regular expressions and calling the Win32 API.
Diffstat (limited to 'win32/PlatWin.cxx')
-rw-r--r-- | win32/PlatWin.cxx | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index e407bd630..766c91ef9 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -296,12 +296,10 @@ FontID CreateFontFromParameters(const FontParameters &fp) { } else { #if defined(USE_D2D) IDWriteTextFormat *pTextFormat = nullptr; - const int faceSize = 200; - WCHAR wszFace[faceSize] = L""; - UTF16FromUTF8(fp.faceName, wszFace, faceSize); + const std::wstring wsFace = WStringFromUTF8(fp.faceName); const FLOAT fHeight = fp.size; const DWRITE_FONT_STYLE style = fp.italic ? DWRITE_FONT_STYLE_ITALIC : DWRITE_FONT_STYLE_NORMAL; - HRESULT hr = pIDWriteFactory->CreateTextFormat(wszFace, nullptr, + HRESULT hr = pIDWriteFactory->CreateTextFormat(wsFace.c_str(), nullptr, static_cast<DWRITE_FONT_WEIGHT>(fp.weight), style, DWRITE_FONT_STRETCH_NORMAL, fHeight, L"en-us", &pTextFormat); |