Bug 1170421 - return first font suggested by fontconfig as the default font. r=karlt
authorJohn Daggett <jdaggett@mozilla.com>
Tue, 02 Jun 2015 17:20:15 +0900
changeset 246720 7cd191b31b38def9689568491ef04429eebbb9a9
parent 246719 90bdd7a731ef81c5241ef415469bb8298e9db448
child 246721 b0bc0aa638168cfdd4dd8d2f990aaa545891db42
push id28839
push userkwierso@gmail.com
push dateWed, 03 Jun 2015 01:20:15 +0000
treeherdermozilla-central@20a96e15631a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskarlt
bugs1170421
milestone41.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1170421 - return first font suggested by fontconfig as the default font. r=karlt
gfx/thebes/gfxFcPlatformFontList.cpp
--- a/gfx/thebes/gfxFcPlatformFontList.cpp
+++ b/gfx/thebes/gfxFcPlatformFontList.cpp
@@ -1140,17 +1140,20 @@ gfxFcPlatformFontList::GetFontList(nsIAt
         aListOfFonts.InsertElementAt(0, NS_LITERAL_STRING("sans-serif"));
     if (serif)
         aListOfFonts.InsertElementAt(0, NS_LITERAL_STRING("serif"));
 }
 
 gfxFontFamily*
 gfxFcPlatformFontList::GetDefaultFont(const gfxFontStyle* aStyle)
 {
-    return FindGenericFamily(NS_LITERAL_STRING("serif"), nsGkAtoms::x_western);
+    // Get the default font by using a fake name to retrieve the first
+    // scalable font that fontconfig suggests for the given language.
+    return FindGenericFamily(NS_LITERAL_STRING("-moz-default"),
+                             aStyle->language);
 }
 
 gfxFontEntry*
 gfxFcPlatformFontList::LookupLocalFont(const nsAString& aFontName,
                                        uint16_t aWeight,
                                        int16_t aStretch,
                                        bool aItalic)
 {