diff options
Diffstat (limited to 'win32')
-rw-r--r-- | win32/PlatWin.cxx | 20 | ||||
-rw-r--r-- | win32/ScintillaWin.cxx | 12 |
2 files changed, 19 insertions, 13 deletions
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index 4becdc507..7407d64f0 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -275,15 +275,15 @@ static D2D1_TEXT_ANTIALIAS_MODE DWriteMapFontQuality(int extraFontFlag) { } #endif -static void SetLogFont(LOGFONTA &lf, const char *faceName, int characterSet, float size, int weight, bool italic, int extraFontFlag) { - lf = LOGFONTA(); +static void SetLogFont(LOGFONTW &lf, const char *faceName, int characterSet, float size, int weight, bool italic, int extraFontFlag) { + lf = LOGFONTW(); // The negative is to allow for leading lf.lfHeight = -(abs(static_cast<int>(size + 0.5))); lf.lfWeight = weight; lf.lfItalic = static_cast<BYTE>(italic ? 1 : 0); lf.lfCharSet = static_cast<BYTE>(characterSet); lf.lfQuality = Win32MapFontQuality(extraFontFlag); - StringCopy(lf.lfFaceName, faceName); + UTF16FromUTF8(faceName, strlen(faceName)+1, lf.lfFaceName, LF_FACESIZE); } /** @@ -306,7 +306,7 @@ class FontCached : Font { FontCached *next; int usage; float size; - LOGFONTA lf; + LOGFONTW lf; int technology; int hash; explicit FontCached(const FontParameters &fp); @@ -329,7 +329,7 @@ FontCached::FontCached(const FontParameters &fp) : hash = HashFont(fp); fid = 0; if (technology == SCWIN_TECH_GDI) { - HFONT hfont = ::CreateFontIndirectA(&lf); + HFONT hfont = ::CreateFontIndirectW(&lf); fid = reinterpret_cast<void *>(new FormatAndMetrics(hfont, fp.extraFontFlag, fp.characterSet)); } else { #if defined(USE_D2D) @@ -378,14 +378,18 @@ FontCached::FontCached(const FontParameters &fp) : } bool FontCached::SameAs(const FontParameters &fp) { - return + if ( (size == fp.size) && (lf.lfWeight == fp.weight) && (lf.lfItalic == static_cast<BYTE>(fp.italic ? 1 : 0)) && (lf.lfCharSet == fp.characterSet) && (lf.lfQuality == Win32MapFontQuality(fp.extraFontFlag)) && - (technology == fp.technology) && - 0 == strcmp(lf.lfFaceName,fp.faceName); + (technology == fp.technology)) { + wchar_t wszFace[LF_FACESIZE]; + UTF16FromUTF8(fp.faceName, strlen(fp.faceName)+1, wszFace, LF_FACESIZE); + return 0 == wcscmp(lf.lfFaceName,wszFace); + } + return false; } void FontCached::Release() { diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx index 070ab0fb2..0dd715d6d 100644 --- a/win32/ScintillaWin.cxx +++ b/win32/ScintillaWin.cxx @@ -2459,7 +2459,7 @@ void ScintillaWin::ImeStartComposition() { // Since the style creation code has been made platform independent, // The logfont for the IME is recreated here. int styleHere = (pdoc->StyleAt(sel.MainCaret())) & 31; - LOGFONTA lf = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ""}; + LOGFONTW lf = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, L""}; int sizeZoomed = vs.styles[styleHere].size + vs.zoomLevel * SC_FONT_SIZE_MULTIPLIER; if (sizeZoomed <= 2 * SC_FONT_SIZE_MULTIPLIER) // Hangs if sizeZoomed <= 1 sizeZoomed = 2 * SC_FONT_SIZE_MULTIPLIER; @@ -2473,11 +2473,13 @@ void ScintillaWin::ImeStartComposition() { lf.lfWeight = vs.styles[styleHere].weight; lf.lfItalic = static_cast<BYTE>(vs.styles[styleHere].italic ? 1 : 0); lf.lfCharSet = DEFAULT_CHARSET; - lf.lfFaceName[0] = '\0'; - if (vs.styles[styleHere].fontName) - StringCopy(lf.lfFaceName, vs.styles[styleHere].fontName); + lf.lfFaceName[0] = L'\0'; + if (vs.styles[styleHere].fontName) { + const char* fontName = vs.styles[styleHere].fontName; + UTF16FromUTF8(fontName, strlen(fontName)+1, lf.lfFaceName, LF_FACESIZE); + } - ::ImmSetCompositionFontA(hIMC, &lf); + ::ImmSetCompositionFontW(hIMC, &lf); } ::ImmReleaseContext(MainHWND(), hIMC); // Caret is displayed in IME window. So, caret in Scintilla is useless. |