diff options
author | 2014-08-12 11:05:29 -0700 | |
---|---|---|
committer | 2014-08-12 11:05:29 -0700 | |
commit | 94fa4b99e2a53e997a90c7808cc5263f1bf40c9f (patch) | |
tree | f17ed31b1343a9d6329fb2101f78e21eb19ba897 /src/ports/SkFontConfigParser_android.cpp | |
parent | 8e69676bf559b9f3105f9107136ec93dfb124e80 (diff) |
Update path to Android font config file
In version LMP, Android is expected to change the path to their font
configuration file (and condense several files into one), as well as
changing the format (qv http://crrev.com/446473003/). This patch tries
the new path before falling back to the old path.
The new fonts are incompatible with assumptions made by the old
SkFontConfigInterfaceAndroid, so this patch MUST NOT land until
https://crrev.com/462073002/ or the equivalent has turned on the
new SkFontManager.
BUG=chromium:400801
R=djsollen@google.com, bungeman@google.com, tomhudson@google.com
Author: tomhudson@chromium.org
Review URL: https://codereview.chromium.org/458543002
Diffstat (limited to 'src/ports/SkFontConfigParser_android.cpp')
-rw-r--r-- | src/ports/SkFontConfigParser_android.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/ports/SkFontConfigParser_android.cpp b/src/ports/SkFontConfigParser_android.cpp index c6a3cf261f..6e8727048d 100644 --- a/src/ports/SkFontConfigParser_android.cpp +++ b/src/ports/SkFontConfigParser_android.cpp @@ -16,7 +16,14 @@ #include <limits> -#define SYSTEM_FONTS_FILE "/system/etc/system_fonts.xml" + + +// From Android version LMP onwards, all font files collapse into +// /system/fonts/fonts.xml. Instead of trying to detect which version +// we're on, try to open fonts.xml; if that fails, fall back to the +// older filename. +#define LMP_SYSTEM_FONTS_FILE "/system/etc/fonts.xml" +#define OLD_SYSTEM_FONTS_FILE "/system/etc/system_fonts.xml" #define FALLBACK_FONTS_FILE "/system/etc/fallback_fonts.xml" #define VENDOR_FONTS_FILE "/vendor/etc/fallback_fonts.xml" @@ -455,7 +462,11 @@ static void parseConfigFile(const char* filename, SkTDArray<FontFamily*> &famili } static void getSystemFontFamilies(SkTDArray<FontFamily*> &fontFamilies) { - parseConfigFile(SYSTEM_FONTS_FILE, fontFamilies); + parseConfigFile(LMP_SYSTEM_FONTS_FILE, fontFamilies); + + if (0 == fontFamilies.count()) { + parseConfigFile(OLD_SYSTEM_FONTS_FILE, fontFamilies); + } } /** |