diff options
author | Dianne Hackborn <hackbod@google.com> | 2011-08-12 18:59:39 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2011-08-12 18:59:39 -0700 |
commit | f43fa5746ee5b81a6e386d36594094d079ac8160 (patch) | |
tree | bf26f4fde8e7610722f6c75944b713c18d115064 /graphics | |
parent | 7c0d8472d003334fafd14f7c1e7d95dbd213088b (diff) | |
download | frameworks_base-f43fa5746ee5b81a6e386d36594094d079ac8160.zip frameworks_base-f43fa5746ee5b81a6e386d36594094d079ac8160.tar.gz frameworks_base-f43fa5746ee5b81a6e386d36594094d079ac8160.tar.bz2 |
Turn off hinting by default for higher density displays.
Also adds an API for apps to control whether hinting is used.
Change-Id: I1a06b06255fbb8d0f02a8ce48c2cd60019088ed3
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/java/android/graphics/Paint.java | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/graphics/java/android/graphics/Paint.java b/graphics/java/android/graphics/Paint.java index 828bafd..cde997e 100644 --- a/graphics/java/android/graphics/Paint.java +++ b/graphics/java/android/graphics/Paint.java @@ -20,6 +20,7 @@ import android.text.GraphicsOperations; import android.text.SpannableString; import android.text.SpannedString; import android.text.TextUtils; +import android.util.DisplayMetrics; /** * The Paint class holds the style and color information about how to draw @@ -106,6 +107,16 @@ public class Paint { static final int DEFAULT_PAINT_FLAGS = DEV_KERN_TEXT_FLAG; /** + * Option for {@link #setHinting}: disable hinting. + */ + public static final int HINTING_OFF = 0x0; + + /** + * Option for {@link #setHinting}: enable hinting. + */ + public static final int HINTING_ON = 0x1; + + /** * Bidi flag to set LTR paragraph direction. * * @hide @@ -333,6 +344,8 @@ public class Paint { public Paint(int flags) { mNativePaint = native_init(); setFlags(flags | DEFAULT_PAINT_FLAGS); + setHinting(DisplayMetrics.DENSITY_DEVICE >= DisplayMetrics.DENSITY_TV + ? HINTING_OFF : HINTING_ON); mCompatScaling = mInvCompatScaling = 1; } @@ -367,6 +380,8 @@ public class Paint { public void reset() { native_reset(mNativePaint); setFlags(DEFAULT_PAINT_FLAGS); + setHinting(DisplayMetrics.DENSITY_DEVICE >= DisplayMetrics.DENSITY_TV + ? HINTING_OFF : HINTING_ON); mHasCompatScaling = false; mCompatScaling = mInvCompatScaling = 1; mBidiFlags = BIDI_DEFAULT_LTR; @@ -446,6 +461,18 @@ public class Paint { public native void setFlags(int flags); /** + * Return the paint's hinting mode. Returns either + * {@link #HINTING_OFF} or {@link #HINTING_ON}. + */ + public native int getHinting(); + + /** + * Set the paint's hinting mode. May be either + * {@link #HINTING_OFF} or {@link #HINTING_ON}. + */ + public native void setHinting(int mode); + + /** * Helper for getFlags(), returning true if ANTI_ALIAS_FLAG bit is set * AntiAliasing smooths out the edges of what is being drawn, but is has * no impact on the interior of the shape. See setDither() and |