Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2350)

Unified Diff: Source/platform/fonts/win/FontFallbackWin.cpp

Issue 417823002: Merge 178313 "Add monospace-specific fallback for Hebrew and Ara..." (Closed) Base URL: svn://svn.chromium.org/blink/branches/chromium/2062/
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/fonts/win/FontFallbackWin.cpp
===================================================================
--- Source/platform/fonts/win/FontFallbackWin.cpp (revision 178785)
+++ Source/platform/fonts/win/FontFallbackWin.cpp (working copy)
@@ -69,6 +69,22 @@
// which works well since the range of UScriptCode values is small.
typedef const UChar* ScriptToFontMap[USCRIPT_CODE_LIMIT];
+void initializeScriptMonospaceFontMap(ScriptToFontMap& scriptFontMap, SkFontMgr* fontManager)
+{
+ struct FontMap {
+ UScriptCode script;
+ const UChar* family;
+ };
+
+ static const FontMap fontMap[] = {
+ { USCRIPT_HEBREW, L"courier new" },
+ { USCRIPT_ARABIC, L"courier new" },
+ };
+
+ for (size_t i = 0; i < WTF_ARRAY_LENGTH(fontMap); ++i)
+ scriptFontMap[fontMap[i].script] = fontMap[i].family;
+}
+
void initializeScriptFontMap(ScriptToFontMap& scriptFontMap, SkFontMgr* fontManager)
{
struct FontMap {
@@ -259,14 +275,18 @@
SkFontMgr* fontManager)
{
static ScriptToFontMap scriptFontMap;
+ static ScriptToFontMap scriptMonospaceFontMap;
static bool initialized = false;
if (!initialized) {
initializeScriptFontMap(scriptFontMap, fontManager);
+ initializeScriptMonospaceFontMap(scriptMonospaceFontMap, fontManager);
initialized = true;
}
if (script == USCRIPT_INVALID_CODE)
return 0;
ASSERT(script < USCRIPT_CODE_LIMIT);
+ if (generic == FontDescription::MonospaceFamily && scriptMonospaceFontMap[script])
+ return scriptMonospaceFontMap[script];
return scriptFontMap[script];
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698