aboutsummaryrefslogtreecommitdiffhomepage
path: root/win32/ScintillaWin.cxx
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2015-01-10 10:43:34 +1100
committerNeil <nyamatongwe@gmail.com>2015-01-10 10:43:34 +1100
commit12210595ded1da77e969e50c80a796d849532139 (patch)
treef933b011839725e78fed771aafac9e9f0a707c73 /win32/ScintillaWin.cxx
parentec1b478a766f07bd33e65f79bee42a8b8d88661b (diff)
downloadscintilla-mirror-12210595ded1da77e969e50c80a796d849532139.tar.gz
On Windows GDI, assume font names are encoded in UTF-8 and use wide character
calls to allow use of Asian font names.
Diffstat (limited to 'win32/ScintillaWin.cxx')
-rw-r--r--win32/ScintillaWin.cxx12
1 files changed, 7 insertions, 5 deletions
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.