summaryrefslogtreecommitdiffstats
path: root/graphics/java/android
diff options
context:
space:
mode:
authorRaph Levien <raph@google.com>2014-04-14 14:11:02 -0700
committerRaph Levien <raph@google.com>2014-04-17 11:16:46 -0700
commit53c0077256afebb0312f01ef4f60a7445da1f5d9 (patch)
tree6195aace369328dc798b1f9f286834e1118082b9 /graphics/java/android
parent31e052bfc4c81f0aa682d723a88cd9b716b6cace (diff)
downloadframeworks_base-53c0077256afebb0312f01ef4f60a7445da1f5d9.zip
frameworks_base-53c0077256afebb0312f01ef4f60a7445da1f5d9.tar.gz
frameworks_base-53c0077256afebb0312f01ef4f60a7445da1f5d9.tar.bz2
Add elegantTextHeight text appearance attribute
This patch adds an elegantTextHeight text appearance attribute and plumbs it through to the paint. This attribute selects the elegant variant of fonts (when appropriate, which is typically Arabic and indic scripts), and also specifies larger vertical metrics, to avoid clipping. The intent is for this to be the default for quantum themes, but this patch doesn't change any default behavior, just adds the attribute. The larger vertical metrics are applied to top and bottom, but should not affect line spacing in the common case. Also, with the setting, metrics are no longer dependent on the font, so setting a custom font will preserve layout and spacing. Change-Id: If3b7d41f141deff50ca078f479ca90c2aa07829a
Diffstat (limited to 'graphics/java/android')
-rw-r--r--graphics/java/android/graphics/Paint.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/graphics/java/android/graphics/Paint.java b/graphics/java/android/graphics/Paint.java
index 916cb5a..1e1128e 100644
--- a/graphics/java/android/graphics/Paint.java
+++ b/graphics/java/android/graphics/Paint.java
@@ -500,6 +500,7 @@ public class Paint {
mBidiFlags = BIDI_DEFAULT_LTR;
setTextLocale(Locale.getDefault());
+ setElegantTextHeight(false);
}
/**
@@ -1221,6 +1222,22 @@ public class Paint {
}
/**
+ * Get the elegant metrics flag.
+ *
+ * @return true if elegant metrics are enabled for text drawing.
+ */
+ public native boolean isElegantTextHeight();
+
+ /**
+ * Set the paint's elegant height metrics flag. This setting selects font
+ * variants that have not been compacted to fit Latin-based vertical
+ * metrics, and also increases top and bottom bounds to provide more space.
+ *
+ * @param elegant set the paint's elegant metrics flag for drawing text.
+ */
+ public native void setElegantTextHeight(boolean elegant);
+
+ /**
* Return the paint's text size.
*
* @return the paint's text size.