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

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

Issue 1314543011: Add fallback fonts for math and symbol blocks on Windows (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 3 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 | « LayoutTests/TestExpectations ('k') | 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
diff --git a/Source/platform/fonts/win/FontFallbackWin.cpp b/Source/platform/fonts/win/FontFallbackWin.cpp
index 7d2f8f43ab570ab92c67ebb4512ba21c6b859db3..bde67857344e53832311bdc02184ce6e62a73c69 100644
--- a/Source/platform/fonts/win/FontFallbackWin.cpp
+++ b/Source/platform/fonts/win/FontFallbackWin.cpp
@@ -297,8 +297,10 @@ UScriptCode getScript(int ucs4)
const UChar* getFontBasedOnUnicodeBlock(int ucs4, SkFontMgr* fontManager)
{
static const UChar* emojiFonts[] = {L"Segoe UI Emoji", L"Segoe UI Symbol"};
+ static const UChar* mathFonts[] = {L"Cambria Math", L"Segoe UI Symbol", L"Code2000"};
static const UChar* symbolFont = L"Segoe UI Symbol";
static const UChar* emojiFont = 0;
+ static const UChar* mathFont = 0;
static bool initialized = false;
if (!initialized) {
for (size_t i = 0; i < WTF_ARRAY_LENGTH(emojiFonts); i++) {
@@ -307,23 +309,43 @@ const UChar* getFontBasedOnUnicodeBlock(int ucs4, SkFontMgr* fontManager)
break;
}
}
+ for (size_t i = 0; i < WTF_ARRAY_LENGTH(mathFonts); i++) {
+ if (isFontPresent(mathFonts[i], fontManager)) {
+ mathFont = mathFonts[i];
+ break;
+ }
+ }
initialized = true;
}
UBlockCode block = ublock_getCode(ucs4);
switch (block) {
case UBLOCK_EMOTICONS:
+ case UBLOCK_ENCLOSED_ALPHANUMERIC_SUPPLEMENT:
return emojiFont;
case UBLOCK_PLAYING_CARDS:
case UBLOCK_MISCELLANEOUS_SYMBOLS:
+ case UBLOCK_MISCELLANEOUS_SYMBOLS_AND_ARROWS:
case UBLOCK_MISCELLANEOUS_SYMBOLS_AND_PICTOGRAPHS:
- case UBLOCK_MISCELLANEOUS_TECHNICAL:
case UBLOCK_TRANSPORT_AND_MAP_SYMBOLS:
case UBLOCK_ALCHEMICAL_SYMBOLS:
case UBLOCK_RUNIC:
- case UBLOCK_SUPPLEMENTAL_MATHEMATICAL_OPERATORS:
case UBLOCK_DINGBATS:
+ case UBLOCK_GOTHIC:
return symbolFont;
+ case UBLOCK_ARROWS:
+ case UBLOCK_MATHEMATICAL_OPERATORS:
+ case UBLOCK_MISCELLANEOUS_TECHNICAL:
+ case UBLOCK_GEOMETRIC_SHAPES:
+ case UBLOCK_MISCELLANEOUS_MATHEMATICAL_SYMBOLS_A:
+ case UBLOCK_SUPPLEMENTAL_ARROWS_A:
+ case UBLOCK_SUPPLEMENTAL_ARROWS_B:
+ case UBLOCK_MISCELLANEOUS_MATHEMATICAL_SYMBOLS_B:
+ case UBLOCK_SUPPLEMENTAL_MATHEMATICAL_OPERATORS:
+ case UBLOCK_MATHEMATICAL_ALPHANUMERIC_SYMBOLS:
+ case UBLOCK_ARABIC_MATHEMATICAL_ALPHABETIC_SYMBOLS:
+ case UBLOCK_GEOMETRIC_SHAPES_EXTENDED:
+ return mathFont;
default:
return 0;
};
« no previous file with comments | « LayoutTests/TestExpectations ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698