Title: [148228] trunk/Source/WebCore
Revision
148228
Author
[email protected]
Date
2013-04-11 13:08:32 -0700 (Thu, 11 Apr 2013)

Log Message

[BlackBerry] Use the platform list of languages with fonts instead of hardcoding
https://bugs.webkit.org/show_bug.cgi?id=114452

Patch by Eli Fidler <[email protected]> on 2013-04-11
Reviewed by Rob Buis.

BlackBerry PR 325244
Internally reviewed by Jeff Rogers

No functional change, but platform font changes won't need a WebKit change
going forward.

* page/blackberry/SettingsBlackBerry.cpp:
(WebCore::Settings::initializeDefaultFontFamilies):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (148227 => 148228)


--- trunk/Source/WebCore/ChangeLog	2013-04-11 20:05:17 UTC (rev 148227)
+++ trunk/Source/WebCore/ChangeLog	2013-04-11 20:08:32 UTC (rev 148228)
@@ -1,3 +1,19 @@
+2013-04-11  Eli Fidler  <[email protected]>
+
+        [BlackBerry] Use the platform list of languages with fonts instead of hardcoding
+        https://bugs.webkit.org/show_bug.cgi?id=114452
+
+        Reviewed by Rob Buis.
+
+        BlackBerry PR 325244
+        Internally reviewed by Jeff Rogers
+
+        No functional change, but platform font changes won't need a WebKit change
+        going forward.
+
+        * page/blackberry/SettingsBlackBerry.cpp:
+        (WebCore::Settings::initializeDefaultFontFamilies):
+
 2013-04-11  Dirk Schulze  <[email protected]>
 
         [CSS Shaders] Parse parameters descriptor

Modified: trunk/Source/WebCore/page/blackberry/SettingsBlackBerry.cpp (148227 => 148228)


--- trunk/Source/WebCore/page/blackberry/SettingsBlackBerry.cpp	2013-04-11 20:05:17 UTC (rev 148227)
+++ trunk/Source/WebCore/page/blackberry/SettingsBlackBerry.cpp	2013-04-11 20:08:32 UTC (rev 148228)
@@ -27,29 +27,10 @@
 
 void Settings::initializeDefaultFontFamilies()
 {
-    static const char* kLanguages[] = {
-        "ar",
-        "bn",
-        "gu",
-        "he",
-        "hi",
-        "ja",
-        "kn",
-        "ko",
-        "ml",
-        "pa",
-        "ta",
-        "te",
-        "th",
-        "zh-CN",
-        "zh-TW",
-    };
-
-    static BlackBerry::Platform::String* languages[WTF_ARRAY_LENGTH(kLanguages)];
+    static std::vector<BlackBerry::Platform::String> languages;
     static bool init = false;
     if (!init) {
-        for (size_t i = 0; i < WTF_ARRAY_LENGTH(kLanguages); ++i)
-            languages[i] = new BlackBerry::Platform::String(kLanguages[i]);
+        languages = BlackBerry::Platform::FontInfo::instance()->languagesWithFonts();
         init = true;
     }
 
@@ -70,12 +51,12 @@
     STATIC_LOCAL_STRING(s_monospace, "monospace");
     STATIC_LOCAL_STRING(s_serif, "serif");
     STATIC_LOCAL_STRING(s_sansSerif, "sans-serif");
-    for (size_t i = 0; i < WTF_ARRAY_LENGTH(languages); ++i) {
-        UScriptCode script = localeToScriptCodeForFontSelection(*languages[i]);
-        setFixedFontFamily(BlackBerry::Platform::FontInfo::instance()->fontFamily(s_monospace, *languages[i]), script);
-        setSansSerifFontFamily(BlackBerry::Platform::FontInfo::instance()->fontFamily(s_sansSerif, *languages[i]), script);
-        setSerifFontFamily(BlackBerry::Platform::FontInfo::instance()->fontFamily(s_serif, *languages[i]), script);
-        setStandardFontFamily(BlackBerry::Platform::FontInfo::instance()->fontFamily(BlackBerry::Platform::String::emptyString(), *languages[i]), script);
+    for (size_t i = 0; i < languages.size(); ++i) {
+        UScriptCode script = localeToScriptCodeForFontSelection(languages[i]);
+        setFixedFontFamily(BlackBerry::Platform::FontInfo::instance()->fontFamily(s_monospace, languages[i]), script);
+        setSansSerifFontFamily(BlackBerry::Platform::FontInfo::instance()->fontFamily(s_sansSerif, languages[i]), script);
+        setSerifFontFamily(BlackBerry::Platform::FontInfo::instance()->fontFamily(s_serif, languages[i]), script);
+        setStandardFontFamily(BlackBerry::Platform::FontInfo::instance()->fontFamily(BlackBerry::Platform::String::emptyString(), languages[i]), script);
     }
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to