diff options
author | Deepanshu Gupta <deepanshu@google.com> | 2014-05-19 16:14:23 -0700 |
---|---|---|
committer | Deepanshu Gupta <deepanshu@google.com> | 2014-05-27 18:01:34 -0700 |
commit | baef8c1ffe5c900fb0da9512654bf249b5fc9269 (patch) | |
tree | d407f1e4f160cae5eb0b4d1c1bbaeb189d686b50 /graphics | |
parent | 80962666b88d4cba9eaf53832040651ce1766ec2 (diff) | |
download | frameworks_base-baef8c1ffe5c900fb0da9512654bf249b5fc9269.zip frameworks_base-baef8c1ffe5c900fb0da9512654bf249b5fc9269.tar.gz frameworks_base-baef8c1ffe5c900fb0da9512654bf249b5fc9269.tar.bz2 |
Layoutlib fixes for L [DO NOT MERGE]
This adds the new delegates that were missing. This starts the work on
changes related to Minikin Fonts.
There are some changes related to TypedArray that still need to be
fixed.
Change-Id: Ic2397b64aa3f1f48926e849b14689c47d9ee7f8c
(cherry picked from commit 7ca3612094270183243938e79337c84effea7ad0)
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/java/android/graphics/FontFamily.java | 1 | ||||
-rw-r--r-- | graphics/java/android/graphics/Typeface.java | 23 |
2 files changed, 20 insertions, 4 deletions
diff --git a/graphics/java/android/graphics/FontFamily.java b/graphics/java/android/graphics/FontFamily.java index a759a79..210ea86b 100644 --- a/graphics/java/android/graphics/FontFamily.java +++ b/graphics/java/android/graphics/FontFamily.java @@ -31,7 +31,6 @@ public class FontFamily { public FontFamily() { mNativePtr = nCreateFamily(); - mNativePtr = nCreateFamily(); if (mNativePtr == 0) { throw new RuntimeException(); } diff --git a/graphics/java/android/graphics/Typeface.java b/graphics/java/android/graphics/Typeface.java index 64451c4..b7613fb 100644 --- a/graphics/java/android/graphics/Typeface.java +++ b/graphics/java/android/graphics/Typeface.java @@ -66,6 +66,9 @@ public class Typeface { static Map<String, Typeface> sSystemFontMap; static FontFamily[] sFallbackFonts; + static final String SYSTEM_FONTS_CONFIG = "system_fonts.xml"; + static final String FALLBACK_FONTS_CONFIG = "fallback_fonts.xml"; + /** * @hide */ @@ -249,10 +252,16 @@ public class Typeface { return fontFamily; } - static { + /* + * (non-Javadoc) + * + * This should only be called once, from the static class initializer block. + */ + private static void init() { // Load font config and initialize Minikin state - String systemConfigFilename = "/system/etc/system_fonts.xml"; - String configFilename = "/system/etc/fallback_fonts.xml"; + File systemFontConfigLocation = getSystemFontConfigLocation(); + File systemConfigFilename = new File(systemFontConfigLocation, SYSTEM_FONTS_CONFIG); + File configFilename = new File(systemFontConfigLocation, FALLBACK_FONTS_CONFIG); try { // TODO: throws an exception non-Minikin builds, to fail early; // remove when Minikin-only @@ -301,7 +310,10 @@ public class Typeface { } catch (XmlPullParserException e) { Log.e(TAG, "XML parse exception for " + configFilename); } + } + static { + init(); // Set up defaults and typefaces exposed in public API DEFAULT = create((String) null, 0); DEFAULT_BOLD = create((String) null, Typeface.BOLD); @@ -315,6 +327,11 @@ public class Typeface { create((String) null, Typeface.ITALIC), create((String) null, Typeface.BOLD_ITALIC), }; + + } + + private static File getSystemFontConfigLocation() { + return new File("/system/etc/"); } @Override |