aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2021-04-20 12:09:05 +1000
committerNeil <nyamatongwe@gmail.com>2021-04-20 12:09:05 +1000
commit9a1627c2ff2251c2f796d82d4772166876232313 (patch)
treed56320e4663a7c04aac7e7b2c9edba6add626de7
parent79585e218c40f9010601e8af442b573ece40c5ea (diff)
downloadscintilla-mirror-9a1627c2ff2251c2f796d82d4772166876232313.tar.gz
If text format creation fails, could be because of bad locale so try "en-us".
-rw-r--r--win32/PlatWin.cxx7
1 files changed, 7 insertions, 0 deletions
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx
index 99c92434b..45523ff6e 100644
--- a/win32/PlatWin.cxx
+++ b/win32/PlatWin.cxx
@@ -313,6 +313,13 @@ struct FontDirectWrite : public FontWin {
static_cast<DWRITE_FONT_WEIGHT>(fp.weight),
style,
DWRITE_FONT_STRETCH_NORMAL, fHeight, wsLocale.c_str(), &pTextFormat);
+ if (hr == E_INVALIDARG) {
+ // Possibly a bad locale name like "/" so try "en-us".
+ hr = pIDWriteFactory->CreateTextFormat(wsFace.c_str(), nullptr,
+ static_cast<DWRITE_FONT_WEIGHT>(fp.weight),
+ style,
+ DWRITE_FONT_STRETCH_NORMAL, fHeight, L"en-us", &pTextFormat);
+ }
if (SUCCEEDED(hr)) {
pTextFormat->SetWordWrapping(DWRITE_WORD_WRAPPING_NO_WRAP);