summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorjshin@chromium.org <jshin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-20 17:28:06 +0000
committerjshin@chromium.org <jshin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-20 17:28:06 +0000
commit9f7af522830ec5c9ff7ad00a62a2a17485befcbd (patch)
treee5db4b3d08fff27a1d952e41738b01acf3443f7d /app
parent5c2471b3621992761ea946b3929c7fde86fb24ce (diff)
downloadchromium_src-9f7af522830ec5c9ff7ad00a62a2a17485befcbd.zip
chromium_src-9f7af522830ec5c9ff7ad00a62a2a17485befcbd.tar.gz
chromium_src-9f7af522830ec5c9ff7ad00a62a2a17485befcbd.tar.bz2
Enable Amharic (am) on Windows XP only if the font (Abyssinica SIL) is present.
BUG=36752 TEST=On Windows XP, try run Chrome with '--lang=am' with and without 'Abyssinica SIL font installed. Without it, it should fall back to English UI. With it, it should be in Amharic UI. 'Abyssinica SIL' can be downloaded at http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&item_id=SILFontList Review URL: http://codereview.chromium.org/1575037 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45047 0039d316-1c4b-4281-b951-d872f2087c98
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>