From 53c0077256afebb0312f01ef4f60a7445da1f5d9 Mon Sep 17 00:00:00 2001 From: Raph Levien Date: Mon, 14 Apr 2014 14:11:02 -0700 Subject: 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 --- graphics/java/android/graphics/Paint.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'graphics/java/android') 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. -- cgit v1.1