summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/l10n_util_win.cc27
-rw-r--r--app/resources/app_locale_settings_am.xtb2
2 files changed, 25 insertions, 4 deletions
diff --git a/app/l10n_util_win.cc b/app/l10n_util_win.cc
index 670efaa..350c29a 100644
--- a/app/l10n_util_win.cc
+++ b/app/l10n_util_win.cc
@@ -35,6 +35,24 @@ void AdjustLogFont(const std::wstring& font_family,
}
}
+bool IsFontPresent(const wchar_t* font_name) {
+ HFONT hfont = CreateFont(12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ font_name);
+ if (hfont == NULL)
+ return false;
+ HDC dc = GetDC(0);
+ HGDIOBJ oldFont = static_cast<HFONT>(SelectObject(dc, hfont));
+ WCHAR actual_font_name[LF_FACESIZE];
+ DWORD size_ret = GetTextFace(dc, LF_FACESIZE, actual_font_name);
+ actual_font_name[LF_FACESIZE - 1] = 0;
+ SelectObject(dc, oldFont);
+ DeleteObject(hfont);
+ ReleaseDC(0, dc);
+ // We don't have to worry about East Asian fonts with locale-dependent
+ // names here.
+ return wcscmp(font_name, actual_font_name) == 0;
+}
+
} // namespace
namespace l10n_util {
@@ -63,9 +81,12 @@ void HWNDSetRTLLayout(HWND hwnd) {
}
bool IsLocaleSupportedByOS(const std::string& locale) {
- // Block Amharic on Windows XP.
- return win_util::GetWinVersion() >= win_util::WINVERSION_VISTA ||
- !LowerCaseEqualsASCII(locale, "am");
+ // Block Amharic on Windows XP unless 'Abyssinica SIL' font is present.
+ // On Win XP, no Ethiopic/Amahric font is availabel out of box. We hard-coded
+ // 'Abyssinica SIL' in the resource bundle to use in the UI. Check
+ // for its presence to determine whether or not to support Amharic UI on XP.
+ return (win_util::GetWinVersion() >= win_util::WINVERSION_VISTA ||
+ !LowerCaseEqualsASCII(locale, "am") || IsFontPresent(L"Abyssinica SIL"));
}
bool NeedOverrideDefaultUIFont(std::wstring* override_font_family,
diff --git a/app/resources/app_locale_settings_am.xtb b/app/resources/app_locale_settings_am.xtb
index 4d08b65..5691f7e 100644
--- a/app/resources/app_locale_settings_am.xtb
+++ b/app/resources/app_locale_settings_am.xtb
@@ -1,7 +1,7 @@
<?xml version="1.0" ?>
<!DOCTYPE translationbundle>
<translationbundle lang="am">
-<translation id="IDS_UI_FONT_FAMILY_XP">default</translation>
+<translation id="IDS_UI_FONT_FAMILY_XP">abyssinica sil</translation>
<translation id="IDS_UI_FONT_FAMILY">default</translation>
<translation id="IDS_UI_FONT_SIZE_SCALER_XP">100</translation>
<translation id="IDS_UI_FONT_SIZE_SCALER">100</translation>