summaryrefslogtreecommitdiffstats
path: root/tools/layoutlib/bridge/src/android/graphics/Paint_Delegate.java
diff options
context:
space:
mode:
authorDeepanshu Gupta <deepanshu@google.com>2014-08-09 14:14:32 -0700
committerDeepanshu Gupta <deepanshu@google.com>2014-08-11 18:11:37 -0700
commite644ff8d92ba040d11636be0fb6c433b52bcc6c2 (patch)
treee3b08352b6054f35e9e610fce98538ba4209b58d /tools/layoutlib/bridge/src/android/graphics/Paint_Delegate.java
parent3afd00e9f2b55a21ca378d6e520d24283dbb62e0 (diff)
downloadframeworks_base-e644ff8d92ba040d11636be0fb6c433b52bcc6c2.zip
frameworks_base-e644ff8d92ba040d11636be0fb6c433b52bcc6c2.tar.gz
frameworks_base-e644ff8d92ba040d11636be0fb6c433b52bcc6c2.tar.bz2
Don't show warnings for fonts not bundled.
The extended font set, used on Nexus 5, new Nexus 7 etc., uses OpenType CFF fonts which don't work well with Java. These fonts are deliberately excluded from the SDK build. This change skips the warnings for the missing fonts. However, we still show warnings for other fonts that failed to load. If the set of fonts bundled with the SDK changes, we will need to update the list of missing fonts in FontFamily_Delegate.java. Change-Id: I3197b5350d048daa09512e8024188909179b1799
Diffstat (limited to 'tools/layoutlib/bridge/src/android/graphics/Paint_Delegate.java')
-rw-r--r--tools/layoutlib/bridge/src/android/graphics/Paint_Delegate.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/layoutlib/bridge/src/android/graphics/Paint_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Paint_Delegate.java
index 73d67a7..7b07404 100644
--- a/tools/layoutlib/bridge/src/android/graphics/Paint_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/Paint_Delegate.java
@@ -65,6 +65,8 @@ public class Paint_Delegate {
new DelegateManager<Paint_Delegate>(Paint_Delegate.class);
// ---- delegate helper data ----
+
+ // This list can contain null elements.
private List<FontInfo> mFonts;
// ---- delegate data ----
@@ -1171,6 +1173,12 @@ public class Paint_Delegate {
// and skew info.
ArrayList<FontInfo> infoList = new ArrayList<FontInfo>(fonts.size());
for (Font font : fonts) {
+ if (font == null) {
+ // If the font is null, add null to infoList. When rendering the text, if this
+ // null is reached, a warning will be logged.
+ infoList.add(null);
+ continue;
+ }
FontInfo info = new FontInfo();
info.mFont = font.deriveFont(mTextSize);
if (mTextScaleX != 1.0 || mTextSkewX != 0) {