summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDeepanshu Gupta <deepanshu@google.com>2014-02-19 10:53:27 -0800
committerDeepanshu Gupta <deepanshu@google.com>2014-02-19 10:53:27 -0800
commite327212adde1136807bbdf052e8cc3861f8a6aba (patch)
tree97558ceaecfff5d08db84aae1211aca00a948cb8 /tools
parent5441745effb885589c03050b59885e8a3ad96ad6 (diff)
downloadframeworks_base-e327212adde1136807bbdf052e8cc3861f8a6aba.zip
frameworks_base-e327212adde1136807bbdf052e8cc3861f8a6aba.tar.gz
frameworks_base-e327212adde1136807bbdf052e8cc3861f8a6aba.tar.bz2
Fix sans-serif-thin and sans-serif-light fonts in layoutlib.
For these font families, text was always rendered as italic. This changeset fixes the issue. Bug: http://b.android.com/57221 Change-Id: Ic8a299bd1e555f5bb914cd3d2fe72917ec7f471a
Diffstat (limited to 'tools')
-rw-r--r--tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/FontLoader.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/FontLoader.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/FontLoader.java
index 108b651..cc7338a 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/FontLoader.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/FontLoader.java
@@ -57,7 +57,9 @@ public final class FontLoader {
private static final String FONT_SUFFIX_NONE = ".ttf";
private static final String FONT_SUFFIX_REGULAR = "-Regular.ttf";
private static final String FONT_SUFFIX_BOLD = "-Bold.ttf";
- private static final String FONT_SUFFIX_ITALIC = "-Italic.ttf";
+ // FONT_SUFFIX_ITALIC will always match FONT_SUFFIX_BOLDITALIC and hence it must be checked
+ // separately.
+ private static final String FONT_SUFFIX_ITALIC = "Italic.ttf";
private static final String FONT_SUFFIX_BOLDITALIC = "-BoldItalic.ttf";
// This must match the values of Typeface styles so that we can use them for indices in this
@@ -285,10 +287,10 @@ public final class FontLoader {
mFontInfo.font[Typeface.NORMAL] = font;
} else if (fileName.endsWith(FONT_SUFFIX_BOLD)) {
mFontInfo.font[Typeface.BOLD] = font;
- } else if (fileName.endsWith(FONT_SUFFIX_ITALIC)) {
- mFontInfo.font[Typeface.ITALIC] = font;
} else if (fileName.endsWith(FONT_SUFFIX_BOLDITALIC)) {
mFontInfo.font[Typeface.BOLD_ITALIC] = font;
+ } else if (fileName.endsWith(FONT_SUFFIX_ITALIC)) {
+ mFontInfo.font[Typeface.ITALIC] = font;
} else if (fileName.endsWith(FONT_SUFFIX_NONE)) {
mFontInfo.font[Typeface.NORMAL] = font;
}