summaryrefslogtreecommitdiffstats
path: root/graphics
diff options
context:
space:
mode:
authorDeepanshu Gupta <deepanshu@google.com>2014-05-28 17:18:58 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-05-28 17:18:59 +0000
commitdc925857fcd6a9097d6a1d8b85fca231e8d102fc (patch)
tree73a1db6c8905a8d196ae278d19af0680f227e6bb /graphics
parenta0b731363d7fa12a121425fb6845461203d8756f (diff)
parentbaef8c1ffe5c900fb0da9512654bf249b5fc9269 (diff)
downloadframeworks_base-dc925857fcd6a9097d6a1d8b85fca231e8d102fc.zip
frameworks_base-dc925857fcd6a9097d6a1d8b85fca231e8d102fc.tar.gz
frameworks_base-dc925857fcd6a9097d6a1d8b85fca231e8d102fc.tar.bz2
Merge "Layoutlib fixes for L [DO NOT MERGE]" into lmp-preview-dev
Diffstat (limited to 'graphics')
-rw-r--r--graphics/java/android/graphics/FontFamily.java1
-rw-r--r--graphics/java/android/graphics/Typeface.java23
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