Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Inherited Constants](https://developer.android.com/reference/android/text/TextPaint#inhconstants) \| [Fields](https://developer.android.com/reference/android/text/TextPaint#lfields) \| [Ctors](https://developer.android.com/reference/android/text/TextPaint#pubctors) \| [Methods](https://developer.android.com/reference/android/text/TextPaint#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/text/TextPaint#inhmethods)

# TextPaint

*** ** * ** ***


`
public


class
TextPaint
`


`


`

`

extends https://developer.android.com/reference/android/graphics/Paint


`

`


`

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) |||
| ↳ | [android.graphics.Paint](https://developer.android.com/reference/android/graphics/Paint) ||
|   | ↳ | android.text.TextPaint |

<br />

*** ** * ** ***

TextPaint is an extension of Paint that leaves room for some extra
data used during text measuring and drawing.

## Summary

### Inherited constants

From class `https://developer.android.com/reference/android/graphics/Paint` `int` `https://developer.android.com/reference/android/graphics/Paint#ANTI_ALIAS_FLAG`

Paint flag that enables antialiasing when drawing.


`int` `https://developer.android.com/reference/android/graphics/Paint#CURSOR_AFTER`

Option for getTextRunCursor.


`int` `https://developer.android.com/reference/android/graphics/Paint#CURSOR_AT`

Option for getTextRunCursor.


`int` `https://developer.android.com/reference/android/graphics/Paint#CURSOR_AT_OR_AFTER`

Option for getTextRunCursor.


`int` `https://developer.android.com/reference/android/graphics/Paint#CURSOR_AT_OR_BEFORE`

Option for getTextRunCursor.


`int` `https://developer.android.com/reference/android/graphics/Paint#CURSOR_BEFORE`

Option for getTextRunCursor.


`int` `https://developer.android.com/reference/android/graphics/Paint#DEV_KERN_TEXT_FLAG`

Legacy Paint flag, no longer used.


`int` `https://developer.android.com/reference/android/graphics/Paint#DITHER_FLAG`

Paint flag that enables dithering when blitting.


`int` `https://developer.android.com/reference/android/graphics/Paint#EMBEDDED_BITMAP_TEXT_FLAG`

Paint flag that enables the use of bitmap fonts when drawing text.


`int` `https://developer.android.com/reference/android/graphics/Paint#END_HYPHEN_EDIT_INSERT_ARMENIAN_HYPHEN`

An integer representing the end of the line has Armentian hyphen (U+058A).


`int` `https://developer.android.com/reference/android/graphics/Paint#END_HYPHEN_EDIT_INSERT_HYPHEN`

An integer representing the end of the line has normal hyphen character (U+002D).


`int` `https://developer.android.com/reference/android/graphics/Paint#END_HYPHEN_EDIT_INSERT_MAQAF`

An integer representing the end of the line has maqaf (Hebrew hyphen, U+05BE).


`int` `https://developer.android.com/reference/android/graphics/Paint#END_HYPHEN_EDIT_INSERT_UCAS_HYPHEN`

An integer representing the end of the line has Canadian Syllabics hyphen (U+1400).


`int` `https://developer.android.com/reference/android/graphics/Paint#END_HYPHEN_EDIT_INSERT_ZWJ_AND_HYPHEN`

An integer representing the end of the line has Zero-Width-Joiner (U+200D) followed by normal
hyphen character (U+002D).


`int` `https://developer.android.com/reference/android/graphics/Paint#END_HYPHEN_EDIT_NO_EDIT`

An integer representing the end of the line has no modification for hyphenation.


`int` `https://developer.android.com/reference/android/graphics/Paint#END_HYPHEN_EDIT_REPLACE_WITH_HYPHEN`

An integer representing the character at the end of the line is replaced with hyphen
character (U+002D).


`int` `https://developer.android.com/reference/android/graphics/Paint#FAKE_BOLD_TEXT_FLAG`

Paint flag that applies a synthetic bolding effect to drawn text.


`int` `https://developer.android.com/reference/android/graphics/Paint#FILTER_BITMAP_FLAG`

Paint flag that enables bilinear sampling on scaled bitmaps.


`int` `https://developer.android.com/reference/android/graphics/Paint#HINTING_OFF`

Font hinter option that disables font hinting.


`int` `https://developer.android.com/reference/android/graphics/Paint#HINTING_ON`

Font hinter option that enables font hinting.


`int` `https://developer.android.com/reference/android/graphics/Paint#LINEAR_TEXT_FLAG`

Paint flag that enables smooth linear scaling of text.


`int` `https://developer.android.com/reference/android/graphics/Paint#START_HYPHEN_EDIT_INSERT_HYPHEN`

An integer representing the starting of the line has normal hyphen character (U+002D).


`int` `https://developer.android.com/reference/android/graphics/Paint#START_HYPHEN_EDIT_INSERT_ZWJ`

An integer representing the starting of the line has Zero-Width-Joiner (U+200D).


`int` `https://developer.android.com/reference/android/graphics/Paint#START_HYPHEN_EDIT_NO_EDIT`

An integer representing the starting of the line has no modification for hyphenation.


`int` `https://developer.android.com/reference/android/graphics/Paint#STRIKE_THRU_TEXT_FLAG`

Paint flag that applies a strike-through decoration to drawn text.


`int` `https://developer.android.com/reference/android/graphics/Paint#SUBPIXEL_TEXT_FLAG`

Paint flag that enables subpixel positioning of text.


`int` `https://developer.android.com/reference/android/graphics/Paint#TEXT_RUN_FLAG_LEFT_EDGE`

A text run flag that indicates the run is located the visually most left segment of the line.


`int` `https://developer.android.com/reference/android/graphics/Paint#TEXT_RUN_FLAG_RIGHT_EDGE`

A text run flag that indicates the run is located the visually most right segment of the
line.


`int` `https://developer.android.com/reference/android/graphics/Paint#UNDERLINE_TEXT_FLAG`

Paint flag that applies an underline decoration to drawn text.


`int` `https://developer.android.com/reference/android/graphics/Paint#VERTICAL_TEXT_FLAG`

A flat that controls text to be written in vertical orientation


This flag is used for telling the underlying text layout engine that the text is for vertical
direction.


| ### Fields ||
|---|---|
| ` public int` | `https://developer.android.com/reference/android/text/TextPaint#baselineShift` |
| ` public int` | `https://developer.android.com/reference/android/text/TextPaint#bgColor` |
| ` public float` | `https://developer.android.com/reference/android/text/TextPaint#density` |
| ` public int[]` | `https://developer.android.com/reference/android/text/TextPaint#drawableState` |
| ` public int` | `https://developer.android.com/reference/android/text/TextPaint#linkColor` |
| ` public int` | `https://developer.android.com/reference/android/text/TextPaint#underlineColor` Special value 0 means no custom underline |
| ` public float` | `https://developer.android.com/reference/android/text/TextPaint#underlineThickness` Thickness of the underline, in pixels. |

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/text/TextPaint#TextPaint()() ` |
| ` https://developer.android.com/reference/android/text/TextPaint#TextPaint(android.graphics.Paint)(https://developer.android.com/reference/android/graphics/Paint p) ` |
| ` https://developer.android.com/reference/android/text/TextPaint#TextPaint(int)(int flags) ` |

| ### Public methods ||
|---|---|
| ` float` | ` https://developer.android.com/reference/android/text/TextPaint#getUnderlineThickness()() ` Returns the thickness of the underline in pixels. |
| ` void` | ` https://developer.android.com/reference/android/text/TextPaint#set(android.text.TextPaint)(https://developer.android.com/reference/android/text/TextPaint tp) ` Copy the fields from tp into this TextPaint, including the fields inherited from Paint. |

### Inherited methods

From class `

https://developer.android.com/reference/android/graphics/Paint

` `


float` `
https://developer.android.com/reference/android/graphics/Paint#ascent()()
`

Return the distance above (negative) the baseline (ascent) based on the
current typeface and text size.


`


int` `
https://developer.android.com/reference/android/graphics/Paint#breakText(char[],%20int,%20int,%20float,%20float[])(char[] text, int index, int count, float maxWidth, float[] measuredWidth)
`

Measure the text, stopping early if the measured width exceeds maxWidth.


`


int` `
https://developer.android.com/reference/android/graphics/Paint#breakText(java.lang.String,%20boolean,%20float,%20float[])(https://developer.android.com/reference/java/lang/String text, boolean measureForwards, float maxWidth, float[] measuredWidth)
`

Measure the text, stopping early if the measured width exceeds maxWidth.


`


int` `
https://developer.android.com/reference/android/graphics/Paint#breakText(java.lang.CharSequence,%20int,%20int,%20boolean,%20float,%20float[])(https://developer.android.com/reference/java/lang/CharSequence text, int start, int end, boolean measureForwards, float maxWidth, float[] measuredWidth)
`

Measure the text, stopping early if the measured width exceeds maxWidth.


`


void` `
https://developer.android.com/reference/android/graphics/Paint#clearShadowLayer()()
`

Clear the shadow layer.


`


float` `
https://developer.android.com/reference/android/graphics/Paint#descent()()
`

Return the distance below (positive) the baseline (descent) based on the
current typeface and text size.


`


boolean` `
https://developer.android.com/reference/android/graphics/Paint#equalsForTextMeasurement(android.graphics.Paint)(https://developer.android.com/reference/android/graphics/Paint other)
`

Returns true of the passed `https://developer.android.com/reference/android/graphics/Paint` will have the same effect on text measurement


`


int` `
https://developer.android.com/reference/android/graphics/Paint#getAlpha()()
`

Helper to getColor() that just returns the color's alpha value.


`


https://developer.android.com/reference/android/graphics/BlendMode` `
https://developer.android.com/reference/android/graphics/Paint#getBlendMode()()
`

Get the paint's blend mode object.


`


int` `
https://developer.android.com/reference/android/graphics/Paint#getColor()()
`

Return the paint's color in sRGB.


`


https://developer.android.com/reference/android/graphics/ColorFilter` `
https://developer.android.com/reference/android/graphics/Paint#getColorFilter()()
`

Get the paint's colorfilter (maybe be null).


`


long` `
https://developer.android.com/reference/android/graphics/Paint#getColorLong()()
`

Return the paint's color.


`


int` `
https://developer.android.com/reference/android/graphics/Paint#getEndHyphenEdit()()
`

Get the current value of end hyphen edit.


`


boolean` `
https://developer.android.com/reference/android/graphics/Paint#getFillPath(android.graphics.Path,%20android.graphics.Path)(https://developer.android.com/reference/android/graphics/Path src, https://developer.android.com/reference/android/graphics/Path dst)
`

Applies any/all effects (patheffect, stroking) to src, returning the
result in dst.


`


int` `
https://developer.android.com/reference/android/graphics/Paint#getFlags()()
`

Return the paint's flags.


`


https://developer.android.com/reference/java/lang/String` `
https://developer.android.com/reference/android/graphics/Paint#getFontFeatureSettings()()
`

Returns the font feature settings.


`


float` `
https://developer.android.com/reference/android/graphics/Paint#getFontMetrics(android.graphics.Paint.FontMetrics)(https://developer.android.com/reference/android/graphics/Paint.FontMetrics metrics)
`

Return the font's recommended interline spacing, given the Paint's
settings for typeface, textSize, etc.


`


https://developer.android.com/reference/android/graphics/Paint.FontMetrics` `
https://developer.android.com/reference/android/graphics/Paint#getFontMetrics()()
`

Allocates a new FontMetrics object, and then calls getFontMetrics(fm)
with it, returning the object.


`


void` `
https://developer.android.com/reference/android/graphics/Paint#getFontMetricsForLocale(android.graphics.Paint.FontMetrics)(https://developer.android.com/reference/android/graphics/Paint.FontMetrics metrics)
`

Get the font metrics used for the locale

Obtain the metrics of the font that is used for the specified locale by
`https://developer.android.com/reference/android/graphics/Paint#setTextLocales(android.os.LocaleList)`.


`


void` `
https://developer.android.com/reference/android/graphics/Paint#getFontMetricsInt(char[],%20int,%20int,%20int,%20int,%20boolean,%20android.graphics.Paint.FontMetricsInt)(char[] text, int start, int count, int contextStart, int contextCount, boolean isRtl, https://developer.android.com/reference/android/graphics/Paint.FontMetricsInt outMetrics)
`

Returns the font metrics value for the given text.


`


int` `
https://developer.android.com/reference/android/graphics/Paint#getFontMetricsInt(android.graphics.Paint.FontMetricsInt)(https://developer.android.com/reference/android/graphics/Paint.FontMetricsInt fmi)
`

Return the font's interline spacing, given the Paint's settings for
typeface, textSize, etc.


`


https://developer.android.com/reference/android/graphics/Paint.FontMetricsInt` `
https://developer.android.com/reference/android/graphics/Paint#getFontMetricsInt()()
` `


void` `
https://developer.android.com/reference/android/graphics/Paint#getFontMetricsInt(java.lang.CharSequence,%20int,%20int,%20int,%20int,%20boolean,%20android.graphics.Paint.FontMetricsInt)(https://developer.android.com/reference/java/lang/CharSequence text, int start, int count, int contextStart, int contextCount, boolean isRtl, https://developer.android.com/reference/android/graphics/Paint.FontMetricsInt outMetrics)
`

Returns the font metrics value for the given text.


`


void` `
https://developer.android.com/reference/android/graphics/Paint#getFontMetricsIntForLocale(android.graphics.Paint.FontMetricsInt)(https://developer.android.com/reference/android/graphics/Paint.FontMetricsInt metrics)
`

Get the font metrics used for the locale

Obtain the metrics of the font that is used for the specified locale by
`https://developer.android.com/reference/android/graphics/Paint#setTextLocales(android.os.LocaleList)`.


`


float` `
https://developer.android.com/reference/android/graphics/Paint#getFontSpacing()()
`

Return the recommend line spacing based on the current typeface and
text size.


`


https://developer.android.com/reference/java/lang/String` `
https://developer.android.com/reference/android/graphics/Paint#getFontVariationOverride()()
`

Gets the current font variation override value.


`


https://developer.android.com/reference/java/lang/String` `
https://developer.android.com/reference/android/graphics/Paint#getFontVariationSettings()()
`

Returns the font variation settings.


`


int` `
https://developer.android.com/reference/android/graphics/Paint#getHinting()()
`

Return the paint's hinting mode.


`


float` `
https://developer.android.com/reference/android/graphics/Paint#getLetterSpacing()()
`

Return the paint's letter-spacing for text.


`


https://developer.android.com/reference/android/graphics/MaskFilter` `
https://developer.android.com/reference/android/graphics/Paint#getMaskFilter()()
`

Get the paint's maskfilter object.


`


int` `
https://developer.android.com/reference/android/graphics/Paint#getOffsetForAdvance(char[],%20int,%20int,%20int,%20int,%20boolean,%20float)(char[] text, int start, int end, int contextStart, int contextEnd, boolean isRtl, float advance)
`

Get the character offset within the string whose position is closest to the specified
horizontal position.


`


int` `
https://developer.android.com/reference/android/graphics/Paint#getOffsetForAdvance(java.lang.CharSequence,%20int,%20int,%20int,%20int,%20boolean,%20float)(https://developer.android.com/reference/java/lang/CharSequence text, int start, int end, int contextStart, int contextEnd, boolean isRtl, float advance)
` `


https://developer.android.com/reference/android/graphics/PathEffect` `
https://developer.android.com/reference/android/graphics/Paint#getPathEffect()()
`

Get the paint's patheffect object.


`


float` `
https://developer.android.com/reference/android/graphics/Paint#getRunAdvance(char[],%20int,%20int,%20int,%20int,%20boolean,%20int)(char[] text, int start, int end, int contextStart, int contextEnd, boolean isRtl, int offset)
`

Measure cursor position within a run of text.


`


float` `
https://developer.android.com/reference/android/graphics/Paint#getRunAdvance(java.lang.CharSequence,%20int,%20int,%20int,%20int,%20boolean,%20int)(https://developer.android.com/reference/java/lang/CharSequence text, int start, int end, int contextStart, int contextEnd, boolean isRtl, int offset)
` `


float` `
https://developer.android.com/reference/android/graphics/Paint#getRunCharacterAdvance(java.lang.CharSequence,%20int,%20int,%20int,%20int,%20boolean,%20int,%20float[],%20int)(https://developer.android.com/reference/java/lang/CharSequence text, int start, int end, int contextStart, int contextEnd, boolean isRtl, int offset, float[] advances, int advancesIndex)
` `


float` `
https://developer.android.com/reference/android/graphics/Paint#getRunCharacterAdvance(char[],%20int,%20int,%20int,%20int,%20boolean,%20int,%20float[],%20int)(char[] text, int start, int end, int contextStart, int contextEnd, boolean isRtl, int offset, float[] advances, int advancesIndex)
`

Measure the advance of each character within a run of text and also return the cursor
position within the run.


`


https://developer.android.com/reference/android/graphics/Shader` `
https://developer.android.com/reference/android/graphics/Paint#getShader()()
`

Get the paint's shader object.


`


int` `
https://developer.android.com/reference/android/graphics/Paint#getShadowLayerColor()()
`

Returns the color of the shadow layer.


`


long` `
https://developer.android.com/reference/android/graphics/Paint#getShadowLayerColorLong()()
`

Returns the color of the shadow layer.


`


float` `
https://developer.android.com/reference/android/graphics/Paint#getShadowLayerDx()()
`

Returns the x offset of the shadow layer.


`


float` `
https://developer.android.com/reference/android/graphics/Paint#getShadowLayerDy()()
`

Returns the y offset of the shadow layer.


`


float` `
https://developer.android.com/reference/android/graphics/Paint#getShadowLayerRadius()()
`

Returns the blur radius of the shadow layer.


`


int` `
https://developer.android.com/reference/android/graphics/Paint#getStartHyphenEdit()()
`

Get the current value of start hyphen edit.


`


float` `
https://developer.android.com/reference/android/graphics/Paint#getStrikeThruPosition()()
`

Distance from top of the strike-through line to the baseline in pixels.


`


float` `
https://developer.android.com/reference/android/graphics/Paint#getStrikeThruThickness()()
`

Returns the thickness of the strike-through line in pixels.


`


https://developer.android.com/reference/android/graphics/Paint.Cap` `
https://developer.android.com/reference/android/graphics/Paint#getStrokeCap()()
`

Return the paint's Cap, controlling how the start and end of stroked
lines and paths are treated.


`


https://developer.android.com/reference/android/graphics/Paint.Join` `
https://developer.android.com/reference/android/graphics/Paint#getStrokeJoin()()
`

Return the paint's stroke join type.


`


float` `
https://developer.android.com/reference/android/graphics/Paint#getStrokeMiter()()
`

Return the paint's stroke miter value.


`


float` `
https://developer.android.com/reference/android/graphics/Paint#getStrokeWidth()()
`

Return the width for stroking.


`


https://developer.android.com/reference/android/graphics/Paint.Style` `
https://developer.android.com/reference/android/graphics/Paint#getStyle()()
`

Return the paint's style, used for controlling how primitives'
geometries are interpreted (except for drawBitmap, which always assumes
FILL_STYLE).


`


https://developer.android.com/reference/android/graphics/Paint.Align` `
https://developer.android.com/reference/android/graphics/Paint#getTextAlign()()
`

Return the paint's Align value for drawing text.


`


void` `
https://developer.android.com/reference/android/graphics/Paint#getTextBounds(java.lang.String,%20int,%20int,%20android.graphics.Rect)(https://developer.android.com/reference/java/lang/String text, int start, int end, https://developer.android.com/reference/android/graphics/Rect bounds)
`

Retrieve the text boundary box and store to bounds.


`


void` `
https://developer.android.com/reference/android/graphics/Paint#getTextBounds(java.lang.CharSequence,%20int,%20int,%20android.graphics.Rect)(https://developer.android.com/reference/java/lang/CharSequence text, int start, int end, https://developer.android.com/reference/android/graphics/Rect bounds)
`

Retrieve the text boundary box and store to bounds.


`


void` `
https://developer.android.com/reference/android/graphics/Paint#getTextBounds(char[],%20int,%20int,%20android.graphics.Rect)(char[] text, int index, int count, https://developer.android.com/reference/android/graphics/Rect bounds)
`

Return in bounds (allocated by the caller) the smallest rectangle that
encloses all of the characters, with an implied origin at (0,0).


`


https://developer.android.com/reference/java/util/Locale` `
https://developer.android.com/reference/android/graphics/Paint#getTextLocale()()
`

Get the text's primary Locale.


`


https://developer.android.com/reference/android/os/LocaleList` `
https://developer.android.com/reference/android/graphics/Paint#getTextLocales()()
`

Get the text locale list.


`


void` `
https://developer.android.com/reference/android/graphics/Paint#getTextPath(char[],%20int,%20int,%20float,%20float,%20android.graphics.Path)(char[] text, int index, int count, float x, float y, https://developer.android.com/reference/android/graphics/Path path)
`

Return the path (outline) for the specified text.


`


void` `
https://developer.android.com/reference/android/graphics/Paint#getTextPath(java.lang.String,%20int,%20int,%20float,%20float,%20android.graphics.Path)(https://developer.android.com/reference/java/lang/String text, int start, int end, float x, float y, https://developer.android.com/reference/android/graphics/Path path)
`

Return the path (outline) for the specified text.


`


float` `
https://developer.android.com/reference/android/graphics/Paint#getTextRunAdvances(char[],%20int,%20int,%20int,%20int,%20boolean,%20float[],%20int)(char[] chars, int index, int count, int contextIndex, int contextCount, boolean isRtl, float[] advances, int advancesIndex)
`

Retrieve the character advances of the text.


`


int` `
https://developer.android.com/reference/android/graphics/Paint#getTextRunCursor(java.lang.CharSequence,%20int,%20int,%20boolean,%20int,%20int)(https://developer.android.com/reference/java/lang/CharSequence text, int contextStart, int contextEnd, boolean isRtl, int offset, int cursorOpt)
`

Returns the next cursor position in the run.


`


int` `
https://developer.android.com/reference/android/graphics/Paint#getTextRunCursor(char[],%20int,%20int,%20boolean,%20int,%20int)(char[] text, int contextStart, int contextLength, boolean isRtl, int offset, int cursorOpt)
`

Returns the next cursor position in the run.


`


float` `
https://developer.android.com/reference/android/graphics/Paint#getTextScaleX()()
`

Return the paint's horizontal scale factor for text.


`


float` `
https://developer.android.com/reference/android/graphics/Paint#getTextSize()()
`

Return the paint's text size.


`


float` `
https://developer.android.com/reference/android/graphics/Paint#getTextSkewX()()
`

Return the paint's horizontal skew factor for text.


`


int` `
https://developer.android.com/reference/android/graphics/Paint#getTextWidths(char[],%20int,%20int,%20float[])(char[] text, int index, int count, float[] widths)
`

Return the advance widths for the characters in the string.


`


int` `
https://developer.android.com/reference/android/graphics/Paint#getTextWidths(java.lang.String,%20float[])(https://developer.android.com/reference/java/lang/String text, float[] widths)
`

Return the advance widths for the characters in the string.


`


int` `
https://developer.android.com/reference/android/graphics/Paint#getTextWidths(java.lang.String,%20int,%20int,%20float[])(https://developer.android.com/reference/java/lang/String text, int start, int end, float[] widths)
`

Return the advance widths for the characters in the string.


`


int` `
https://developer.android.com/reference/android/graphics/Paint#getTextWidths(java.lang.CharSequence,%20int,%20int,%20float[])(https://developer.android.com/reference/java/lang/CharSequence text, int start, int end, float[] widths)
`

Return the advance widths for the characters in the string.


`


https://developer.android.com/reference/android/graphics/Typeface` `
https://developer.android.com/reference/android/graphics/Paint#getTypeface()()
`

Get the paint's typeface object.


`


float` `
https://developer.android.com/reference/android/graphics/Paint#getUnderlinePosition()()
`

Returns the distance from top of the underline to the baseline in pixels.


`


float` `
https://developer.android.com/reference/android/graphics/Paint#getUnderlineThickness()()
`

Returns the thickness of the underline in pixels.


`


float` `
https://developer.android.com/reference/android/graphics/Paint#getWordSpacing()()
`

Return the paint's extra word-spacing for text.


`


https://developer.android.com/reference/android/graphics/Xfermode` `
https://developer.android.com/reference/android/graphics/Paint#getXfermode()()
`

Get the paint's transfer mode object.


`


boolean` `
https://developer.android.com/reference/android/graphics/Paint#hasGlyph(java.lang.String)(https://developer.android.com/reference/java/lang/String string)
`

Determine whether the typeface set on the paint has a glyph supporting the string.


`


final

boolean` `
https://developer.android.com/reference/android/graphics/Paint#isAntiAlias()()
`

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.


`


final

boolean` `
https://developer.android.com/reference/android/graphics/Paint#isDither()()
`

Helper for getFlags(), returning true if DITHER_FLAG bit is set
Dithering affects how colors that are higher precision than the device
are down-sampled.


`


boolean` `
https://developer.android.com/reference/android/graphics/Paint#isElegantTextHeight()()
`

*This method was deprecated
in API level 36.
The underlying UI fonts are deprecated and will be removed from the system image.
Applications supporting scripts with large vertical metrics should adapt their UI by using
fonts designed with corresponding vertical metrics.*


`


final

boolean` `
https://developer.android.com/reference/android/graphics/Paint#isFakeBoldText()()
`

Helper for getFlags(), returning true if FAKE_BOLD_TEXT_FLAG bit is set


`


final

boolean` `
https://developer.android.com/reference/android/graphics/Paint#isFilterBitmap()()
`

Whether or not the bitmap filter is activated.


`


final

boolean` `
https://developer.android.com/reference/android/graphics/Paint#isLinearText()()
`

Helper for getFlags(), returning true if LINEAR_TEXT_FLAG bit is set


`


final

boolean` `
https://developer.android.com/reference/android/graphics/Paint#isStrikeThruText()()
`

Helper for getFlags(), returning true if STRIKE_THRU_TEXT_FLAG bit is set


`


final

boolean` `
https://developer.android.com/reference/android/graphics/Paint#isSubpixelText()()
`

Helper for getFlags(), returning true if SUBPIXEL_TEXT_FLAG bit is set


`


final

boolean` `
https://developer.android.com/reference/android/graphics/Paint#isUnderlineText()()
`

Helper for getFlags(), returning true if UNDERLINE_TEXT_FLAG bit is set


`


float` `
https://developer.android.com/reference/android/graphics/Paint#measureText(char[],%20int,%20int)(char[] text, int index, int count)
`

Return the width of the text.


`


float` `
https://developer.android.com/reference/android/graphics/Paint#measureText(java.lang.CharSequence,%20int,%20int)(https://developer.android.com/reference/java/lang/CharSequence text, int start, int end)
`

Return the width of the text.


`


float` `
https://developer.android.com/reference/android/graphics/Paint#measureText(java.lang.String,%20int,%20int)(https://developer.android.com/reference/java/lang/String text, int start, int end)
`

Return the width of the text.


`


float` `
https://developer.android.com/reference/android/graphics/Paint#measureText(java.lang.String)(https://developer.android.com/reference/java/lang/String text)
`

Return the width of the text.


`


void` `
https://developer.android.com/reference/android/graphics/Paint#reset()()
`

Restores the paint to its default settings.


`


void` `
https://developer.android.com/reference/android/graphics/Paint#set(android.graphics.Paint)(https://developer.android.com/reference/android/graphics/Paint src)
`

Copy the fields from src into this paint.


`


void` `
https://developer.android.com/reference/android/graphics/Paint#setARGB(int,%20int,%20int,%20int)(int a, int r, int g, int b)
`

Helper to setColor(), that takes a,r,g,b and constructs the color int


`


void` `
https://developer.android.com/reference/android/graphics/Paint#setAlpha(int)(int a)
`

Helper to setColor(), that only assigns the color's alpha value,
leaving its r,g,b values unchanged.


`


void` `
https://developer.android.com/reference/android/graphics/Paint#setAntiAlias(boolean)(boolean aa)
`

Helper for setFlags(), setting or clearing the ANTI_ALIAS_FLAG bit
AntiAliasing smooths out the edges of what is being drawn, but is has
no impact on the interior of the shape.


`


void` `
https://developer.android.com/reference/android/graphics/Paint#setBlendMode(android.graphics.BlendMode)(https://developer.android.com/reference/android/graphics/BlendMode blendmode)
`

Set or clear the blend mode.


`


void` `
https://developer.android.com/reference/android/graphics/Paint#setColor(long)(long color)
`

Set the paint's color with a `ColorLong`.


`


void` `
https://developer.android.com/reference/android/graphics/Paint#setColor(int)(int color)
`

Set the paint's color.


`


https://developer.android.com/reference/android/graphics/ColorFilter` `
https://developer.android.com/reference/android/graphics/Paint#setColorFilter(android.graphics.ColorFilter)(https://developer.android.com/reference/android/graphics/ColorFilter filter)
`

Set or clear the paint's colorfilter, returning the parameter.


`


void` `
https://developer.android.com/reference/android/graphics/Paint#setDither(boolean)(boolean dither)
`

Helper for setFlags(), setting or clearing the DITHER_FLAG bit
Dithering affects how colors that are higher precision than the device
are down-sampled.


`


void` `
https://developer.android.com/reference/android/graphics/Paint#setElegantTextHeight(boolean)(boolean elegant)
`

*This method was deprecated
in API level 36.
This API will be no-op at some point in the future. The underlying UI fonts is
deprecated and will be removed from the system image. Applications supporting scripts with
large vertical metrics should adapt their UI by using fonts designed with corresponding
vertical metrics.*


`


void` `
https://developer.android.com/reference/android/graphics/Paint#setEndHyphenEdit(int)(int endHyphen)
`

Set a end hyphen edit on the paint.


`


void` `
https://developer.android.com/reference/android/graphics/Paint#setFakeBoldText(boolean)(boolean fakeBoldText)
`

Helper for setFlags(), setting or clearing the FAKE_BOLD_TEXT_FLAG bit


`


void` `
https://developer.android.com/reference/android/graphics/Paint#setFilterBitmap(boolean)(boolean filter)
`

Helper for setFlags(), setting or clearing the FILTER_BITMAP_FLAG bit.


`


void` `
https://developer.android.com/reference/android/graphics/Paint#setFlags(int)(int flags)
`

Set the paint's flags.


`


void` `
https://developer.android.com/reference/android/graphics/Paint#setFontFeatureSettings(java.lang.String)(https://developer.android.com/reference/java/lang/String settings)
`

Set font feature settings.


`


void` `
https://developer.android.com/reference/android/graphics/Paint#setFontVariationOverride(java.lang.String)(https://developer.android.com/reference/java/lang/String fontVariationOverride)
`

Sets TrueType or OpenType font variation settings for overriding.


`


boolean` `
https://developer.android.com/reference/android/graphics/Paint#setFontVariationSettings(java.lang.String)(https://developer.android.com/reference/java/lang/String fontVariationSettings)
`

Sets TrueType or OpenType font variation settings.


`


void` `
https://developer.android.com/reference/android/graphics/Paint#setHinting(int)(int mode)
`

Set the paint's hinting mode.


`


void` `
https://developer.android.com/reference/android/graphics/Paint#setLetterSpacing(float)(float letterSpacing)
`

Set the paint's letter-spacing for text.


`


void` `
https://developer.android.com/reference/android/graphics/Paint#setLinearText(boolean)(boolean linearText)
`

Helper for setFlags(), setting or clearing the LINEAR_TEXT_FLAG bit


`


https://developer.android.com/reference/android/graphics/MaskFilter` `
https://developer.android.com/reference/android/graphics/Paint#setMaskFilter(android.graphics.MaskFilter)(https://developer.android.com/reference/android/graphics/MaskFilter maskfilter)
`

Set or clear the maskfilter object.


`


https://developer.android.com/reference/android/graphics/PathEffect` `
https://developer.android.com/reference/android/graphics/Paint#setPathEffect(android.graphics.PathEffect)(https://developer.android.com/reference/android/graphics/PathEffect effect)
`

Set or clear the patheffect object.


`


https://developer.android.com/reference/android/graphics/Shader` `
https://developer.android.com/reference/android/graphics/Paint#setShader(android.graphics.Shader)(https://developer.android.com/reference/android/graphics/Shader shader)
`

Set or clear the shader object.


`


void` `
https://developer.android.com/reference/android/graphics/Paint#setShadowLayer(float,%20float,%20float,%20int)(float radius, float dx, float dy, int shadowColor)
`

This draws a shadow layer below the main layer, with the specified
offset and color, and blur radius.


`


void` `
https://developer.android.com/reference/android/graphics/Paint#setShadowLayer(float,%20float,%20float,%20long)(float radius, float dx, float dy, long shadowColor)
`

This draws a shadow layer below the main layer, with the specified
offset and color, and blur radius.


`


void` `
https://developer.android.com/reference/android/graphics/Paint#setStartHyphenEdit(int)(int startHyphen)
`

Set a start hyphen edit on the paint.


`


void` `
https://developer.android.com/reference/android/graphics/Paint#setStrikeThruText(boolean)(boolean strikeThruText)
`

Helper for setFlags(), setting or clearing the STRIKE_THRU_TEXT_FLAG bit


`


void` `
https://developer.android.com/reference/android/graphics/Paint#setStrokeCap(android.graphics.Paint.Cap)(https://developer.android.com/reference/android/graphics/Paint.Cap cap)
`

Set the paint's Cap.


`


void` `
https://developer.android.com/reference/android/graphics/Paint#setStrokeJoin(android.graphics.Paint.Join)(https://developer.android.com/reference/android/graphics/Paint.Join join)
`

Set the paint's Join.


`


void` `
https://developer.android.com/reference/android/graphics/Paint#setStrokeMiter(float)(float miter)
`

Set the paint's stroke miter value.


`


void` `
https://developer.android.com/reference/android/graphics/Paint#setStrokeWidth(float)(float width)
`

Set the width for stroking.


`


void` `
https://developer.android.com/reference/android/graphics/Paint#setStyle(android.graphics.Paint.Style)(https://developer.android.com/reference/android/graphics/Paint.Style style)
`

Set the paint's style, used for controlling how primitives'
geometries are interpreted (except for drawBitmap, which always assumes
Fill).


`


void` `
https://developer.android.com/reference/android/graphics/Paint#setSubpixelText(boolean)(boolean subpixelText)
`

Helper for setFlags(), setting or clearing the SUBPIXEL_TEXT_FLAG bit


`


void` `
https://developer.android.com/reference/android/graphics/Paint#setTextAlign(android.graphics.Paint.Align)(https://developer.android.com/reference/android/graphics/Paint.Align align)
`

Set the paint's text alignment.


`


void` `
https://developer.android.com/reference/android/graphics/Paint#setTextLocale(java.util.Locale)(https://developer.android.com/reference/java/util/Locale locale)
`

Set the text locale list to a one-member list consisting of just the locale.


`


void` `
https://developer.android.com/reference/android/graphics/Paint#setTextLocales(android.os.LocaleList)(https://developer.android.com/reference/android/os/LocaleList locales)
`

Set the text locale list.


`


void` `
https://developer.android.com/reference/android/graphics/Paint#setTextScaleX(float)(float scaleX)
`

Set the paint's horizontal scale factor for text.


`


void` `
https://developer.android.com/reference/android/graphics/Paint#setTextSize(float)(float textSize)
`

Set the paint's text size.


`


void` `
https://developer.android.com/reference/android/graphics/Paint#setTextSkewX(float)(float skewX)
`

Set the paint's horizontal skew factor for text.


`


https://developer.android.com/reference/android/graphics/Typeface` `
https://developer.android.com/reference/android/graphics/Paint#setTypeface(android.graphics.Typeface)(https://developer.android.com/reference/android/graphics/Typeface typeface)
`

Set or clear the typeface object.


`


void` `
https://developer.android.com/reference/android/graphics/Paint#setUnderlineText(boolean)(boolean underlineText)
`

Helper for setFlags(), setting or clearing the UNDERLINE_TEXT_FLAG bit


`


void` `
https://developer.android.com/reference/android/graphics/Paint#setWordSpacing(float)(float wordSpacing)
`

Set the paint's extra word-spacing for text.


`


https://developer.android.com/reference/android/graphics/Xfermode` `
https://developer.android.com/reference/android/graphics/Paint#setXfermode(android.graphics.Xfermode)(https://developer.android.com/reference/android/graphics/Xfermode xfermode)
`

Set or clear the transfer mode object.


From class `

https://developer.android.com/reference/java/lang/Object

` `


https://developer.android.com/reference/java/lang/Object` `
https://developer.android.com/reference/java/lang/Object#clone()()
`

Creates and returns a copy of this object.


`


boolean` `
https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj)
`

Indicates whether some other object is "equal to" this one.


`


void` `
https://developer.android.com/reference/java/lang/Object#finalize()()
`

Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.


`


final

https://developer.android.com/reference/java/lang/Class<?>` `
https://developer.android.com/reference/java/lang/Object#getClass()()
`

Returns the runtime class of this `Object`.


`


int` `
https://developer.android.com/reference/java/lang/Object#hashCode()()
`

Returns a hash code value for the object.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#notify()()
`

Wakes up a single thread that is waiting on this object's
monitor.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#notifyAll()()
`

Wakes up all threads that are waiting on this object's monitor.


`


https://developer.android.com/reference/java/lang/String` `
https://developer.android.com/reference/java/lang/Object#toString()()
`

Returns a string representation of the object.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos)
`

Causes the current thread to wait until it is awakened, typically
by being *notified* or *interrupted*, or until a
certain amount of real time has elapsed.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis)
`

Causes the current thread to wait until it is awakened, typically
by being *notified* or *interrupted*, or until a
certain amount of real time has elapsed.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#wait()()
`

Causes the current thread to wait until it is awakened, typically
by being *notified* or *interrupted*.


## Fields

### baselineShift

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int baselineShift
```

<br />

<br />

### bgColor

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int bgColor
```

<br />

<br />

### density

Added in [API level 5](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public float density
```

<br />

<br />

### drawableState

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int[] drawableState
```

<br />

<br />

### linkColor

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int linkColor
```

<br />

<br />

### underlineColor

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int underlineColor
```

Special value 0 means no custom underline

<br />

### underlineThickness

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public float underlineThickness
```

Thickness of the underline, in pixels.


The units of this value are pixels.

<br />

## Public constructors

### TextPaint

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public TextPaint ()
```

<br />

<br />

### TextPaint

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public TextPaint (Paint p)
```

<br />

<br />

| Parameters ||
|---|---|
| `p` | `Paint` <br /> |

### TextPaint

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public TextPaint (int flags)
```

<br />

<br />

| Parameters ||
|---|---|
| `flags` | `int` <br /> |

## Public methods

### getUnderlineThickness

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public float getUnderlineThickness ()
```

Returns the thickness of the underline in pixels.


The units of this value are pixels.

<br />

| Returns ||
|---|---|
| `float` | the thickness of the underline in pixels. The units of this value are pixels. <br /> |

### set

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void set (TextPaint tp)
```

Copy the fields from tp into this TextPaint, including the
fields inherited from Paint.

<br />

| Parameters ||
|---|---|
| `tp` | `TextPaint` <br /> |