# Paint

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Nested Classes](https://developer.android.com/reference/android/graphics/Paint#nestedclasses)\|[Constants](https://developer.android.com/reference/android/graphics/Paint#constants)\|[Ctors](https://developer.android.com/reference/android/graphics/Paint#pubctors)\|[Methods](https://developer.android.com/reference/android/graphics/Paint#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/graphics/Paint#inhmethods)  

# Paint

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/android/graphics/Paint "View this page in Kotlin")\|Java

`
public


class
Paint
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object)`


``


`

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

|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Known direct subclasses [TextPaint](https://developer.android.com/reference/android/text/TextPaint) |-----------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------| | [TextPaint](https://developer.android.com/reference/android/text/TextPaint) | TextPaint is an extension of Paint that leaves room for some extra data used during text measuring and drawing. | |

<br />

*** ** * ** ***

The Paint class holds the style and color information about how to draw geometries, text and bitmaps.

## Summary

|                                                                                        ### Nested classes                                                                                        ||
|----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` class` | [Paint.FontMetrics](https://developer.android.com/reference/android/graphics/Paint.FontMetrics) Class that describes the various metrics for a font at a given text size.              |
| ` class` | [Paint.FontMetricsInt](https://developer.android.com/reference/android/graphics/Paint.FontMetricsInt) Convenience method for callers that want to have FontMetrics values as integers. |

|                                                                                                                                      ### Constants                                                                                                                                      ||
|-------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `int` | [ANTI_ALIAS_FLAG](https://developer.android.com/reference/android/graphics/Paint#ANTI_ALIAS_FLAG) Paint flag that enables antialiasing when drawing.                                                                                                                             |
| `int` | [CURSOR_AFTER](https://developer.android.com/reference/android/graphics/Paint#CURSOR_AFTER) Option for getTextRunCursor.                                                                                                                                                         |
| `int` | [CURSOR_AT](https://developer.android.com/reference/android/graphics/Paint#CURSOR_AT) Option for getTextRunCursor.                                                                                                                                                               |
| `int` | [CURSOR_AT_OR_AFTER](https://developer.android.com/reference/android/graphics/Paint#CURSOR_AT_OR_AFTER) Option for getTextRunCursor.                                                                                                                                             |
| `int` | [CURSOR_AT_OR_BEFORE](https://developer.android.com/reference/android/graphics/Paint#CURSOR_AT_OR_BEFORE) Option for getTextRunCursor.                                                                                                                                           |
| `int` | [CURSOR_BEFORE](https://developer.android.com/reference/android/graphics/Paint#CURSOR_BEFORE) Option for getTextRunCursor.                                                                                                                                                       |
| `int` | [DEV_KERN_TEXT_FLAG](https://developer.android.com/reference/android/graphics/Paint#DEV_KERN_TEXT_FLAG) Legacy Paint flag, no longer used.                                                                                                                                       |
| `int` | [DITHER_FLAG](https://developer.android.com/reference/android/graphics/Paint#DITHER_FLAG) Paint flag that enables dithering when blitting.                                                                                                                                       |
| `int` | [EMBEDDED_BITMAP_TEXT_FLAG](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` | [END_HYPHEN_EDIT_INSERT_ARMENIAN_HYPHEN](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` | [END_HYPHEN_EDIT_INSERT_HYPHEN](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` | [END_HYPHEN_EDIT_INSERT_MAQAF](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` | [END_HYPHEN_EDIT_INSERT_UCAS_HYPHEN](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` | [END_HYPHEN_EDIT_INSERT_ZWJ_AND_HYPHEN](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` | [END_HYPHEN_EDIT_NO_EDIT](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` | [END_HYPHEN_EDIT_REPLACE_WITH_HYPHEN](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` | [FAKE_BOLD_TEXT_FLAG](https://developer.android.com/reference/android/graphics/Paint#FAKE_BOLD_TEXT_FLAG) Paint flag that applies a synthetic bolding effect to drawn text.                                                                                                      |
| `int` | [FILTER_BITMAP_FLAG](https://developer.android.com/reference/android/graphics/Paint#FILTER_BITMAP_FLAG) Paint flag that enables bilinear sampling on scaled bitmaps.                                                                                                             |
| `int` | [HINTING_OFF](https://developer.android.com/reference/android/graphics/Paint#HINTING_OFF) Font hinter option that disables font hinting.                                                                                                                                         |
| `int` | [HINTING_ON](https://developer.android.com/reference/android/graphics/Paint#HINTING_ON) Font hinter option that enables font hinting.                                                                                                                                            |
| `int` | [LINEAR_TEXT_FLAG](https://developer.android.com/reference/android/graphics/Paint#LINEAR_TEXT_FLAG) Paint flag that enables smooth linear scaling of text.                                                                                                                       |
| `int` | [START_HYPHEN_EDIT_INSERT_HYPHEN](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` | [START_HYPHEN_EDIT_INSERT_ZWJ](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` | [START_HYPHEN_EDIT_NO_EDIT](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` | [STRIKE_THRU_TEXT_FLAG](https://developer.android.com/reference/android/graphics/Paint#STRIKE_THRU_TEXT_FLAG) Paint flag that applies a strike-through decoration to drawn text.                                                                                                 |
| `int` | [SUBPIXEL_TEXT_FLAG](https://developer.android.com/reference/android/graphics/Paint#SUBPIXEL_TEXT_FLAG) Paint flag that enables subpixel positioning of text.                                                                                                                    |
| `int` | [TEXT_RUN_FLAG_LEFT_EDGE](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` | [TEXT_RUN_FLAG_RIGHT_EDGE](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` | [UNDERLINE_TEXT_FLAG](https://developer.android.com/reference/android/graphics/Paint#UNDERLINE_TEXT_FLAG) Paint flag that applies an underline decoration to drawn text.                                                                                                         |
| `int` | [VERTICAL_TEXT_FLAG](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. |

|                                                                                                                                ### Public constructors                                                                                                                                ||
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[Paint](https://developer.android.com/reference/android/graphics/Paint#Paint())`() ` Create a new paint with default settings.                                                                                                                                                  |
| ` `[Paint](https://developer.android.com/reference/android/graphics/Paint#Paint(android.graphics.Paint))`(`[Paint](https://developer.android.com/reference/android/graphics/Paint)` paint) ` Create a new paint, initialized with the attributes in the specified paint parameter. |
| ` `[Paint](https://developer.android.com/reference/android/graphics/Paint#Paint(int))`(int flags) ` Create a new paint with the specified flags.                                                                                                                                   |

|                                                                                                                                                                                                                                                                                                                          ### Public methods                                                                                                                                                                                                                                                                                                                          ||
|----------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` float`                                                                                                 | ` `[ascent](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`                                                                                                   | ` `[breakText](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`                                                                                                   | ` `[breakText](https://developer.android.com/reference/android/graphics/Paint#breakText(java.lang.String,%20boolean,%20float,%20float[]))`(`[String](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`                                                                                                   | ` `[breakText](https://developer.android.com/reference/android/graphics/Paint#breakText(java.lang.CharSequence,%20int,%20int,%20boolean,%20float,%20float[]))`(`[CharSequence](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`                                                                                                  | ` `[clearShadowLayer](https://developer.android.com/reference/android/graphics/Paint#clearShadowLayer())`() ` Clear the shadow layer.                                                                                                                                                                                                                                                                                                                                                                                                                      |
| ` float`                                                                                                 | ` `[descent](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`                                                                                               | ` `[equalsForTextMeasurement](https://developer.android.com/reference/android/graphics/Paint#equalsForTextMeasurement(android.graphics.Paint))`(`[Paint](https://developer.android.com/reference/android/graphics/Paint)` other) ` Returns true of the passed[Paint](https://developer.android.com/reference/android/graphics/Paint)will have the same effect on text measurement                                                                                                                                                                          |
| ` int`                                                                                                   | ` `[getAlpha](https://developer.android.com/reference/android/graphics/Paint#getAlpha())`() ` Helper to getColor() that just returns the color's alpha value.                                                                                                                                                                                                                                                                                                                                                                                              |
| ` `[BlendMode](https://developer.android.com/reference/android/graphics/BlendMode)                       | ` `[getBlendMode](https://developer.android.com/reference/android/graphics/Paint#getBlendMode())`() ` Get the paint's blend mode object.                                                                                                                                                                                                                                                                                                                                                                                                                   |
| ` int`                                                                                                   | ` `[getColor](https://developer.android.com/reference/android/graphics/Paint#getColor())`() ` Return the paint's color in sRGB.                                                                                                                                                                                                                                                                                                                                                                                                                            |
| ` `[ColorFilter](https://developer.android.com/reference/android/graphics/ColorFilter)                   | ` `[getColorFilter](https://developer.android.com/reference/android/graphics/Paint#getColorFilter())`() ` Get the paint's colorfilter (maybe be null).                                                                                                                                                                                                                                                                                                                                                                                                     |
| ` long`                                                                                                  | ` `[getColorLong](https://developer.android.com/reference/android/graphics/Paint#getColorLong())`() ` Return the paint's color.                                                                                                                                                                                                                                                                                                                                                                                                                            |
| ` int`                                                                                                   | ` `[getEndHyphenEdit](https://developer.android.com/reference/android/graphics/Paint#getEndHyphenEdit())`() ` Get the current value of end hyphen edit.                                                                                                                                                                                                                                                                                                                                                                                                    |
| ` boolean`                                                                                               | ` `[getFillPath](https://developer.android.com/reference/android/graphics/Paint#getFillPath(android.graphics.Path,%20android.graphics.Path))`(`[Path](https://developer.android.com/reference/android/graphics/Path)` src, `[Path](https://developer.android.com/reference/android/graphics/Path)` dst) ` Applies any/all effects (patheffect, stroking) to src, returning the result in dst.                                                                                                                                                              |
| ` int`                                                                                                   | ` `[getFlags](https://developer.android.com/reference/android/graphics/Paint#getFlags())`() ` Return the paint's flags.                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| ` `[String](https://developer.android.com/reference/java/lang/String)                                    | ` `[getFontFeatureSettings](https://developer.android.com/reference/android/graphics/Paint#getFontFeatureSettings())`() ` Returns the font feature settings.                                                                                                                                                                                                                                                                                                                                                                                               |
| ` float`                                                                                                 | ` `[getFontMetrics](https://developer.android.com/reference/android/graphics/Paint#getFontMetrics(android.graphics.Paint.FontMetrics))`(`[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.                                                                                                                                                                                              |
| ` `[Paint.FontMetrics](https://developer.android.com/reference/android/graphics/Paint.FontMetrics)       | ` `[getFontMetrics](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`                                                                                                  | ` `[getFontMetricsForLocale](https://developer.android.com/reference/android/graphics/Paint#getFontMetricsForLocale(android.graphics.Paint.FontMetrics))`(`[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[setTextLocales(android.os.LocaleList)](https://developer.android.com/reference/android/graphics/Paint#setTextLocales(android.os.LocaleList)).                      |
| ` void`                                                                                                  | ` `[getFontMetricsInt](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, `[Paint.FontMetricsInt](https://developer.android.com/reference/android/graphics/Paint.FontMetricsInt)` outMetrics) ` Returns the font metrics value for the given text.                                                                                           |
| ` int`                                                                                                   | ` `[getFontMetricsInt](https://developer.android.com/reference/android/graphics/Paint#getFontMetricsInt(android.graphics.Paint.FontMetricsInt))`(`[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.                                                                                                                                                                                               |
| ` `[Paint.FontMetricsInt](https://developer.android.com/reference/android/graphics/Paint.FontMetricsInt) | ` `[getFontMetricsInt](https://developer.android.com/reference/android/graphics/Paint#getFontMetricsInt())`() `                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| ` void`                                                                                                  | ` `[getFontMetricsInt](https://developer.android.com/reference/android/graphics/Paint#getFontMetricsInt(java.lang.CharSequence,%20int,%20int,%20int,%20int,%20boolean,%20android.graphics.Paint.FontMetricsInt))`(`[CharSequence](https://developer.android.com/reference/java/lang/CharSequence)` text, int start, int count, int contextStart, int contextCount, boolean isRtl, `[Paint.FontMetricsInt](https://developer.android.com/reference/android/graphics/Paint.FontMetricsInt)` outMetrics) ` Returns the font metrics value for the given text. |
| ` void`                                                                                                  | ` `[getFontMetricsIntForLocale](https://developer.android.com/reference/android/graphics/Paint#getFontMetricsIntForLocale(android.graphics.Paint.FontMetricsInt))`(`[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[setTextLocales(android.os.LocaleList)](https://developer.android.com/reference/android/graphics/Paint#setTextLocales(android.os.LocaleList)).       |
| ` float`                                                                                                 | ` `[getFontSpacing](https://developer.android.com/reference/android/graphics/Paint#getFontSpacing())`() ` Return the recommend line spacing based on the current typeface and text size.                                                                                                                                                                                                                                                                                                                                                                   |
| ` `[String](https://developer.android.com/reference/java/lang/String)                                    | ` `[getFontVariationOverride](https://developer.android.com/reference/android/graphics/Paint#getFontVariationOverride())`() ` Gets the current font variation override value.                                                                                                                                                                                                                                                                                                                                                                              |
| ` `[String](https://developer.android.com/reference/java/lang/String)                                    | ` `[getFontVariationSettings](https://developer.android.com/reference/android/graphics/Paint#getFontVariationSettings())`() ` Returns the font variation settings.                                                                                                                                                                                                                                                                                                                                                                                         |
| ` int`                                                                                                   | ` `[getHinting](https://developer.android.com/reference/android/graphics/Paint#getHinting())`() ` Return the paint's hinting mode.                                                                                                                                                                                                                                                                                                                                                                                                                         |
| ` float`                                                                                                 | ` `[getLetterSpacing](https://developer.android.com/reference/android/graphics/Paint#getLetterSpacing())`() ` Return the paint's letter-spacing for text.                                                                                                                                                                                                                                                                                                                                                                                                  |
| ` `[MaskFilter](https://developer.android.com/reference/android/graphics/MaskFilter)                     | ` `[getMaskFilter](https://developer.android.com/reference/android/graphics/Paint#getMaskFilter())`() ` Get the paint's maskfilter object.                                                                                                                                                                                                                                                                                                                                                                                                                 |
| ` int`                                                                                                   | ` `[getOffsetForAdvance](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`                                                                                                   | ` `[getOffsetForAdvance](https://developer.android.com/reference/android/graphics/Paint#getOffsetForAdvance(java.lang.CharSequence,%20int,%20int,%20int,%20int,%20boolean,%20float))`(`[CharSequence](https://developer.android.com/reference/java/lang/CharSequence)` text, int start, int end, int contextStart, int contextEnd, boolean isRtl, float advance) `                                                                                                                                                                                         |
| ` `[PathEffect](https://developer.android.com/reference/android/graphics/PathEffect)                     | ` `[getPathEffect](https://developer.android.com/reference/android/graphics/Paint#getPathEffect())`() ` Get the paint's patheffect object.                                                                                                                                                                                                                                                                                                                                                                                                                 |
| ` float`                                                                                                 | ` `[getRunAdvance](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`                                                                                                 | ` `[getRunAdvance](https://developer.android.com/reference/android/graphics/Paint#getRunAdvance(java.lang.CharSequence,%20int,%20int,%20int,%20int,%20boolean,%20int))`(`[CharSequence](https://developer.android.com/reference/java/lang/CharSequence)` text, int start, int end, int contextStart, int contextEnd, boolean isRtl, int offset) `                                                                                                                                                                                                          |
| ` float`                                                                                                 | ` `[getRunCharacterAdvance](https://developer.android.com/reference/android/graphics/Paint#getRunCharacterAdvance(java.lang.CharSequence,%20int,%20int,%20int,%20int,%20boolean,%20int,%20float[],%20int))`(`[CharSequence](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`                                                                                                 | ` `[getRunCharacterAdvance](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.                                                                                                            |
| ` `[Shader](https://developer.android.com/reference/android/graphics/Shader)                             | ` `[getShader](https://developer.android.com/reference/android/graphics/Paint#getShader())`() ` Get the paint's shader object.                                                                                                                                                                                                                                                                                                                                                                                                                             |
| ` int`                                                                                                   | ` `[getShadowLayerColor](https://developer.android.com/reference/android/graphics/Paint#getShadowLayerColor())`() ` Returns the color of the shadow layer.                                                                                                                                                                                                                                                                                                                                                                                                 |
| ` long`                                                                                                  | ` `[getShadowLayerColorLong](https://developer.android.com/reference/android/graphics/Paint#getShadowLayerColorLong())`() ` Returns the color of the shadow layer.                                                                                                                                                                                                                                                                                                                                                                                         |
| ` float`                                                                                                 | ` `[getShadowLayerDx](https://developer.android.com/reference/android/graphics/Paint#getShadowLayerDx())`() ` Returns the x offset of the shadow layer.                                                                                                                                                                                                                                                                                                                                                                                                    |
| ` float`                                                                                                 | ` `[getShadowLayerDy](https://developer.android.com/reference/android/graphics/Paint#getShadowLayerDy())`() ` Returns the y offset of the shadow layer.                                                                                                                                                                                                                                                                                                                                                                                                    |
| ` float`                                                                                                 | ` `[getShadowLayerRadius](https://developer.android.com/reference/android/graphics/Paint#getShadowLayerRadius())`() ` Returns the blur radius of the shadow layer.                                                                                                                                                                                                                                                                                                                                                                                         |
| ` int`                                                                                                   | ` `[getStartHyphenEdit](https://developer.android.com/reference/android/graphics/Paint#getStartHyphenEdit())`() ` Get the current value of start hyphen edit.                                                                                                                                                                                                                                                                                                                                                                                              |
| ` float`                                                                                                 | ` `[getStrikeThruPosition](https://developer.android.com/reference/android/graphics/Paint#getStrikeThruPosition())`() ` Distance from top of the strike-through line to the baseline in pixels.                                                                                                                                                                                                                                                                                                                                                            |
| ` float`                                                                                                 | ` `[getStrikeThruThickness](https://developer.android.com/reference/android/graphics/Paint#getStrikeThruThickness())`() ` Returns the thickness of the strike-through line in pixels.                                                                                                                                                                                                                                                                                                                                                                      |
| ` `[Paint.Cap](https://developer.android.com/reference/android/graphics/Paint.Cap)                       | ` `[getStrokeCap](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.                                                                                                                                                                                                                                                                                                                                                    |
| ` `[Paint.Join](https://developer.android.com/reference/android/graphics/Paint.Join)                     | ` `[getStrokeJoin](https://developer.android.com/reference/android/graphics/Paint#getStrokeJoin())`() ` Return the paint's stroke join type.                                                                                                                                                                                                                                                                                                                                                                                                               |
| ` float`                                                                                                 | ` `[getStrokeMiter](https://developer.android.com/reference/android/graphics/Paint#getStrokeMiter())`() ` Return the paint's stroke miter value.                                                                                                                                                                                                                                                                                                                                                                                                           |
| ` float`                                                                                                 | ` `[getStrokeWidth](https://developer.android.com/reference/android/graphics/Paint#getStrokeWidth())`() ` Return the width for stroking.                                                                                                                                                                                                                                                                                                                                                                                                                   |
| ` `[Paint.Style](https://developer.android.com/reference/android/graphics/Paint.Style)                   | ` `[getStyle](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).                                                                                                                                                                                                                                                                                                          |
| ` `[Paint.Align](https://developer.android.com/reference/android/graphics/Paint.Align)                   | ` `[getTextAlign](https://developer.android.com/reference/android/graphics/Paint#getTextAlign())`() ` Return the paint's Align value for drawing text.                                                                                                                                                                                                                                                                                                                                                                                                     |
| ` void`                                                                                                  | ` `[getTextBounds](https://developer.android.com/reference/android/graphics/Paint#getTextBounds(java.lang.String,%20int,%20int,%20android.graphics.Rect))`(`[String](https://developer.android.com/reference/java/lang/String)` text, int start, int end, `[Rect](https://developer.android.com/reference/android/graphics/Rect)` bounds) ` Retrieve the text boundary box and store to bounds.                                                                                                                                                            |
| ` void`                                                                                                  | ` `[getTextBounds](https://developer.android.com/reference/android/graphics/Paint#getTextBounds(java.lang.CharSequence,%20int,%20int,%20android.graphics.Rect))`(`[CharSequence](https://developer.android.com/reference/java/lang/CharSequence)` text, int start, int end, `[Rect](https://developer.android.com/reference/android/graphics/Rect)` bounds) ` Retrieve the text boundary box and store to bounds.                                                                                                                                          |
| ` void`                                                                                                  | ` `[getTextBounds](https://developer.android.com/reference/android/graphics/Paint#getTextBounds(char[],%20int,%20int,%20android.graphics.Rect))`(char[] text, int index, int count, `[Rect](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).                                                                                                                                              |
| ` `[Locale](https://developer.android.com/reference/java/util/Locale)                                    | ` `[getTextLocale](https://developer.android.com/reference/android/graphics/Paint#getTextLocale())`() ` Get the text's primary Locale.                                                                                                                                                                                                                                                                                                                                                                                                                     |
| ` `[LocaleList](https://developer.android.com/reference/android/os/LocaleList)                           | ` `[getTextLocales](https://developer.android.com/reference/android/graphics/Paint#getTextLocales())`() ` Get the text locale list.                                                                                                                                                                                                                                                                                                                                                                                                                        |
| ` void`                                                                                                  | ` `[getTextPath](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, `[Path](https://developer.android.com/reference/android/graphics/Path)` path) ` Return the path (outline) for the specified text.                                                                                                                                                                                                      |
| ` void`                                                                                                  | ` `[getTextPath](https://developer.android.com/reference/android/graphics/Paint#getTextPath(java.lang.String,%20int,%20int,%20float,%20float,%20android.graphics.Path))`(`[String](https://developer.android.com/reference/java/lang/String)` text, int start, int end, float x, float y, `[Path](https://developer.android.com/reference/android/graphics/Path)` path) ` Return the path (outline) for the specified text.                                                                                                                                |
| ` float`                                                                                                 | ` `[getTextRunAdvances](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`                                                                                                   | ` `[getTextRunCursor](https://developer.android.com/reference/android/graphics/Paint#getTextRunCursor(java.lang.CharSequence,%20int,%20int,%20boolean,%20int,%20int))`(`[CharSequence](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`                                                                                                   | ` `[getTextRunCursor](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`                                                                                                 | ` `[getTextScaleX](https://developer.android.com/reference/android/graphics/Paint#getTextScaleX())`() ` Return the paint's horizontal scale factor for text.                                                                                                                                                                                                                                                                                                                                                                                               |
| ` float`                                                                                                 | ` `[getTextSize](https://developer.android.com/reference/android/graphics/Paint#getTextSize())`() ` Return the paint's text size.                                                                                                                                                                                                                                                                                                                                                                                                                          |
| ` float`                                                                                                 | ` `[getTextSkewX](https://developer.android.com/reference/android/graphics/Paint#getTextSkewX())`() ` Return the paint's horizontal skew factor for text.                                                                                                                                                                                                                                                                                                                                                                                                  |
| ` int`                                                                                                   | ` `[getTextWidths](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`                                                                                                   | ` `[getTextWidths](https://developer.android.com/reference/android/graphics/Paint#getTextWidths(java.lang.String,%20float[]))`(`[String](https://developer.android.com/reference/java/lang/String)` text, float[] widths) ` Return the advance widths for the characters in the string.                                                                                                                                                                                                                                                                    |
| ` int`                                                                                                   | ` `[getTextWidths](https://developer.android.com/reference/android/graphics/Paint#getTextWidths(java.lang.String,%20int,%20int,%20float[]))`(`[String](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`                                                                                                   | ` `[getTextWidths](https://developer.android.com/reference/android/graphics/Paint#getTextWidths(java.lang.CharSequence,%20int,%20int,%20float[]))`(`[CharSequence](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.                                                                                                                                                                                                                |
| ` `[Typeface](https://developer.android.com/reference/android/graphics/Typeface)                         | ` `[getTypeface](https://developer.android.com/reference/android/graphics/Paint#getTypeface())`() ` Get the paint's typeface object.                                                                                                                                                                                                                                                                                                                                                                                                                       |
| ` float`                                                                                                 | ` `[getUnderlinePosition](https://developer.android.com/reference/android/graphics/Paint#getUnderlinePosition())`() ` Returns the distance from top of the underline to the baseline in pixels.                                                                                                                                                                                                                                                                                                                                                            |
| ` float`                                                                                                 | ` `[getUnderlineThickness](https://developer.android.com/reference/android/graphics/Paint#getUnderlineThickness())`() ` Returns the thickness of the underline in pixels.                                                                                                                                                                                                                                                                                                                                                                                  |
| ` float`                                                                                                 | ` `[getWordSpacing](https://developer.android.com/reference/android/graphics/Paint#getWordSpacing())`() ` Return the paint's extra word-spacing for text.                                                                                                                                                                                                                                                                                                                                                                                                  |
| ` `[Xfermode](https://developer.android.com/reference/android/graphics/Xfermode)                         | ` `[getXfermode](https://developer.android.com/reference/android/graphics/Paint#getXfermode())`() ` Get the paint's transfer mode object.                                                                                                                                                                                                                                                                                                                                                                                                                  |
| ` boolean`                                                                                               | ` `[hasGlyph](https://developer.android.com/reference/android/graphics/Paint#hasGlyph(java.lang.String))`(`[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`                                                                                         | ` `[isAntiAlias](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`                                                                                         | ` `[isDither](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`                                                                                               | ` `[isElegantTextHeight](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`                                                                                         | ` `[isFakeBoldText](https://developer.android.com/reference/android/graphics/Paint#isFakeBoldText())`() ` Helper for getFlags(), returning true if FAKE_BOLD_TEXT_FLAG bit is set                                                                                                                                                                                                                                                                                                                                                                          |
| ` final boolean`                                                                                         | ` `[isFilterBitmap](https://developer.android.com/reference/android/graphics/Paint#isFilterBitmap())`() ` Whether or not the bitmap filter is activated.                                                                                                                                                                                                                                                                                                                                                                                                   |
| ` final boolean`                                                                                         | ` `[isLinearText](https://developer.android.com/reference/android/graphics/Paint#isLinearText())`() ` Helper for getFlags(), returning true if LINEAR_TEXT_FLAG bit is set                                                                                                                                                                                                                                                                                                                                                                                 |
| ` final boolean`                                                                                         | ` `[isStrikeThruText](https://developer.android.com/reference/android/graphics/Paint#isStrikeThruText())`() ` Helper for getFlags(), returning true if STRIKE_THRU_TEXT_FLAG bit is set                                                                                                                                                                                                                                                                                                                                                                    |
| ` final boolean`                                                                                         | ` `[isSubpixelText](https://developer.android.com/reference/android/graphics/Paint#isSubpixelText())`() ` Helper for getFlags(), returning true if SUBPIXEL_TEXT_FLAG bit is set                                                                                                                                                                                                                                                                                                                                                                           |
| ` final boolean`                                                                                         | ` `[isUnderlineText](https://developer.android.com/reference/android/graphics/Paint#isUnderlineText())`() ` Helper for getFlags(), returning true if UNDERLINE_TEXT_FLAG bit is set                                                                                                                                                                                                                                                                                                                                                                        |
| ` float`                                                                                                 | ` `[measureText](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`                                                                                                 | ` `[measureText](https://developer.android.com/reference/android/graphics/Paint#measureText(java.lang.CharSequence,%20int,%20int))`(`[CharSequence](https://developer.android.com/reference/java/lang/CharSequence)` text, int start, int end) ` Return the width of the text.                                                                                                                                                                                                                                                                             |
| ` float`                                                                                                 | ` `[measureText](https://developer.android.com/reference/android/graphics/Paint#measureText(java.lang.String,%20int,%20int))`(`[String](https://developer.android.com/reference/java/lang/String)` text, int start, int end) ` Return the width of the text.                                                                                                                                                                                                                                                                                               |
| ` float`                                                                                                 | ` `[measureText](https://developer.android.com/reference/android/graphics/Paint#measureText(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String)` text) ` Return the width of the text.                                                                                                                                                                                                                                                                                                                                 |
| ` void`                                                                                                  | ` `[reset](https://developer.android.com/reference/android/graphics/Paint#reset())`() ` Restores the paint to its default settings.                                                                                                                                                                                                                                                                                                                                                                                                                        |
| ` void`                                                                                                  | ` `[set](https://developer.android.com/reference/android/graphics/Paint#set(android.graphics.Paint))`(`[Paint](https://developer.android.com/reference/android/graphics/Paint)` src) ` Copy the fields from src into this paint.                                                                                                                                                                                                                                                                                                                           |
| ` void`                                                                                                  | ` `[setARGB](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`                                                                                                  | ` `[setAlpha](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`                                                                                                  | ` `[setAntiAlias](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`                                                                                                  | ` `[setBlendMode](https://developer.android.com/reference/android/graphics/Paint#setBlendMode(android.graphics.BlendMode))`(`[BlendMode](https://developer.android.com/reference/android/graphics/BlendMode)` blendmode) ` Set or clear the blend mode.                                                                                                                                                                                                                                                                                                    |
| ` void`                                                                                                  | ` `[setColor](https://developer.android.com/reference/android/graphics/Paint#setColor(long))`(long color) ` Set the paint's color with a`ColorLong`.                                                                                                                                                                                                                                                                                                                                                                                                       |
| ` void`                                                                                                  | ` `[setColor](https://developer.android.com/reference/android/graphics/Paint#setColor(int))`(int color) ` Set the paint's color.                                                                                                                                                                                                                                                                                                                                                                                                                           |
| ` `[ColorFilter](https://developer.android.com/reference/android/graphics/ColorFilter)                   | ` `[setColorFilter](https://developer.android.com/reference/android/graphics/Paint#setColorFilter(android.graphics.ColorFilter))`(`[ColorFilter](https://developer.android.com/reference/android/graphics/ColorFilter)` filter) ` Set or clear the paint's colorfilter, returning the parameter.                                                                                                                                                                                                                                                           |
| ` void`                                                                                                  | ` `[setDither](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`                                                                                                  | ` `[setElegantTextHeight](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`                                                                                                  | ` `[setEndHyphenEdit](https://developer.android.com/reference/android/graphics/Paint#setEndHyphenEdit(int))`(int endHyphen) ` Set a end hyphen edit on the paint.                                                                                                                                                                                                                                                                                                                                                                                          |
| ` void`                                                                                                  | ` `[setFakeBoldText](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`                                                                                                  | ` `[setFilterBitmap](https://developer.android.com/reference/android/graphics/Paint#setFilterBitmap(boolean))`(boolean filter) ` Helper for setFlags(), setting or clearing the FILTER_BITMAP_FLAG bit.                                                                                                                                                                                                                                                                                                                                                    |
| ` void`                                                                                                  | ` `[setFlags](https://developer.android.com/reference/android/graphics/Paint#setFlags(int))`(int flags) ` Set the paint's flags.                                                                                                                                                                                                                                                                                                                                                                                                                           |
| ` void`                                                                                                  | ` `[setFontFeatureSettings](https://developer.android.com/reference/android/graphics/Paint#setFontFeatureSettings(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String)` settings) ` Set font feature settings.                                                                                                                                                                                                                                                                                                          |
| ` void`                                                                                                  | ` `[setFontVariationOverride](https://developer.android.com/reference/android/graphics/Paint#setFontVariationOverride(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String)` fontVariationOverride) ` Sets TrueType or OpenType font variation settings for overriding.                                                                                                                                                                                                                                                  |
| ` boolean`                                                                                               | ` `[setFontVariationSettings](https://developer.android.com/reference/android/graphics/Paint#setFontVariationSettings(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String)` fontVariationSettings) ` Sets TrueType or OpenType font variation settings.                                                                                                                                                                                                                                                                 |
| ` void`                                                                                                  | ` `[setHinting](https://developer.android.com/reference/android/graphics/Paint#setHinting(int))`(int mode) ` Set the paint's hinting mode.                                                                                                                                                                                                                                                                                                                                                                                                                 |
| ` void`                                                                                                  | ` `[setLetterSpacing](https://developer.android.com/reference/android/graphics/Paint#setLetterSpacing(float))`(float letterSpacing) ` Set the paint's letter-spacing for text.                                                                                                                                                                                                                                                                                                                                                                             |
| ` void`                                                                                                  | ` `[setLinearText](https://developer.android.com/reference/android/graphics/Paint#setLinearText(boolean))`(boolean linearText) ` Helper for setFlags(), setting or clearing the LINEAR_TEXT_FLAG bit                                                                                                                                                                                                                                                                                                                                                       |
| ` `[MaskFilter](https://developer.android.com/reference/android/graphics/MaskFilter)                     | ` `[setMaskFilter](https://developer.android.com/reference/android/graphics/Paint#setMaskFilter(android.graphics.MaskFilter))`(`[MaskFilter](https://developer.android.com/reference/android/graphics/MaskFilter)` maskfilter) ` Set or clear the maskfilter object.                                                                                                                                                                                                                                                                                       |
| ` `[PathEffect](https://developer.android.com/reference/android/graphics/PathEffect)                     | ` `[setPathEffect](https://developer.android.com/reference/android/graphics/Paint#setPathEffect(android.graphics.PathEffect))`(`[PathEffect](https://developer.android.com/reference/android/graphics/PathEffect)` effect) ` Set or clear the patheffect object.                                                                                                                                                                                                                                                                                           |
| ` `[Shader](https://developer.android.com/reference/android/graphics/Shader)                             | ` `[setShader](https://developer.android.com/reference/android/graphics/Paint#setShader(android.graphics.Shader))`(`[Shader](https://developer.android.com/reference/android/graphics/Shader)` shader) ` Set or clear the shader object.                                                                                                                                                                                                                                                                                                                   |
| ` void`                                                                                                  | ` `[setShadowLayer](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`                                                                                                  | ` `[setShadowLayer](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`                                                                                                  | ` `[setStartHyphenEdit](https://developer.android.com/reference/android/graphics/Paint#setStartHyphenEdit(int))`(int startHyphen) ` Set a start hyphen edit on the paint.                                                                                                                                                                                                                                                                                                                                                                                  |
| ` void`                                                                                                  | ` `[setStrikeThruText](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`                                                                                                  | ` `[setStrokeCap](https://developer.android.com/reference/android/graphics/Paint#setStrokeCap(android.graphics.Paint.Cap))`(`[Paint.Cap](https://developer.android.com/reference/android/graphics/Paint.Cap)` cap) ` Set the paint's Cap.                                                                                                                                                                                                                                                                                                                  |
| ` void`                                                                                                  | ` `[setStrokeJoin](https://developer.android.com/reference/android/graphics/Paint#setStrokeJoin(android.graphics.Paint.Join))`(`[Paint.Join](https://developer.android.com/reference/android/graphics/Paint.Join)` join) ` Set the paint's Join.                                                                                                                                                                                                                                                                                                           |
| ` void`                                                                                                  | ` `[setStrokeMiter](https://developer.android.com/reference/android/graphics/Paint#setStrokeMiter(float))`(float miter) ` Set the paint's stroke miter value.                                                                                                                                                                                                                                                                                                                                                                                              |
| ` void`                                                                                                  | ` `[setStrokeWidth](https://developer.android.com/reference/android/graphics/Paint#setStrokeWidth(float))`(float width) ` Set the width for stroking.                                                                                                                                                                                                                                                                                                                                                                                                      |
| ` void`                                                                                                  | ` `[setStyle](https://developer.android.com/reference/android/graphics/Paint#setStyle(android.graphics.Paint.Style))`(`[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`                                                                                                  | ` `[setSubpixelText](https://developer.android.com/reference/android/graphics/Paint#setSubpixelText(boolean))`(boolean subpixelText) ` Helper for setFlags(), setting or clearing the SUBPIXEL_TEXT_FLAG bit                                                                                                                                                                                                                                                                                                                                               |
| ` void`                                                                                                  | ` `[setTextAlign](https://developer.android.com/reference/android/graphics/Paint#setTextAlign(android.graphics.Paint.Align))`(`[Paint.Align](https://developer.android.com/reference/android/graphics/Paint.Align)` align) ` Set the paint's text alignment.                                                                                                                                                                                                                                                                                               |
| ` void`                                                                                                  | ` `[setTextLocale](https://developer.android.com/reference/android/graphics/Paint#setTextLocale(java.util.Locale))`(`[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`                                                                                                  | ` `[setTextLocales](https://developer.android.com/reference/android/graphics/Paint#setTextLocales(android.os.LocaleList))`(`[LocaleList](https://developer.android.com/reference/android/os/LocaleList)` locales) ` Set the text locale list.                                                                                                                                                                                                                                                                                                              |
| ` void`                                                                                                  | ` `[setTextScaleX](https://developer.android.com/reference/android/graphics/Paint#setTextScaleX(float))`(float scaleX) ` Set the paint's horizontal scale factor for text.                                                                                                                                                                                                                                                                                                                                                                                 |
| ` void`                                                                                                  | ` `[setTextSize](https://developer.android.com/reference/android/graphics/Paint#setTextSize(float))`(float textSize) ` Set the paint's text size.                                                                                                                                                                                                                                                                                                                                                                                                          |
| ` void`                                                                                                  | ` `[setTextSkewX](https://developer.android.com/reference/android/graphics/Paint#setTextSkewX(float))`(float skewX) ` Set the paint's horizontal skew factor for text.                                                                                                                                                                                                                                                                                                                                                                                     |
| ` `[Typeface](https://developer.android.com/reference/android/graphics/Typeface)                         | ` `[setTypeface](https://developer.android.com/reference/android/graphics/Paint#setTypeface(android.graphics.Typeface))`(`[Typeface](https://developer.android.com/reference/android/graphics/Typeface)` typeface) ` Set or clear the typeface object.                                                                                                                                                                                                                                                                                                     |
| ` void`                                                                                                  | ` `[setUnderlineText](https://developer.android.com/reference/android/graphics/Paint#setUnderlineText(boolean))`(boolean underlineText) ` Helper for setFlags(), setting or clearing the UNDERLINE_TEXT_FLAG bit                                                                                                                                                                                                                                                                                                                                           |
| ` void`                                                                                                  | ` `[setWordSpacing](https://developer.android.com/reference/android/graphics/Paint#setWordSpacing(float))`(float wordSpacing) ` Set the paint's extra word-spacing for text.                                                                                                                                                                                                                                                                                                                                                                               |
| ` `[Xfermode](https://developer.android.com/reference/android/graphics/Xfermode)                         | ` `[setXfermode](https://developer.android.com/reference/android/graphics/Paint#setXfermode(android.graphics.Xfermode))`(`[Xfermode](https://developer.android.com/reference/android/graphics/Xfermode)` xfermode) ` Set or clear the transfer mode object.                                                                                                                                                                                                                                                                                                |

| ### Inherited methods |
|-----------------------|---|
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](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 `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](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`                                                                  | ` `[wait](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`                                                                  | ` `[wait](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*.                                                                                             | ||

## Constants

### ANTI_ALIAS_FLAG

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

```
public static final int ANTI_ALIAS_FLAG
```

Paint flag that enables antialiasing when drawing.

Enabling this flag will cause all draw operations that support antialiasing to use it.

Notable draw operations that do**not**support antialiasing include:

- [Canvas.drawBitmapMesh(Bitmap, int, int, float, int, int, int, Paint)](https://developer.android.com/reference/android/graphics/Canvas#drawBitmapMesh(android.graphics.Bitmap,%20int,%20int,%20float[],%20int,%20int[],%20int,%20android.graphics.Paint))
- [Canvas.drawPatch(NinePatch, Rect, Paint)](https://developer.android.com/reference/android/graphics/Canvas#drawPatch(android.graphics.NinePatch,%20android.graphics.Rect,%20android.graphics.Paint))
- [Canvas.drawVertices(VertexMode, int, float, int, float, int, int, int, short, int, int, Paint)](https://developer.android.com/reference/android/graphics/Canvas#drawVertices(android.graphics.Canvas.VertexMode,%20int,%20float[],%20int,%20float[],%20int,%20int[],%20int,%20short[],%20int,%20int,%20android.graphics.Paint))

<br />

<br />

**See also:**

- [Paint(int)](https://developer.android.com/reference/android/graphics/Paint#Paint(int))
- [setFlags(int)](https://developer.android.com/reference/android/graphics/Paint#setFlags(int))

Constant Value: 1 (0x00000001)  

### CURSOR_AFTER

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

```
public static final int CURSOR_AFTER
```

Option for getTextRunCursor. Compute the valid cursor after offset or the limit of the context, whichever is less.

<br />

Constant Value: 0 (0x00000000)  

### CURSOR_AT

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

```
public static final int CURSOR_AT
```

Option for getTextRunCursor. Return offset if the cursor at offset is valid, or -1 if it isn't.

<br />

Constant Value: 4 (0x00000004)  

### CURSOR_AT_OR_AFTER

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

```
public static final int CURSOR_AT_OR_AFTER
```

Option for getTextRunCursor. Compute the valid cursor at or after the offset or the limit of the context, whichever is less.

<br />

Constant Value: 1 (0x00000001)  

### CURSOR_AT_OR_BEFORE

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

```
public static final int CURSOR_AT_OR_BEFORE
```

Option for getTextRunCursor. Compute the valid cursor at or before offset or the start of the context, whichever is greater.

<br />

Constant Value: 3 (0x00000003)  

### CURSOR_BEFORE

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

```
public static final int CURSOR_BEFORE
```

Option for getTextRunCursor. Compute the valid cursor before offset or the start of the context, whichever is greater.

<br />

Constant Value: 2 (0x00000002)  

### DEV_KERN_TEXT_FLAG

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

```
public static final int DEV_KERN_TEXT_FLAG
```

Legacy Paint flag, no longer used.

<br />

Constant Value: 256 (0x00000100)  

### DITHER_FLAG

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

```
public static final int DITHER_FLAG
```

Paint flag that enables dithering when blitting.

Enabling this flag applies a dither to any blit operation where the target's colour space is more constrained than the source.

<br />

**See also:**

- [Paint(int)](https://developer.android.com/reference/android/graphics/Paint#Paint(int))
- [setFlags(int)](https://developer.android.com/reference/android/graphics/Paint#setFlags(int))

Constant Value: 4 (0x00000004)  

### EMBEDDED_BITMAP_TEXT_FLAG

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

```
public static final int EMBEDDED_BITMAP_TEXT_FLAG
```

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

Disabling this flag will prevent text draw operations from using embedded bitmap strikes in fonts, causing fonts with both scalable outlines and bitmap strikes to draw only the scalable outlines, and fonts with only bitmap strikes to not draw at all.

<br />

<br />

**See also:**

- [Paint(int)](https://developer.android.com/reference/android/graphics/Paint#Paint(int))
- [setFlags(int)](https://developer.android.com/reference/android/graphics/Paint#setFlags(int))

Constant Value: 1024 (0x00000400)  

### END_HYPHEN_EDIT_INSERT_ARMENIAN_HYPHEN

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

```
public static final int END_HYPHEN_EDIT_INSERT_ARMENIAN_HYPHEN
```

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

<br />

Constant Value: 3 (0x00000003)  

### END_HYPHEN_EDIT_INSERT_HYPHEN

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

```
public static final int END_HYPHEN_EDIT_INSERT_HYPHEN
```

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

<br />

Constant Value: 2 (0x00000002)  

### END_HYPHEN_EDIT_INSERT_MAQAF

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

```
public static final int END_HYPHEN_EDIT_INSERT_MAQAF
```

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

<br />

Constant Value: 4 (0x00000004)  

### END_HYPHEN_EDIT_INSERT_UCAS_HYPHEN

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

```
public static final int END_HYPHEN_EDIT_INSERT_UCAS_HYPHEN
```

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

<br />

Constant Value: 5 (0x00000005)  

### END_HYPHEN_EDIT_INSERT_ZWJ_AND_HYPHEN

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

```
public static final int 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).

<br />

Constant Value: 6 (0x00000006)  

### END_HYPHEN_EDIT_NO_EDIT

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

```
public static final int END_HYPHEN_EDIT_NO_EDIT
```

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

<br />

Constant Value: 0 (0x00000000)  

### END_HYPHEN_EDIT_REPLACE_WITH_HYPHEN

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

```
public static final int END_HYPHEN_EDIT_REPLACE_WITH_HYPHEN
```

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

<br />

Constant Value: 1 (0x00000001)  

### FAKE_BOLD_TEXT_FLAG

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

```
public static final int FAKE_BOLD_TEXT_FLAG
```

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

Enabling this flag will cause text draw operations to apply a simulated bold effect when drawing a[Typeface](https://developer.android.com/reference/android/graphics/Typeface)that is not already bold.

<br />

<br />

**See also:**

- [Paint(int)](https://developer.android.com/reference/android/graphics/Paint#Paint(int))
- [setFlags(int)](https://developer.android.com/reference/android/graphics/Paint#setFlags(int))

Constant Value: 32 (0x00000020)  

### FILTER_BITMAP_FLAG

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

```
public static final int FILTER_BITMAP_FLAG
```

Paint flag that enables bilinear sampling on scaled bitmaps.

If cleared, scaled bitmaps will be drawn with nearest neighbor sampling, likely resulting in artifacts. This should generally be on when drawing bitmaps, unless performance-bound (rendering to software canvas) or preferring pixelation artifacts to blurriness when scaling significantly.

If bitmaps are scaled for device density at creation time (as resource bitmaps often are) the filtering will already have been done.

On devices running[Build.VERSION_CODES.O](https://developer.android.com/reference/android/os/Build.VERSION_CODES#O)and below, hardware accelerated drawing always uses bilinear sampling on scaled bitmaps, regardless of this flag. On devices running[Build.VERSION_CODES.Q](https://developer.android.com/reference/android/os/Build.VERSION_CODES#Q)and above, this flag defaults to being set on a new`Paint`. It can be cleared with[setFlags(int)](https://developer.android.com/reference/android/graphics/Paint#setFlags(int))or[setFilterBitmap(boolean)](https://developer.android.com/reference/android/graphics/Paint#setFilterBitmap(boolean)).

<br />

<br />

**See also:**

- [Paint()](https://developer.android.com/reference/android/graphics/Paint#Paint())
- [Paint(int)](https://developer.android.com/reference/android/graphics/Paint#Paint(int))
- [setFlags(int)](https://developer.android.com/reference/android/graphics/Paint#setFlags(int))

Constant Value: 2 (0x00000002)  

### HINTING_OFF

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

```
public static final int HINTING_OFF
```

Font hinter option that disables font hinting.

<br />

**See also:**

- [setHinting(int)](https://developer.android.com/reference/android/graphics/Paint#setHinting(int))

Constant Value: 0 (0x00000000)  

### HINTING_ON

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

```
public static final int HINTING_ON
```

Font hinter option that enables font hinting.

<br />

**See also:**

- [setHinting(int)](https://developer.android.com/reference/android/graphics/Paint#setHinting(int))

Constant Value: 1 (0x00000001)  

### LINEAR_TEXT_FLAG

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

```
public static final int LINEAR_TEXT_FLAG
```

Paint flag that enables smooth linear scaling of text.

Enabling this flag does not actually scale text, but rather adjusts text draw operations to deal gracefully with smooth adjustment of scale. When this flag is enabled, font hinting is disabled to prevent shape deformation between scale factors, and glyph caching is disabled due to the large number of glyph images that will be generated.

[SUBPIXEL_TEXT_FLAG](https://developer.android.com/reference/android/graphics/Paint#SUBPIXEL_TEXT_FLAG)should be used in conjunction with this flag to prevent glyph positions from snapping to whole pixel values as scale factor is adjusted.

<br />

<br />

**See also:**

- [Paint(int)](https://developer.android.com/reference/android/graphics/Paint#Paint(int))
- [setFlags(int)](https://developer.android.com/reference/android/graphics/Paint#setFlags(int))

Constant Value: 64 (0x00000040)  

### START_HYPHEN_EDIT_INSERT_HYPHEN

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

```
public static final int START_HYPHEN_EDIT_INSERT_HYPHEN
```

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

<br />

Constant Value: 1 (0x00000001)  

### START_HYPHEN_EDIT_INSERT_ZWJ

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

```
public static final int START_HYPHEN_EDIT_INSERT_ZWJ
```

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

<br />

Constant Value: 2 (0x00000002)  

### START_HYPHEN_EDIT_NO_EDIT

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

```
public static final int START_HYPHEN_EDIT_NO_EDIT
```

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

<br />

Constant Value: 0 (0x00000000)  

### STRIKE_THRU_TEXT_FLAG

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

```
public static final int STRIKE_THRU_TEXT_FLAG
```

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

<br />

**See also:**

- [Paint(int)](https://developer.android.com/reference/android/graphics/Paint#Paint(int))
- [setFlags(int)](https://developer.android.com/reference/android/graphics/Paint#setFlags(int))

Constant Value: 16 (0x00000010)  

### SUBPIXEL_TEXT_FLAG

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

```
public static final int SUBPIXEL_TEXT_FLAG
```

Paint flag that enables subpixel positioning of text.

Enabling this flag causes glyph advances to be computed with subpixel accuracy.

This can be used with[LINEAR_TEXT_FLAG](https://developer.android.com/reference/android/graphics/Paint#LINEAR_TEXT_FLAG)to prevent text from jittering during smooth scale transitions.

<br />

<br />

**See also:**

- [Paint(int)](https://developer.android.com/reference/android/graphics/Paint#Paint(int))
- [setFlags(int)](https://developer.android.com/reference/android/graphics/Paint#setFlags(int))

Constant Value: 128 (0x00000080)  

### TEXT_RUN_FLAG_LEFT_EDGE

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

```
public static final int TEXT_RUN_FLAG_LEFT_EDGE
```

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

This flag is used for telling the underlying text layout engine that the text is located at the most left of the line. This flag is used for controlling the amount letter spacing added. If the text is in the middle of the line, the text layout engine assigns additional letter spacing to the both side of each letter. On the other hand, the letter spacing should not be added to the visually most left and right of the line. By setting this flag, text layout engine calculates the layout as it is located at the most visually left of the line and doesn't add letter spacing to the left of this run.

Note that the caller must resolve BiDi runs and reorder them visually and set this flag only if the target run is located visually most left position. This left does not always mean the beginning of the text.

If the run covers entire line, caller should set[TEXT_RUN_FLAG_RIGHT_EDGE](https://developer.android.com/reference/android/graphics/Paint#TEXT_RUN_FLAG_RIGHT_EDGE)as well.

Note that this flag is only effective for run based APIs. For example, this flag works for[Canvas.drawTextRun(CharSequence, int, int, int, int, float, float, boolean, Paint)](https://developer.android.com/reference/android/graphics/Canvas#drawTextRun(java.lang.CharSequence,%20int,%20int,%20int,%20int,%20float,%20float,%20boolean,%20android.graphics.Paint))and[Paint.getRunCharacterAdvance(char[], int, int, int, int, boolean, int, float[], int)](https://developer.android.com/reference/android/graphics/Paint#getRunCharacterAdvance(char[],%20int,%20int,%20int,%20int,%20boolean,%20int,%20float[],%20int)). However, this doesn't work for[Canvas.drawText(CharSequence, int, int, float, float, Paint)](https://developer.android.com/reference/android/graphics/Canvas#drawText(java.lang.CharSequence,%20int,%20int,%20float,%20float,%20android.graphics.Paint))or[Paint.measureText(CharSequence, int, int)](https://developer.android.com/reference/android/graphics/Paint#measureText(java.lang.CharSequence,%20int,%20int)). The non-run based APIs works as both[TEXT_RUN_FLAG_LEFT_EDGE](https://developer.android.com/reference/android/graphics/Paint#TEXT_RUN_FLAG_LEFT_EDGE)and[TEXT_RUN_FLAG_RIGHT_EDGE](https://developer.android.com/reference/android/graphics/Paint#TEXT_RUN_FLAG_RIGHT_EDGE)are specified.

<br />

Constant Value: 8192 (0x00002000)  

### TEXT_RUN_FLAG_RIGHT_EDGE

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

```
public static final int TEXT_RUN_FLAG_RIGHT_EDGE
```

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

This flag is used for telling the underlying text layout engine that the text is located at the most right of the line. This flag is used for controlling the amount letter spacing added. If the text is in the middle of the line, the text layout engine assigns additional letter spacing to the both side of each letter. On the other hand, the letter spacing should not be added to the visually most left and right of the line. By setting this flag, text layout engine calculates the layout as it is located at the most visually left of the line and doesn't add letter spacing to the left of this run.

Note that the caller must resolve BiDi runs and reorder them visually and set this flag only if the target run is located visually most right position. This right does not always mean the end of the text.

If the run covers entire line, caller should set[TEXT_RUN_FLAG_LEFT_EDGE](https://developer.android.com/reference/android/graphics/Paint#TEXT_RUN_FLAG_LEFT_EDGE)as well.

Note that this flag is only effective for run based APIs. For example, this flag works for[Canvas.drawTextRun(CharSequence, int, int, int, int, float, float, boolean, Paint)](https://developer.android.com/reference/android/graphics/Canvas#drawTextRun(java.lang.CharSequence,%20int,%20int,%20int,%20int,%20float,%20float,%20boolean,%20android.graphics.Paint))and[Paint.getRunCharacterAdvance(char[], int, int, int, int, boolean, int, float[], int)](https://developer.android.com/reference/android/graphics/Paint#getRunCharacterAdvance(char[],%20int,%20int,%20int,%20int,%20boolean,%20int,%20float[],%20int)). However, this doesn't work for[Canvas.drawText(CharSequence, int, int, float, float, Paint)](https://developer.android.com/reference/android/graphics/Canvas#drawText(java.lang.CharSequence,%20int,%20int,%20float,%20float,%20android.graphics.Paint))or[Paint.measureText(CharSequence, int, int)](https://developer.android.com/reference/android/graphics/Paint#measureText(java.lang.CharSequence,%20int,%20int)). The non-run based APIs works as both[TEXT_RUN_FLAG_LEFT_EDGE](https://developer.android.com/reference/android/graphics/Paint#TEXT_RUN_FLAG_LEFT_EDGE)and[TEXT_RUN_FLAG_RIGHT_EDGE](https://developer.android.com/reference/android/graphics/Paint#TEXT_RUN_FLAG_RIGHT_EDGE)are specified.

<br />

Constant Value: 16384 (0x00004000)  

### UNDERLINE_TEXT_FLAG

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

```
public static final int UNDERLINE_TEXT_FLAG
```

Paint flag that applies an underline decoration to drawn text.

<br />

**See also:**

- [Paint(int)](https://developer.android.com/reference/android/graphics/Paint#Paint(int))
- [setFlags(int)](https://developer.android.com/reference/android/graphics/Paint#setFlags(int))

Constant Value: 8 (0x00000008)  

### VERTICAL_TEXT_FLAG

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

```
public static final int 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. By enabling this flag, text measurement, drawing and shaping APIs works for vertical text layout. For example,[Canvas.drawText(String, float, float, Paint)](https://developer.android.com/reference/android/graphics/Canvas#drawText(java.lang.String,%20float,%20float,%20android.graphics.Paint))draws text from top to bottom.[Paint.measureText(String)](https://developer.android.com/reference/android/graphics/Paint#measureText(java.lang.String))returns vertical advances instead of horizontal advances.[TextRunShaper](https://developer.android.com/reference/android/graphics/text/TextRunShaper)shapes text vertically and report glyph IDs for vertical layout.

Do not set this flag for making[Layout](https://developer.android.com/reference/android/text/Layout). The[Layout](https://developer.android.com/reference/android/text/Layout)class and its subclasses are designed for horizontal text only and does not work for vertical text.

<br />

Constant Value: 4096 (0x00001000)

## Public constructors

### Paint

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

```
public Paint ()
```

Create a new paint with default settings.

On devices running[Build.VERSION_CODES.O](https://developer.android.com/reference/android/os/Build.VERSION_CODES#O)and below, hardware accelerated drawing always acts as if[FILTER_BITMAP_FLAG](https://developer.android.com/reference/android/graphics/Paint#FILTER_BITMAP_FLAG)is set. On devices running[Build.VERSION_CODES.Q](https://developer.android.com/reference/android/os/Build.VERSION_CODES#Q)and above,`FILTER_BITMAP_FLAG`is set by this constructor, and it can be cleared with[setFlags(int)](https://developer.android.com/reference/android/graphics/Paint#setFlags(int))or[setFilterBitmap(boolean)](https://developer.android.com/reference/android/graphics/Paint#setFilterBitmap(boolean)). On devices running[Build.VERSION_CODES.S](https://developer.android.com/reference/android/os/Build.VERSION_CODES#S)and above,`ANTI_ALIAS_FLAG`is set by this constructor, and it can be cleared with[setFlags(int)](https://developer.android.com/reference/android/graphics/Paint#setFlags(int))or[setAntiAlias(boolean)](https://developer.android.com/reference/android/graphics/Paint#setAntiAlias(boolean)).

<br />

<br />

### Paint

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

```
public Paint (Paint paint)
```

Create a new paint, initialized with the attributes in the specified paint parameter.

<br />

|                                          Parameters                                          ||
|---------|-------------------------------------------------------------------------------------|
| `paint` | `Paint`: Existing paint used to initialized the attributes of the new paint. <br /> |

### Paint

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

```
public Paint (int flags)
```

Create a new paint with the specified flags. Use setFlags() to change these after the paint is created.

On devices running[Build.VERSION_CODES.O](https://developer.android.com/reference/android/os/Build.VERSION_CODES#O)and below, hardware accelerated drawing always acts as if[FILTER_BITMAP_FLAG](https://developer.android.com/reference/android/graphics/Paint#FILTER_BITMAP_FLAG)is set. On devices running[Build.VERSION_CODES.Q](https://developer.android.com/reference/android/os/Build.VERSION_CODES#Q)and above,`FILTER_BITMAP_FLAG`is always set by this constructor, regardless of the value of`flags`. It can be cleared with[setFlags(int)](https://developer.android.com/reference/android/graphics/Paint#setFlags(int))or[setFilterBitmap(boolean)](https://developer.android.com/reference/android/graphics/Paint#setFilterBitmap(boolean)).

<br />

<br />

|                                    Parameters                                    ||
|---------|-------------------------------------------------------------------------|
| `flags` | `int`: initial flag bits, as if they were passed via setFlags(). <br /> |

## Public methods

### ascent

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

```
public float ascent ()
```

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

Note that this is the ascent of the main typeface, and actual text rendered may need a larger ascent because fallback fonts may get used in rendering the text.

<br />

|                                                     Returns                                                      ||
|---------|---------------------------------------------------------------------------------------------------------|
| `float` | the distance above (negative) the baseline (ascent) based on the current typeface and text size. <br /> |

### breakText

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

```
public int breakText (char[] text, 
                int index, 
                int count, 
                float maxWidth, 
                float[] measuredWidth)
```

Measure the text, stopping early if the measured width exceeds maxWidth. Return the number of chars that were measured, and if measuredWidth is not null, return in it the actual width measured.

<br />

|                                                                         Parameters                                                                          ||
|-----------------|--------------------------------------------------------------------------------------------------------------------------------------------|
| `text`          | `char`: The text to measure. Cannot be null. <br />                                                                                        |
| `index`         | `int`: The offset into text to begin measuring at <br />                                                                                   |
| `count`         | `int`: The number of maximum number of entries to measure. If count is negative, then the characters are measured in reverse order. <br /> |
| `maxWidth`      | `float`: The maximum width to accumulate. <br />                                                                                           |
| `measuredWidth` | `float`: Optional. If not null, returns the actual width measured. <br />                                                                  |

|                                       Returns                                        ||
|-------|-------------------------------------------------------------------------------|
| `int` | The number of chars that were measured. Will always be \<= abs(count). <br /> |

### breakText

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

```
public int breakText (String text, 
                boolean measureForwards, 
                float maxWidth, 
                float[] measuredWidth)
```

Measure the text, stopping early if the measured width exceeds maxWidth. Return the number of chars that were measured, and if measuredWidth is not null, return in it the actual width measured.

<br />

|                                                                                           Parameters                                                                                           ||
|-------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `text`            | `String`: The text to measure. Cannot be null. <br />                                                                                                                       |
| `measureForwards` | `boolean`: If true, measure forwards, starting with the first character in the string. Otherwise, measure backwards, starting with the last character in the string. <br /> |
| `maxWidth`        | `float`: The maximum width to accumulate. <br />                                                                                                                            |
| `measuredWidth`   | `float`: Optional. If not null, returns the actual width measured. <br />                                                                                                   |

|                                       Returns                                        ||
|-------|-------------------------------------------------------------------------------|
| `int` | The number of chars that were measured. Will always be \<= abs(count). <br /> |

### breakText

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

```
public int breakText (CharSequence text, 
                int start, 
                int end, 
                boolean measureForwards, 
                float maxWidth, 
                float[] measuredWidth)
```

Measure the text, stopping early if the measured width exceeds maxWidth. Return the number of chars that were measured, and if measuredWidth is not null, return in it the actual width measured.

<br />

|                                                             Parameters                                                              ||
|-------------------|------------------------------------------------------------------------------------------------------------------|
| `text`            | `CharSequence`: The text to measure. Cannot be null. <br />                                                      |
| `start`           | `int`: The offset into text to begin measuring at <br />                                                         |
| `end`             | `int`: The end of the text slice to measure. <br />                                                              |
| `measureForwards` | `boolean`: If true, measure forwards, starting at start. Otherwise, measure backwards, starting with end. <br /> |
| `maxWidth`        | `float`: The maximum width to accumulate. <br />                                                                 |
| `measuredWidth`   | `float`: Optional. If not null, returns the actual width measured. <br />                                        |

|                                          Returns                                           ||
|-------|-------------------------------------------------------------------------------------|
| `int` | The number of chars that were measured. Will always be \<= abs(end - start). <br /> |

### clearShadowLayer

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

```
public void clearShadowLayer ()
```

Clear the shadow layer.

<br />

### descent

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

```
public float descent ()
```

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

Note that this is the descent of the main typeface, and actual text rendered may need a larger descent because fallback fonts may get used in rendering the text.

<br />

|                                                      Returns                                                      ||
|---------|----------------------------------------------------------------------------------------------------------|
| `float` | the distance below (positive) the baseline (descent) based on the current typeface and text size. <br /> |

### equalsForTextMeasurement

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

```
public boolean equalsForTextMeasurement (Paint other)
```

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

<br />

|                                                              Parameters                                                              ||
|---------|-----------------------------------------------------------------------------------------------------------------------------|
| `other` | `Paint`: A[Paint](https://developer.android.com/reference/android/graphics/Paint)object. This value cannot be`null`. <br /> |

|                                                                      Returns                                                                       ||
|-----------|-----------------------------------------------------------------------------------------------------------------------------------------|
| `boolean` | true if the other[Paint](https://developer.android.com/reference/android/graphics/Paint)has the same effect on text measurement. <br /> |

### getAlpha

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

```
public int getAlpha ()
```

Helper to getColor() that just returns the color's alpha value. This is the same as calling getColor() \>\>\> 24. It always returns a value between 0 (completely transparent) and 255 (completely opaque).

<br />

|                         Returns                         ||
|-------|--------------------------------------------------|
| `int` | the alpha component of the paint's color. <br /> |

### getBlendMode

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

```
public BlendMode getBlendMode ()
```

Get the paint's blend mode object. Will return null if there is a Xfermode applied that cannot be represented by a blend mode (i.e. a custom`RuntimeXfermode`

<br />

|                                                         Returns                                                          ||
|---------------------------------------------------------------------------------|-----------------------------------------|
| [BlendMode](https://developer.android.com/reference/android/graphics/BlendMode) | the paint's blend mode (or null) <br /> |

### getColor

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

```
public int getColor ()
```

Return the paint's color in sRGB. Note that the color is a 32bit value containing alpha as well as r,g,b. This 32bit value is not premultiplied, meaning that its alpha can be any value, regardless of the values of r,g,b. See the Color class for more details.

<br />

|                   Returns                    ||
|-------|---------------------------------------|
| `int` | the paint's color (and alpha). <br /> |

### getColorFilter

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

```
public ColorFilter getColorFilter ()
```

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

<br />

|                                                               Returns                                                               ||
|-------------------------------------------------------------------------------------|------------------------------------------------|
| [ColorFilter](https://developer.android.com/reference/android/graphics/ColorFilter) | the paint's colorfilter (maybe be null) <br /> |

### getColorLong

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

```
public long getColorLong ()
```

Return the paint's color. Note that the color is a long with an encoded[ColorSpace](https://developer.android.com/reference/android/graphics/ColorSpace)as well as alpha and r,g,b. These values are not premultiplied, meaning that alpha can be any value, regardless of the values of r,g,b. See the[Color](https://developer.android.com/reference/android/graphics/Color)class for more details.

<br />

|                                     Returns                                     ||
|--------|-------------------------------------------------------------------------|
| `long` | the paint's color, alpha, and`ColorSpace`encoded as a`ColorLong` <br /> |

### getEndHyphenEdit

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

```
public int getEndHyphenEdit ()
```

Get the current value of end hyphen edit. The default value is 0 which is equivalent to[END_HYPHEN_EDIT_NO_EDIT](https://developer.android.com/reference/android/graphics/Paint#END_HYPHEN_EDIT_NO_EDIT).

<br />

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           Returns                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           ||
|-------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `int` | the current starting hyphen edit value Value is[END_HYPHEN_EDIT_NO_EDIT](https://developer.android.com/reference/android/graphics/Paint#END_HYPHEN_EDIT_NO_EDIT),[END_HYPHEN_EDIT_REPLACE_WITH_HYPHEN](https://developer.android.com/reference/android/graphics/Paint#END_HYPHEN_EDIT_REPLACE_WITH_HYPHEN),[END_HYPHEN_EDIT_INSERT_HYPHEN](https://developer.android.com/reference/android/graphics/Paint#END_HYPHEN_EDIT_INSERT_HYPHEN),[END_HYPHEN_EDIT_INSERT_ARMENIAN_HYPHEN](https://developer.android.com/reference/android/graphics/Paint#END_HYPHEN_EDIT_INSERT_ARMENIAN_HYPHEN),[END_HYPHEN_EDIT_INSERT_MAQAF](https://developer.android.com/reference/android/graphics/Paint#END_HYPHEN_EDIT_INSERT_MAQAF),[END_HYPHEN_EDIT_INSERT_UCAS_HYPHEN](https://developer.android.com/reference/android/graphics/Paint#END_HYPHEN_EDIT_INSERT_UCAS_HYPHEN), or[END_HYPHEN_EDIT_INSERT_ZWJ_AND_HYPHEN](https://developer.android.com/reference/android/graphics/Paint#END_HYPHEN_EDIT_INSERT_ZWJ_AND_HYPHEN) <br /> |

**See also:**

- [setStartHyphenEdit(int)](https://developer.android.com/reference/android/graphics/Paint#setStartHyphenEdit(int))  

### getFillPath

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

```
public boolean getFillPath (Path src, 
                Path dst)
```

Applies any/all effects (patheffect, stroking) to src, returning the result in dst. The result is that drawing src with this paint will be the same as drawing dst with a default paint (at least from the geometric perspective).

<br />

|                         Parameters                         ||
|-------|-----------------------------------------------------|
| `src` | `Path`: input path <br />                           |
| `dst` | `Path`: output path (may be the same as src) <br /> |

|                                                     Returns                                                      ||
|-----------|-------------------------------------------------------------------------------------------------------|
| `boolean` | true if the path should be filled, or false if it should be drawn with a hairline (width == 0) <br /> |

### getFlags

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

```
public int getFlags ()
```

Return the paint's flags. Use the Flag enum to test flag values.

<br />

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             Returns                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              ||
|-------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `int` | the paint's flags (see enums ending in _Flag for bit masks) Value is either`0`or a combination of[ANTI_ALIAS_FLAG](https://developer.android.com/reference/android/graphics/Paint#ANTI_ALIAS_FLAG),[FILTER_BITMAP_FLAG](https://developer.android.com/reference/android/graphics/Paint#FILTER_BITMAP_FLAG),[DITHER_FLAG](https://developer.android.com/reference/android/graphics/Paint#DITHER_FLAG),[UNDERLINE_TEXT_FLAG](https://developer.android.com/reference/android/graphics/Paint#UNDERLINE_TEXT_FLAG),[STRIKE_THRU_TEXT_FLAG](https://developer.android.com/reference/android/graphics/Paint#STRIKE_THRU_TEXT_FLAG),[FAKE_BOLD_TEXT_FLAG](https://developer.android.com/reference/android/graphics/Paint#FAKE_BOLD_TEXT_FLAG),[LINEAR_TEXT_FLAG](https://developer.android.com/reference/android/graphics/Paint#LINEAR_TEXT_FLAG),[SUBPIXEL_TEXT_FLAG](https://developer.android.com/reference/android/graphics/Paint#SUBPIXEL_TEXT_FLAG),[EMBEDDED_BITMAP_TEXT_FLAG](https://developer.android.com/reference/android/graphics/Paint#EMBEDDED_BITMAP_TEXT_FLAG),[TEXT_RUN_FLAG_LEFT_EDGE](https://developer.android.com/reference/android/graphics/Paint#TEXT_RUN_FLAG_LEFT_EDGE), and[TEXT_RUN_FLAG_RIGHT_EDGE](https://developer.android.com/reference/android/graphics/Paint#TEXT_RUN_FLAG_RIGHT_EDGE) <br /> |

### getFontFeatureSettings

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

```
public String getFontFeatureSettings ()
```

Returns the font feature settings. The format is the same as the CSS font-feature-settings attribute:<https://www.w3.org/TR/css-fonts-3/#font-feature-settings-prop>

<br />

|                                                                   Returns                                                                    ||
|--------------------------------------------------------------------|--------------------------------------------------------------------------|
| [String](https://developer.android.com/reference/java/lang/String) | the paint's currently set font feature settings. Default is null. <br /> |

**See also:**

- [setFontFeatureSettings(String)](https://developer.android.com/reference/android/graphics/Paint#setFontFeatureSettings(java.lang.String))  

### getFontMetrics

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

```
public float getFontMetrics (Paint.FontMetrics metrics)
```

Return the font's recommended interline spacing, given the Paint's settings for typeface, textSize, etc. If metrics is not null, return the fontmetric values in it.

Note that these are the values for the main typeface, and actual text rendered may need a larger set of values because fallback fonts may get used in rendering the text.

<br />

|                                                                       Parameters                                                                        ||
|-----------|----------------------------------------------------------------------------------------------------------------------------------------------|
| `metrics` | `Paint.FontMetrics`: If this object is not null, its fields are filled with the appropriate values given the paint's text attributes. <br /> |

|                          Returns                          ||
|---------|--------------------------------------------------|
| `float` | the font's recommended interline spacing. <br /> |

### getFontMetrics

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

```
public Paint.FontMetrics getFontMetrics ()
```

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

<br />

|                                                 Returns                                                 ||
|-------------------------------------------------------------------------------------------------|--------|
| [Paint.FontMetrics](https://developer.android.com/reference/android/graphics/Paint.FontMetrics) | <br /> |

### getFontMetricsForLocale

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

```
public void getFontMetricsForLocale (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[setTextLocales(android.os.LocaleList)](https://developer.android.com/reference/android/graphics/Paint#setTextLocales(android.os.LocaleList)). If multiple locales are specified, the minimum ascent and maximum descent will be set. This API is useful for determining the default line height of the empty text field, e.g.[EditText](https://developer.android.com/reference/android/widget/EditText). Note, if the[Typeface](https://developer.android.com/reference/android/graphics/Typeface)is created from the custom font files, its metrics are reserved, i.e. the ascent will be the custom font's ascent or smaller, the descent will be the custom font's descent or larger. Note, if the[Typeface](https://developer.android.com/reference/android/graphics/Typeface)is a system fallback, e.g.[Typeface.SERIF](https://developer.android.com/reference/android/graphics/Typeface#SERIF), the default font's metrics are reserved, i.e. the ascent will be the serif font's ascent or smaller, the descent will be the serif font's descent or larger.

<br />

|                                                                Parameters                                                                 ||
|-----------|--------------------------------------------------------------------------------------------------------------------------------|
| `metrics` | `Paint.FontMetrics`: an output parameter. All members will be set by calling this function. This value cannot be`null`. <br /> |

### getFontMetricsInt

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

```
public void getFontMetricsInt (char[] text, 
                int start, 
                int count, 
                int contextStart, 
                int contextCount, 
                boolean isRtl, 
                Paint.FontMetricsInt outMetrics)
```

Returns the font metrics value for the given text. If the text is rendered with multiple font files, this function returns the large ascent and descent that are enough for drawing all font files. The context range is used for shaping context. Some script, e.g. Arabic or Devanagari, changes letter shape based on its location or surrounding characters.

<br />

|                                             Parameters                                              ||
|----------------|-------------------------------------------------------------------------------------|
| `text`         | `char`: a text to be measured. This value cannot be`null`. <br />                   |
| `start`        | `int`: a starting offset in the text. Value is 0 or greater <br />                  |
| `count`        | `int`: a length of the text to be measured. Value is 0 or greater <br />            |
| `contextStart` | `int`: a context starting offset in the text. Value is 0 or greater <br />          |
| `contextCount` | `int`: a length of the context to be used. Value is 0 or greater <br />             |
| `isRtl`        | `boolean`: true if measuring on RTL context, otherwise false. <br />                |
| `outMetrics`   | `Paint.FontMetricsInt`: the output font metrics. This value cannot be`null`. <br /> |

### getFontMetricsInt

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

```
public int getFontMetricsInt (Paint.FontMetricsInt fmi)
```

Return the font's interline spacing, given the Paint's settings for typeface, textSize, etc. If metrics is not null, return the fontmetric values in it. Note: all values have been converted to integers from floats, in such a way has to make the answers useful for both spacing and clipping. If you want more control over the rounding, call getFontMetrics().

Note that these are the values for the main typeface, and actual text rendered may need a larger set of values because fallback fonts may get used in rendering the text.

<br />

|              Parameters              ||
|-------|-------------------------------|
| `fmi` | `Paint.FontMetricsInt` <br /> |

|                   Returns                   ||
|-------|--------------------------------------|
| `int` | the font's interline spacing. <br /> |

### getFontMetricsInt

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

```
public Paint.FontMetricsInt getFontMetricsInt ()
```

<br />

<br />

|                                                    Returns                                                    ||
|-------------------------------------------------------------------------------------------------------|--------|
| [Paint.FontMetricsInt](https://developer.android.com/reference/android/graphics/Paint.FontMetricsInt) | <br /> |

### getFontMetricsInt

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

```
public void getFontMetricsInt (CharSequence text, 
                int start, 
                int count, 
                int contextStart, 
                int contextCount, 
                boolean isRtl, 
                Paint.FontMetricsInt outMetrics)
```

Returns the font metrics value for the given text. If the text is rendered with multiple font files, this function returns the large ascent and descent that are enough for drawing all font files. The context range is used for shaping context. Some script, e.g. Arabic or Devanagari, changes letter shape based on its location or surrounding characters.

<br />

|                                             Parameters                                              ||
|----------------|-------------------------------------------------------------------------------------|
| `text`         | `CharSequence`: a text to be measured. This value cannot be`null`. <br />           |
| `start`        | `int`: a starting offset in the text. Value is 0 or greater <br />                  |
| `count`        | `int`: a length of the text to be measured. Value is 0 or greater <br />            |
| `contextStart` | `int`: a context starting offset in the text. Value is 0 or greater <br />          |
| `contextCount` | `int`: a length of the context to be used. Value is 0 or greater <br />             |
| `isRtl`        | `boolean`: true if measuring on RTL context, otherwise false. <br />                |
| `outMetrics`   | `Paint.FontMetricsInt`: the output font metrics. This value cannot be`null`. <br /> |

### getFontMetricsIntForLocale

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

```
public void getFontMetricsIntForLocale (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[setTextLocales(android.os.LocaleList)](https://developer.android.com/reference/android/graphics/Paint#setTextLocales(android.os.LocaleList)). If multiple locales are specified, the minimum ascent and maximum descent will be set. This API is useful for determining the default line height of the empty text field, e.g.[EditText](https://developer.android.com/reference/android/widget/EditText). Note, if the[Typeface](https://developer.android.com/reference/android/graphics/Typeface)is created from the custom font files, its metrics are reserved, i.e. the ascent will be the custom font's ascent or smaller, the descent will be the custom font's descent or larger. Note, if the[Typeface](https://developer.android.com/reference/android/graphics/Typeface)is a system fallback, e.g.[Typeface.SERIF](https://developer.android.com/reference/android/graphics/Typeface#SERIF), the default font's metrics are reserved, i.e. the ascent will be the serif font's ascent or smaller, the descent will be the serif font's descent or larger.

<br />

|                                                                  Parameters                                                                  ||
|-----------|-----------------------------------------------------------------------------------------------------------------------------------|
| `metrics` | `Paint.FontMetricsInt`: an output parameter. All members will be set by calling this function. This value cannot be`null`. <br /> |

### getFontSpacing

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

```
public float getFontSpacing ()
```

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

Note that this is the value for the main typeface, and actual text rendered may need a larger value because fallback fonts may get used in rendering the text.

<br />

|                                       Returns                                       ||
|---------|----------------------------------------------------------------------------|
| `float` | recommend line spacing based on the current typeface and text size. <br /> |

### getFontVariationOverride

Added in[version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)  

```
public String getFontVariationOverride ()
```

Gets the current font variation override value.

<br />

|                                                                   Returns                                                                    ||
|--------------------------------------------------------------------|--------------------------------------------------------------------------|
| [String](https://developer.android.com/reference/java/lang/String) | a current font variation override value. This value may be`null`. <br /> |

### getFontVariationSettings

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

```
public String getFontVariationSettings ()
```

Returns the font variation settings.

<br />

|                                                                    Returns                                                                     ||
|--------------------------------------------------------------------|----------------------------------------------------------------------------|
| [String](https://developer.android.com/reference/java/lang/String) | the paint's currently set font variation settings. Default is null. <br /> |

**See also:**

- [setFontVariationSettings(String)](https://developer.android.com/reference/android/graphics/Paint#setFontVariationSettings(java.lang.String))  

### getHinting

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

```
public int getHinting ()
```

Return the paint's hinting mode. Returns either[HINTING_OFF](https://developer.android.com/reference/android/graphics/Paint#HINTING_OFF)or[HINTING_ON](https://developer.android.com/reference/android/graphics/Paint#HINTING_ON).

<br />

|    Returns    ||
|-------|--------|
| `int` | <br /> |

### getLetterSpacing

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

```
public float getLetterSpacing ()
```

Return the paint's letter-spacing for text. The default value is 0.

<br />

|                           Returns                            ||
|---------|-----------------------------------------------------|
| `float` | the paint's letter-spacing for drawing text. <br /> |

### getMaskFilter

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

```
public MaskFilter getMaskFilter ()
```

Get the paint's maskfilter object.

<br />

|                                                          Returns                                                           ||
|-----------------------------------------------------------------------------------|-----------------------------------------|
| [MaskFilter](https://developer.android.com/reference/android/graphics/MaskFilter) | the paint's maskfilter (or null) <br /> |

### getOffsetForAdvance

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

```
public int getOffsetForAdvance (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.

The returned value is generally the value of`offset`for which[getRunAdvance(char, int, int, int, int, boolean, int)](https://developer.android.com/reference/android/graphics/Paint#getRunAdvance(char[],%20int,%20int,%20int,%20int,%20boolean,%20int))yields a result most closely approximating`advance`, and which is also on a grapheme cluster boundary. As such, it is the preferred method for positioning a cursor in response to a touch or pointer event. The grapheme cluster boundaries are based on[Unicode Standard Annex #29](http://unicode.org/reports/tr29/)but with some tailoring for better user experience.

Note that`advance`is a (generally positive) width measurement relative to the start of the run. Thus, for RTL runs it the distance from the point to the right edge.

All indices are relative to the start of`text`. Further,`0 <= contextStart
<= start <= end <= contextEnd <= text.length`must hold on entry, and`start <= result
<= end`will hold on return.

<br />

|                                   Parameters                                   ||
|----------------|----------------------------------------------------------------|
| `text`         | `char`: the text to measure. Cannot be null. <br />            |
| `start`        | `int`: the index of the start of the range to measure <br />   |
| `end`          | `int`: the index + 1 of the end of the range to measure <br /> |
| `contextStart` | `int`: the index of the start of the shaping context <br />    |
| `contextEnd`   | `int`: the index + 1 of the end of the range to measure <br /> |
| `isRtl`        | `boolean`: whether the run is in RTL direction <br />          |
| `advance`      | `float`: width relative to start of run <br />                 |

|            Returns            ||
|-------|------------------------|
| `int` | index of offset <br /> |

### getOffsetForAdvance

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

```
public int getOffsetForAdvance (CharSequence text, 
                int start, 
                int end, 
                int contextStart, 
                int contextEnd, 
                boolean isRtl, 
                float advance)
```

<br />

<br />

|                                   Parameters                                   ||
|----------------|----------------------------------------------------------------|
| `text`         | `CharSequence`: the text to measure. Cannot be null. <br />    |
| `start`        | `int`: the index of the start of the range to measure <br />   |
| `end`          | `int`: the index + 1 of the end of the range to measure <br /> |
| `contextStart` | `int`: the index of the start of the shaping context <br />    |
| `contextEnd`   | `int`: the index + 1 of the end of the range to measure <br /> |
| `isRtl`        | `boolean`: whether the run is in RTL direction <br />          |
| `advance`      | `float`: width relative to start of run <br />                 |

|            Returns            ||
|-------|------------------------|
| `int` | index of offset <br /> |

**See also:**

- [getOffsetForAdvance(char[], int, int, int, int, boolean, float)](https://developer.android.com/reference/android/graphics/Paint#getOffsetForAdvance(char[],%20int,%20int,%20int,%20int,%20boolean,%20float))  

### getPathEffect

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

```
public PathEffect getPathEffect ()
```

Get the paint's patheffect object.

<br />

|                                                          Returns                                                           ||
|-----------------------------------------------------------------------------------|-----------------------------------------|
| [PathEffect](https://developer.android.com/reference/android/graphics/PathEffect) | the paint's patheffect (or null) <br /> |

### getRunAdvance

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

```
public float getRunAdvance (char[] text, 
                int start, 
                int end, 
                int contextStart, 
                int contextEnd, 
                boolean isRtl, 
                int offset)
```

Measure cursor position within a run of text.

The run of text includes the characters from`start`to`end`in the text. In addition, the range`contextStart`to`contextEnd`is used as context for the purpose of complex text shaping, such as Arabic text potentially shaped differently based on the text next to it.

All text outside the range`contextStart..contextEnd`is ignored. The text between`start`and`end`will be laid out to be measured.

The returned width measurement is the advance from`start`to`offset`. It is generally a positive value, no matter the direction of the run. If`offset == end`, the return value is simply the width of the whole run from`start`to`end`.

Ligatures are formed for characters in the range`start..end`(but not for`start..contextStart`or`end..contextEnd`). If`offset`points to a character in the middle of such a formed ligature, but at a grapheme cluster boundary, the return value will also reflect an advance in the middle of the ligature. See[getOffsetForAdvance(char, int, int, int, int, boolean, float)](https://developer.android.com/reference/android/graphics/Paint#getOffsetForAdvance(char[],%20int,%20int,%20int,%20int,%20boolean,%20float))for more discussion of grapheme cluster boundaries.

The direction of the run is explicitly specified by`isRtl`. Thus, this method is suitable only for runs of a single direction.

All indices are relative to the start of`text`. Further,`0 <= contextStart
<= start <= offset <= end <= contextEnd <= text.length`must hold on entry.

<br />

|                                   Parameters                                   ||
|----------------|----------------------------------------------------------------|
| `text`         | `char`: the text to measure. Cannot be null. <br />            |
| `start`        | `int`: the index of the start of the range to measure <br />   |
| `end`          | `int`: the index + 1 of the end of the range to measure <br /> |
| `contextStart` | `int`: the index of the start of the shaping context <br />    |
| `contextEnd`   | `int`: the index + 1 of the end of the shaping context <br />  |
| `isRtl`        | `boolean`: whether the run is in RTL direction <br />          |
| `offset`       | `int`: index of caret position <br />                          |

|                          Returns                           ||
|---------|---------------------------------------------------|
| `float` | width measurement between start and offset <br /> |

### getRunAdvance

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

```
public float getRunAdvance (CharSequence text, 
                int start, 
                int end, 
                int contextStart, 
                int contextEnd, 
                boolean isRtl, 
                int offset)
```

<br />

<br />

|                                   Parameters                                   ||
|----------------|----------------------------------------------------------------|
| `text`         | `CharSequence`: the text to measure. Cannot be null. <br />    |
| `start`        | `int`: the index of the start of the range to measure <br />   |
| `end`          | `int`: the index + 1 of the end of the range to measure <br /> |
| `contextStart` | `int`: the index of the start of the shaping context <br />    |
| `contextEnd`   | `int`: the index + 1 of the end of the shaping context <br />  |
| `isRtl`        | `boolean`: whether the run is in RTL direction <br />          |
| `offset`       | `int`: index of caret position <br />                          |

|                          Returns                           ||
|---------|---------------------------------------------------|
| `float` | width measurement between start and offset <br /> |

**See also:**

- [getRunAdvance(char[], int, int, int, int, boolean, int)](https://developer.android.com/reference/android/graphics/Paint#getRunAdvance(char[],%20int,%20int,%20int,%20int,%20boolean,%20int))  

### getRunCharacterAdvance

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

```
public float getRunCharacterAdvance (CharSequence text, 
                int start, 
                int end, 
                int contextStart, 
                int contextEnd, 
                boolean isRtl, 
                int offset, 
                float[] advances, 
                int advancesIndex)
```

<br />

<br />

|                                                    Parameters                                                     ||
|-----------------|--------------------------------------------------------------------------------------------------|
| `text`          | `CharSequence`: the text to measure. Cannot be null. <br />                                      |
| `start`         | `int`: the index of the start of the range to measure <br />                                     |
| `end`           | `int`: the index + 1 of the end of the range to measure <br />                                   |
| `contextStart`  | `int`: the index of the start of the shaping context <br />                                      |
| `contextEnd`    | `int`: the index + 1 of the end of the shaping context <br />                                    |
| `isRtl`         | `boolean`: whether the run is in RTL direction <br />                                            |
| `offset`        | `int`: index of caret position <br />                                                            |
| `advances`      | `float`: the array that receives the computed character advances This value may be`null`. <br /> |
| `advancesIndex` | `int`: the start index from which the advances array is filled <br />                            |

|                          Returns                           ||
|---------|---------------------------------------------------|
| `float` | width measurement between start and offset <br /> |

|                                                                                                                                                                                                                             Throws                                                                                                                                                                                                                              ||
|----------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [IndexOutOfBoundsException](https://developer.android.com/reference/java/lang/IndexOutOfBoundsException) | if a) contextStart or contextEnd is out of array's range or contextStart is larger than contextEnd, b) start or end is not within the range \[contextStart, contextEnd), or end is larger than start, c) offset is not within the range \[start, end), d) advances.length - advanceIndex is smaller than the run length, which equals to end - start. |

**See also:**

- [getRunCharacterAdvance(char[], int, int, int, int, boolean, int, float[], int)](https://developer.android.com/reference/android/graphics/Paint#getRunCharacterAdvance(char[],%20int,%20int,%20int,%20int,%20boolean,%20int,%20float[],%20int))  

### getRunCharacterAdvance

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

```
public float getRunCharacterAdvance (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.

<br />

|                                                    Parameters                                                     ||
|-----------------|--------------------------------------------------------------------------------------------------|
| `text`          | `char`: the text to measure. Cannot be null. <br />                                              |
| `start`         | `int`: the start index of the range to measure, inclusive <br />                                 |
| `end`           | `int`: the end index of the range to measure, exclusive <br />                                   |
| `contextStart`  | `int`: the start index of the shaping context, inclusive <br />                                  |
| `contextEnd`    | `int`: the end index of the shaping context, exclusive <br />                                    |
| `isRtl`         | `boolean`: whether the run is in RTL direction <br />                                            |
| `offset`        | `int`: index of caret position <br />                                                            |
| `advances`      | `float`: the array that receives the computed character advances This value may be`null`. <br /> |
| `advancesIndex` | `int`: the start index from which the advances array is filled <br />                            |

|                          Returns                           ||
|---------|---------------------------------------------------|
| `float` | width measurement between start and offset <br /> |

|                                                                                                                                                                                                                                 Throws                                                                                                                                                                                                                                 ||
|----------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [IndexOutOfBoundsException](https://developer.android.com/reference/java/lang/IndexOutOfBoundsException) | if a) contextStart or contextEnd is out of array's range or contextStart is larger than contextEnd, b) start or end is not within the range \[contextStart, contextEnd), or start is larger than end, c) offset is not within the range \[start, end), d) advances.length - advanceIndex is smaller than the length of the run, which equals to end - start. |

**See also:**

- [for more details.](https://developer.android.com/reference/android/graphics/Paint#getRunAdvance(char[],%20int,%20int,%20int,%20int,%20boolean,%20int))  

### getShader

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

```
public Shader getShader ()
```

Get the paint's shader object.

<br />

|                                                    Returns                                                     ||
|---------------------------------------------------------------------------|-------------------------------------|
| [Shader](https://developer.android.com/reference/android/graphics/Shader) | the paint's shader (or null) <br /> |

### getShadowLayerColor

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

```
public int getShadowLayerColor ()
```

Returns the color of the shadow layer.

<br />

|    Returns    ||
|-------|--------|
| `int` | <br /> |

**See also:**

- [setShadowLayer(float, float, float, int)](https://developer.android.com/reference/android/graphics/Paint#setShadowLayer(float,%20float,%20float,%20int))
- [setShadowLayer(float, float, float, long)](https://developer.android.com/reference/android/graphics/Paint#setShadowLayer(float,%20float,%20float,%20long))  

### getShadowLayerColorLong

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

```
public long getShadowLayerColorLong ()
```

Returns the color of the shadow layer.

<br />

|                             Returns                              ||
|--------|----------------------------------------------------------|
| `long` | the shadow layer's color encoded as a`ColorLong`. <br /> |

**See also:**

- [setShadowLayer(float, float, float, int)](https://developer.android.com/reference/android/graphics/Paint#setShadowLayer(float,%20float,%20float,%20int))
- [setShadowLayer(float, float, float, long)](https://developer.android.com/reference/android/graphics/Paint#setShadowLayer(float,%20float,%20float,%20long))
- [Color](https://developer.android.com/reference/android/graphics/Color)  

### getShadowLayerDx

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

```
public float getShadowLayerDx ()
```

Returns the x offset of the shadow layer.

<br />

|     Returns     ||
|---------|--------|
| `float` | <br /> |

**See also:**

- [setShadowLayer(float, float, float, int)](https://developer.android.com/reference/android/graphics/Paint#setShadowLayer(float,%20float,%20float,%20int))
- [setShadowLayer(float, float, float, long)](https://developer.android.com/reference/android/graphics/Paint#setShadowLayer(float,%20float,%20float,%20long))  

### getShadowLayerDy

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

```
public float getShadowLayerDy ()
```

Returns the y offset of the shadow layer.

<br />

|     Returns     ||
|---------|--------|
| `float` | <br /> |

**See also:**

- [setShadowLayer(float, float, float, int)](https://developer.android.com/reference/android/graphics/Paint#setShadowLayer(float,%20float,%20float,%20int))
- [setShadowLayer(float, float, float, long)](https://developer.android.com/reference/android/graphics/Paint#setShadowLayer(float,%20float,%20float,%20long))  

### getShadowLayerRadius

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

```
public float getShadowLayerRadius ()
```

Returns the blur radius of the shadow layer.

<br />

|     Returns     ||
|---------|--------|
| `float` | <br /> |

**See also:**

- [setShadowLayer(float, float, float, int)](https://developer.android.com/reference/android/graphics/Paint#setShadowLayer(float,%20float,%20float,%20int))
- [setShadowLayer(float, float, float, long)](https://developer.android.com/reference/android/graphics/Paint#setShadowLayer(float,%20float,%20float,%20long))  

### getStartHyphenEdit

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

```
public int getStartHyphenEdit ()
```

Get the current value of start hyphen edit. The default value is 0 which is equivalent to[START_HYPHEN_EDIT_NO_EDIT](https://developer.android.com/reference/android/graphics/Paint#START_HYPHEN_EDIT_NO_EDIT).

<br />

|                                                                                                                                                                                                                       Returns                                                                                                                                                                                                                       ||
|-------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `int` | the current starting hyphen edit value Value is[START_HYPHEN_EDIT_NO_EDIT](https://developer.android.com/reference/android/graphics/Paint#START_HYPHEN_EDIT_NO_EDIT),[START_HYPHEN_EDIT_INSERT_HYPHEN](https://developer.android.com/reference/android/graphics/Paint#START_HYPHEN_EDIT_INSERT_HYPHEN), or[START_HYPHEN_EDIT_INSERT_ZWJ](https://developer.android.com/reference/android/graphics/Paint#START_HYPHEN_EDIT_INSERT_ZWJ) <br /> |

**See also:**

- [setStartHyphenEdit(int)](https://developer.android.com/reference/android/graphics/Paint#setStartHyphenEdit(int))  

### getStrikeThruPosition

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

```
public float getStrikeThruPosition ()
```

Distance from top of the strike-through line to the baseline in pixels. The result is negative for positions that are above the baseline. This method returns where the strike-through line should be drawn independent of if the[STRIKE_THRU_TEXT_FLAG](https://developer.android.com/reference/android/graphics/Paint#STRIKE_THRU_TEXT_FLAG)bit is set.  
The units of this value are pixels.

<br />

|                                                Returns                                                ||
|---------|----------------------------------------------------------------------------------------------|
| `float` | the position of the strike-through line in pixels The units of this value are pixels. <br /> |

**See also:**

- [getStrikeThruThickness()](https://developer.android.com/reference/android/graphics/Paint#getStrikeThruThickness())
- [setStrikeThruText(boolean)](https://developer.android.com/reference/android/graphics/Paint#setStrikeThruText(boolean))
- [isStrikeThruText()](https://developer.android.com/reference/android/graphics/Paint#isStrikeThruText())  

### getStrikeThruThickness

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

```
public float getStrikeThruThickness ()
```

Returns the thickness of the strike-through line in pixels.  
The units of this value are pixels.

<br />

|                                                Returns                                                ||
|---------|----------------------------------------------------------------------------------------------|
| `float` | the position of the strike-through line in pixels The units of this value are pixels. <br /> |

**See also:**

- [getStrikeThruPosition()](https://developer.android.com/reference/android/graphics/Paint#getStrikeThruPosition())
- [setStrikeThruText(boolean)](https://developer.android.com/reference/android/graphics/Paint#setStrikeThruText(boolean))
- [isStrikeThruText()](https://developer.android.com/reference/android/graphics/Paint#isStrikeThruText())  

### getStrokeCap

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

```
public Paint.Cap getStrokeCap ()
```

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

<br />

|                                                                                        Returns                                                                                        ||
|---------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------|
| [Paint.Cap](https://developer.android.com/reference/android/graphics/Paint.Cap) | the line cap style for the paint, used whenever the paint's style is Stroke or StrokeAndFill. <br /> |

### getStrokeJoin

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

```
public Paint.Join getStrokeJoin ()
```

Return the paint's stroke join type.

<br />

|                                                   Returns                                                   ||
|-----------------------------------------------------------------------------------|--------------------------|
| [Paint.Join](https://developer.android.com/reference/android/graphics/Paint.Join) | the paint's Join. <br /> |

### getStrokeMiter

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

```
public float getStrokeMiter ()
```

Return the paint's stroke miter value. Used to control the behavior of miter joins when the joins angle is sharp.

<br />

|                                               Returns                                                ||
|---------|---------------------------------------------------------------------------------------------|
| `float` | the paint's miter limit, used whenever the paint's style is Stroke or StrokeAndFill. <br /> |

### getStrokeWidth

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

```
public float getStrokeWidth ()
```

Return the width for stroking.

<br />

A value of 0 strokes in hairline mode. Hairlines always draws a single pixel independent of the canvas's matrix.

<br />

<br />

|                                                Returns                                                ||
|---------|----------------------------------------------------------------------------------------------|
| `float` | the paint's stroke width, used whenever the paint's style is Stroke or StrokeAndFill. <br /> |

### getStyle

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

```
public Paint.Style getStyle ()
```

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

<br />

|                                                                       Returns                                                                       ||
|-------------------------------------------------------------------------------------|----------------------------------------------------------------|
| [Paint.Style](https://developer.android.com/reference/android/graphics/Paint.Style) | the paint's style setting (Fill, Stroke, StrokeAndFill) <br /> |

### getTextAlign

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

```
public Paint.Align getTextAlign ()
```

Return the paint's Align value for drawing text. This controls how the text is positioned relative to its origin. LEFT align means that all of the text will be drawn to the right of its origin (i.e. the origin specifies the LEFT edge of the text) and so on.

<br />

|                                                                Returns                                                                ||
|-------------------------------------------------------------------------------------|--------------------------------------------------|
| [Paint.Align](https://developer.android.com/reference/android/graphics/Paint.Align) | the paint's Align value for drawing text. <br /> |

### getTextBounds

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

```
public void getTextBounds (String text, 
                int start, 
                int end, 
                Rect bounds)
```

Retrieve the text boundary box and store to bounds. Return in bounds (allocated by the caller) the smallest rectangle that encloses all of the characters, with an implied origin at (0,0).

<br />

|                                              Parameters                                              ||
|----------|--------------------------------------------------------------------------------------------|
| `text`   | `String`: string to measure and return its bounds <br />                                   |
| `start`  | `int`: index of the first char in the string to measure <br />                             |
| `end`    | `int`: 1 past the last char in the string to measure <br />                                |
| `bounds` | `Rect`: returns the unioned bounds of all the text. Must be allocated by the caller <br /> |

### getTextBounds

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

```
public void getTextBounds (CharSequence text, 
                int start, 
                int end, 
                Rect bounds)
```

Retrieve the text boundary box and store to bounds. Return in bounds (allocated by the caller) the smallest rectangle that encloses all of the characters, with an implied origin at (0,0). Note that styles are ignored even if you pass[Spanned](https://developer.android.com/reference/android/text/Spanned)instance. Use[StaticLayout](https://developer.android.com/reference/android/text/StaticLayout)for measuring bounds of[Spanned](https://developer.android.com/reference/android/text/Spanned).

<br />

|                                                            Parameters                                                            ||
|----------|------------------------------------------------------------------------------------------------------------------------|
| `text`   | `CharSequence`: text to measure and return its bounds This value cannot be`null`. <br />                               |
| `start`  | `int`: index of the first char in the text to measure <br />                                                           |
| `end`    | `int`: 1 past the last char in the text to measure <br />                                                              |
| `bounds` | `Rect`: returns the unioned bounds of all the text. Must be allocated by the caller This value cannot be`null`. <br /> |

### getTextBounds

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

```
public void getTextBounds (char[] text, 
                int index, 
                int count, 
                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).

<br />

|                                              Parameters                                              ||
|----------|--------------------------------------------------------------------------------------------|
| `text`   | `char`: array of chars to measure and return their unioned bounds <br />                   |
| `index`  | `int`: index of the first char in the array to measure <br />                              |
| `count`  | `int`: the number of chars, beginning at index, to measure <br />                          |
| `bounds` | `Rect`: returns the unioned bounds of all the text. Must be allocated by the caller <br /> |

### getTextLocale

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

```
public Locale getTextLocale ()
```

Get the text's primary Locale. Note that this is not all of the locale-related information Paint has. Use[getTextLocales()](https://developer.android.com/reference/android/graphics/Paint#getTextLocales())to get the complete list.

<br />

|                                                                 Returns                                                                  ||
|--------------------------------------------------------------------|----------------------------------------------------------------------|
| [Locale](https://developer.android.com/reference/java/util/Locale) | the paint's primary Locale used for drawing text, never null. <br /> |

### getTextLocales

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

```
public LocaleList getTextLocales ()
```

Get the text locale list.

<br />

|                                                                        Returns                                                                         ||
|-----------------------------------------------------------------------------|---------------------------------------------------------------------------|
| [LocaleList](https://developer.android.com/reference/android/os/LocaleList) | the paint's LocaleList used for drawing text, never null or empty. <br /> |

### getTextPath

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

```
public void getTextPath (char[] text, 
                int index, 
                int count, 
                float x, 
                float y, 
                Path path)
```

Return the path (outline) for the specified text. Note: just like Canvas.drawText, this will respect the Align setting in the paint.

<br />

|                                                Parameters                                                 ||
|---------|--------------------------------------------------------------------------------------------------|
| `text`  | `char`: the text to retrieve the path from <br />                                                |
| `index` | `int`: the index of the first character in text <br />                                           |
| `count` | `int`: the number of characters starting with index <br />                                       |
| `x`     | `float`: the x coordinate of the text's origin <br />                                            |
| `y`     | `float`: the y coordinate of the text's origin <br />                                            |
| `path`  | `Path`: the path to receive the data describing the text. Must be allocated by the caller <br /> |

### getTextPath

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

```
public void getTextPath (String text, 
                int start, 
                int end, 
                float x, 
                float y, 
                Path path)
```

Return the path (outline) for the specified text. Note: just like Canvas.drawText, this will respect the Align setting in the paint.

<br />

|                                                Parameters                                                 ||
|---------|--------------------------------------------------------------------------------------------------|
| `text`  | `String`: the text to retrieve the path from <br />                                              |
| `start` | `int`: the first character in the text <br />                                                    |
| `end`   | `int`: 1 past the last character in the text <br />                                              |
| `x`     | `float`: the x coordinate of the text's origin <br />                                            |
| `y`     | `float`: the y coordinate of the text's origin <br />                                            |
| `path`  | `Path`: the path to receive the data describing the text. Must be allocated by the caller <br /> |

### getTextRunAdvances

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

```
public float getTextRunAdvances (char[] chars, 
                int index, 
                int count, 
                int contextIndex, 
                int contextCount, 
                boolean isRtl, 
                float[] advances, 
                int advancesIndex)
```

Retrieve the character advances of the text. Returns the total advance width for the characters in the run from`index`for`count`of chars, and if`advances`is not null, the advance assigned to each of these characters (java chars).

The trailing surrogate in a valid surrogate pair is assigned an advance of 0. Thus the number of returned advances is always equal to count, not to the number of unicode codepoints represented by the run.

In the case of conjuncts or combining marks, the total advance is assigned to the first logical character, and the following characters are assigned an advance of 0.

This generates the sum of the advances of glyphs for characters in a reordered cluster as the width of the first logical character in the cluster, and 0 for the widths of all other characters in the cluster. In effect, such clusters are treated like conjuncts.

The shaping bounds limit the amount of context available outside start and end that can be used for shaping analysis. These bounds typically reflect changes in bidi level or font metrics across which shaping does not occur.

<br />

<br />

|                                                                         Parameters                                                                          ||
|-----------------|--------------------------------------------------------------------------------------------------------------------------------------------|
| `chars`         | `char`: the text to measure. This value cannot be`null`. <br />                                                                            |
| `index`         | `int`: the index of the first character to measure Value is 0 or greater <br />                                                            |
| `count`         | `int`: the number of characters to measure Value is 0 or greater <br />                                                                    |
| `contextIndex`  | `int`: the index of the first character to use for shaping context. Context must cover the measureing target. Value is 0 or greater <br /> |
| `contextCount`  | `int`: the number of character to use for shaping context. Context must cover the measureing target. Value is 0 or greater <br />          |
| `isRtl`         | `boolean`: whether the run is in RTL direction <br />                                                                                      |
| `advances`      | `float`: array to receive the advances, must have room for all advances. This can be null if only total advance is needed <br />           |
| `advancesIndex` | `int`: the position in advances at which to put the advance corresponding to the character at start Value is 0 or greater <br />           |

|                   Returns                   ||
|---------|------------------------------------|
| `float` | the total advance in pixels <br /> |

### getTextRunCursor

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

```
public int getTextRunCursor (CharSequence text, 
                int contextStart, 
                int contextEnd, 
                boolean isRtl, 
                int offset, 
                int cursorOpt)
```

Returns the next cursor position in the run. This avoids placing the cursor between surrogates, between characters that form conjuncts, between base characters and combining marks, or within a reordering cluster.

ContextStart, contextEnd, and offset are relative to the start of text. The context is the shaping context for cursor movement, generally the bounds of the metric span enclosing the cursor in the direction of movement.

If cursorOpt is[CURSOR_AT](https://developer.android.com/reference/android/graphics/Paint#CURSOR_AT)and the offset is not a valid cursor position, this returns -1. Otherwise this will never return a value before contextStart or after contextEnd.

<br />

|                                                                                                                                                                                                                                 Parameters                                                                                                                                                                                                                                  ||
|----------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `text`         | `CharSequence`: the text This value cannot be`null`. <br />                                                                                                                                                                                                                                                                                                                                                                                                 |
| `contextStart` | `int`: the start of the context Value is 0 or greater <br />                                                                                                                                                                                                                                                                                                                                                                                                |
| `contextEnd`   | `int`: the end of the context Value is 0 or greater <br />                                                                                                                                                                                                                                                                                                                                                                                                  |
| `isRtl`        | `boolean`: true if the paragraph context is RTL, otherwise false <br />                                                                                                                                                                                                                                                                                                                                                                                     |
| `offset`       | `int`: the cursor position to move from Value is 0 or greater <br />                                                                                                                                                                                                                                                                                                                                                                                        |
| `cursorOpt`    | `int`: how to move the cursor Value is[CURSOR_AFTER](https://developer.android.com/reference/android/graphics/Paint#CURSOR_AFTER),[CURSOR_AT_OR_AFTER](https://developer.android.com/reference/android/graphics/Paint#CURSOR_AT_OR_AFTER),[CURSOR_BEFORE](https://developer.android.com/reference/android/graphics/Paint#CURSOR_BEFORE), or[CURSOR_AT_OR_BEFORE](https://developer.android.com/reference/android/graphics/Paint#CURSOR_AT_OR_BEFORE) <br /> |

|                       Returns                        ||
|-------|-----------------------------------------------|
| `int` | the offset of the next position, or -1 <br /> |

### getTextRunCursor

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

```
public int getTextRunCursor (char[] text, 
                int contextStart, 
                int contextLength, 
                boolean isRtl, 
                int offset, 
                int cursorOpt)
```

Returns the next cursor position in the run. This avoids placing the cursor between surrogates, between characters that form conjuncts, between base characters and combining marks, or within a reordering cluster.

ContextStart and offset are relative to the start of text. The context is the shaping context for cursor movement, generally the bounds of the metric span enclosing the cursor in the direction of movement.

If cursorOpt is[CURSOR_AT](https://developer.android.com/reference/android/graphics/Paint#CURSOR_AT)and the offset is not a valid cursor position, this returns -1. Otherwise this will never return a value before contextStart or after contextStart + contextLength.

<br />

|                                                                                                                                                                                                                                  Parameters                                                                                                                                                                                                                                  ||
|-----------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `text`          | `char`: the text This value cannot be`null`. <br />                                                                                                                                                                                                                                                                                                                                                                                                         |
| `contextStart`  | `int`: the start of the context Value is 0 or greater <br />                                                                                                                                                                                                                                                                                                                                                                                                |
| `contextLength` | `int`: the length of the context Value is 0 or greater <br />                                                                                                                                                                                                                                                                                                                                                                                               |
| `isRtl`         | `boolean`: true if the paragraph context is RTL, otherwise false <br />                                                                                                                                                                                                                                                                                                                                                                                     |
| `offset`        | `int`: the cursor position to move from Value is 0 or greater <br />                                                                                                                                                                                                                                                                                                                                                                                        |
| `cursorOpt`     | `int`: how to move the cursor Value is[CURSOR_AFTER](https://developer.android.com/reference/android/graphics/Paint#CURSOR_AFTER),[CURSOR_AT_OR_AFTER](https://developer.android.com/reference/android/graphics/Paint#CURSOR_AT_OR_AFTER),[CURSOR_BEFORE](https://developer.android.com/reference/android/graphics/Paint#CURSOR_BEFORE), or[CURSOR_AT_OR_BEFORE](https://developer.android.com/reference/android/graphics/Paint#CURSOR_AT_OR_BEFORE) <br /> |

|                       Returns                        ||
|-------|-----------------------------------------------|
| `int` | the offset of the next position, or -1 <br /> |

### getTextScaleX

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

```
public float getTextScaleX ()
```

Return the paint's horizontal scale factor for text. The default value is 1.0.

<br />

|                                 Returns                                  ||
|---------|-----------------------------------------------------------------|
| `float` | the paint's scale factor in X for drawing/measuring text <br /> |

### getTextSize

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

```
public float getTextSize ()
```

Return the paint's text size.

<br />

|                        Returns                        ||
|---------|----------------------------------------------|
| `float` | the paint's text size in pixel units. <br /> |

### getTextSkewX

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

```
public float getTextSkewX ()
```

Return the paint's horizontal skew factor for text. The default value is 0.

<br />

|                            Returns                             ||
|---------|-------------------------------------------------------|
| `float` | the paint's skew factor in X for drawing text. <br /> |

### getTextWidths

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

```
public int getTextWidths (char[] text, 
                int index, 
                int count, 
                float[] widths)
```

Return the advance widths for the characters in the string.

<br />

|                                                     Parameters                                                      ||
|----------|-----------------------------------------------------------------------------------------------------------|
| `text`   | `char`: The text to measure. Cannot be null. <br />                                                       |
| `index`  | `int`: The index of the first char to to measure <br />                                                   |
| `count`  | `int`: The number of chars starting with index to measure <br />                                          |
| `widths` | `float`: array to receive the advance widths of the characters. Must be at least a large as count. <br /> |

|                       Returns                       ||
|-------|----------------------------------------------|
| `int` | the actual number of widths returned. <br /> |

### getTextWidths

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

```
public int getTextWidths (String text, 
                float[] widths)
```

Return the advance widths for the characters in the string.

<br />

|                                                       Parameters                                                       ||
|----------|--------------------------------------------------------------------------------------------------------------|
| `text`   | `String`: The text to measure <br />                                                                         |
| `widths` | `float`: array to receive the advance widths of the characters. Must be at least a large as the text. <br /> |

|                            Returns                            ||
|-------|--------------------------------------------------------|
| `int` | the number of code units in the specified text. <br /> |

### getTextWidths

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

```
public int getTextWidths (String text, 
                int start, 
                int end, 
                float[] widths)
```

Return the advance widths for the characters in the string.

<br />

|                                                       Parameters                                                       ||
|----------|--------------------------------------------------------------------------------------------------------------|
| `text`   | `String`: The text to measure. Cannot be null. <br />                                                        |
| `start`  | `int`: The index of the first char to to measure <br />                                                      |
| `end`    | `int`: The end of the text slice to measure <br />                                                           |
| `widths` | `float`: array to receive the advance widths of the characters. Must be at least a large as the text. <br /> |

|                            Returns                            ||
|-------|--------------------------------------------------------|
| `int` | the number of code units in the specified text. <br /> |

### getTextWidths

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

```
public int getTextWidths (CharSequence text, 
                int start, 
                int end, 
                float[] widths)
```

Return the advance widths for the characters in the string.

<br />

|                                                         Parameters                                                          ||
|----------|-------------------------------------------------------------------------------------------------------------------|
| `text`   | `CharSequence`: The text to measure. Cannot be null. <br />                                                       |
| `start`  | `int`: The index of the first char to to measure <br />                                                           |
| `end`    | `int`: The end of the text slice to measure <br />                                                                |
| `widths` | `float`: array to receive the advance widths of the characters. Must be at least a large as (end - start). <br /> |

|                       Returns                       ||
|-------|----------------------------------------------|
| `int` | the actual number of widths returned. <br /> |

### getTypeface

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

```
public Typeface getTypeface ()
```

Get the paint's typeface object.

<br />

The typeface object identifies which font to use when drawing or measuring text.

<br />

<br />

|                                                       Returns                                                        ||
|-------------------------------------------------------------------------------|---------------------------------------|
| [Typeface](https://developer.android.com/reference/android/graphics/Typeface) | the paint's typeface (or null) <br /> |

### getUnderlinePosition

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

```
public float getUnderlinePosition ()
```

Returns the distance from top of the underline to the baseline in pixels. The result is positive for positions that are below the baseline. This method returns where the underline should be drawn independent of if the[UNDERLINE_TEXT_FLAG](https://developer.android.com/reference/android/graphics/Paint#UNDERLINE_TEXT_FLAG)bit is set.  
The units of this value are pixels.

<br />

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

**See also:**

- [isUnderlineText()](https://developer.android.com/reference/android/graphics/Paint#isUnderlineText())
- [getUnderlineThickness()](https://developer.android.com/reference/android/graphics/Paint#getUnderlineThickness())
- [setUnderlineText(boolean)](https://developer.android.com/reference/android/graphics/Paint#setUnderlineText(boolean))  

### 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 /> |

**See also:**

- [isUnderlineText()](https://developer.android.com/reference/android/graphics/Paint#isUnderlineText())
- [getUnderlinePosition()](https://developer.android.com/reference/android/graphics/Paint#getUnderlinePosition())
- [setUnderlineText(boolean)](https://developer.android.com/reference/android/graphics/Paint#setUnderlineText(boolean))  

### getWordSpacing

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

```
public float getWordSpacing ()
```

Return the paint's extra word-spacing for text. The default value is 0.  
The units of this value are pixels.

<br />

|                                                    Returns                                                     ||
|---------|-------------------------------------------------------------------------------------------------------|
| `float` | the paint's extra word-spacing for drawing text in pixels. The units of this value are pixels. <br /> |

**See also:**

- [setWordSpacing(float)](https://developer.android.com/reference/android/graphics/Paint#setWordSpacing(float))  

### getXfermode

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

```
public Xfermode getXfermode ()
```

Get the paint's transfer mode object.

<br />

|                                                          Returns                                                          ||
|-------------------------------------------------------------------------------|--------------------------------------------|
| [Xfermode](https://developer.android.com/reference/android/graphics/Xfermode) | the paint's transfer mode (or null) <br /> |

### hasGlyph

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

```
public boolean hasGlyph (String string)
```

Determine whether the typeface set on the paint has a glyph supporting the string. The simplest case is when the string contains a single character, in which this method determines whether the font has the character. In the case of multiple characters, the method returns true if there is a single glyph representing the ligature. For example, if the input is a pair of regional indicator symbols, determine whether there is an emoji flag for the pair.

Finally, if the string contains a variation selector, the method only returns true if the fonts contains a glyph specific to that variation.

Checking is done on the entire fallback chain, not just the immediate font referenced.

<br />

|                                  Parameters                                  ||
|----------|--------------------------------------------------------------------|
| `string` | `String`: the string to test whether there is glyph support <br /> |

|                              Returns                              ||
|-----------|--------------------------------------------------------|
| `boolean` | true if the typeface has a glyph for the string <br /> |

### isAntiAlias

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

```
public final boolean 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. See setDither() and setFilterBitmap() to affect how colors are treated.

<br />

|                                 Returns                                  ||
|-----------|---------------------------------------------------------------|
| `boolean` | true if the antialias bit is set in the paint's flags. <br /> |

### isDither

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

```
public final boolean 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. No dithering is generally faster, but higher precision colors are just truncated down (e.g. 8888 -\> 565). Dithering tries to distribute the error inherent in this process, to reduce the visual artifacts.

<br />

|                                 Returns                                  ||
|-----------|---------------------------------------------------------------|
| `boolean` | true if the dithering bit is set in the paint's flags. <br /> |

### isElegantTextHeight

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

```
public boolean isElegantTextHeight ()
```

<br />

**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.

Get the elegant metrics flag. Note: For applications target API 35 or later, this function returns true by default. For applications target API 36 or later, the function call will be ignored and the elegant text height is always enabled.

<br />

|                                 Returns                                 ||
|-----------|--------------------------------------------------------------|
| `boolean` | true if elegant metrics are enabled for text drawing. <br /> |

### isFakeBoldText

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

```
public final boolean isFakeBoldText ()
```

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

<br />

|                                   Returns                                   ||
|-----------|------------------------------------------------------------------|
| `boolean` | true if the fakeBoldText bit is set in the paint's flags. <br /> |

### isFilterBitmap

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

```
public final boolean isFilterBitmap ()
```

Whether or not the bitmap filter is activated. Filtering affects the sampling of bitmaps when they are transformed. Filtering does not affect how the colors in the bitmap are converted into device pixels. That is dependent on dithering and xfermodes.

<br />

|      Returns      ||
|-----------|--------|
| `boolean` | <br /> |

**See also:**

- [setFilterBitmap()](https://developer.android.com/reference/android/graphics/Paint#setFilterBitmap(boolean))
- [FILTER_BITMAP_FLAG](https://developer.android.com/reference/android/graphics/Paint#FILTER_BITMAP_FLAG)  

### isLinearText

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

```
public final boolean isLinearText ()
```

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

<br />

|                                 Returns                                  ||
|-----------|---------------------------------------------------------------|
| `boolean` | true if the lineartext bit is set in the paint's flags <br /> |

### isStrikeThruText

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

```
public final boolean isStrikeThruText ()
```

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

<br />

|                                                                                  Returns                                                                                   ||
|-----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `boolean` | true if the[STRIKE_THRU_TEXT_FLAG](https://developer.android.com/reference/android/graphics/Paint#STRIKE_THRU_TEXT_FLAG)bit is set in the paint's flags. <br /> |

**See also:**

- [getStrikeThruPosition()](https://developer.android.com/reference/android/graphics/Paint#getStrikeThruPosition())
- [getStrikeThruThickness()](https://developer.android.com/reference/android/graphics/Paint#getStrikeThruThickness())
- [setStrikeThruText(boolean)](https://developer.android.com/reference/android/graphics/Paint#setStrikeThruText(boolean))  

### isSubpixelText

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

```
public final boolean isSubpixelText ()
```

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

<br />

|                                Returns                                 ||
|-----------|-------------------------------------------------------------|
| `boolean` | true if the subpixel bit is set in the paint's flags <br /> |

### isUnderlineText

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

```
public final boolean isUnderlineText ()
```

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

<br />

|                                   Returns                                    ||
|-----------|-------------------------------------------------------------------|
| `boolean` | true if the underlineText bit is set in the paint's flags. <br /> |

**See also:**

- [getUnderlinePosition()](https://developer.android.com/reference/android/graphics/Paint#getUnderlinePosition())
- [getUnderlineThickness()](https://developer.android.com/reference/android/graphics/Paint#getUnderlineThickness())
- [setUnderlineText(boolean)](https://developer.android.com/reference/android/graphics/Paint#setUnderlineText(boolean))  

### measureText

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

```
public float measureText (char[] text, 
                int index, 
                int count)
```

Return the width of the text.

<br />

|                                    Parameters                                    ||
|---------|-------------------------------------------------------------------------|
| `text`  | `char`: The text to measure. Cannot be null. <br />                     |
| `index` | `int`: The index of the first character to start measuring <br />       |
| `count` | `int`: THe number of characters to measure, beginning with start <br /> |

|                Returns                ||
|---------|------------------------------|
| `float` | The width of the text <br /> |

### measureText

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

```
public float measureText (CharSequence text, 
                int start, 
                int end)
```

Return the width of the text.

<br />

|                                 Parameters                                 ||
|---------|-------------------------------------------------------------------|
| `text`  | `CharSequence`: The text to measure <br />                        |
| `start` | `int`: The index of the first character to start measuring <br /> |
| `end`   | `int`: 1 beyond the index of the last character to measure <br /> |

|                Returns                ||
|---------|------------------------------|
| `float` | The width of the text <br /> |

### measureText

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

```
public float measureText (String text, 
                int start, 
                int end)
```

Return the width of the text.

<br />

|                                 Parameters                                 ||
|---------|-------------------------------------------------------------------|
| `text`  | `String`: The text to measure. Cannot be null. <br />             |
| `start` | `int`: The index of the first character to start measuring <br /> |
| `end`   | `int`: 1 beyond the index of the last character to measure <br /> |

|                Returns                ||
|---------|------------------------------|
| `float` | The width of the text <br /> |

### measureText

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

```
public float measureText (String text)
```

Return the width of the text.

<br />

|                          Parameters                           ||
|--------|-------------------------------------------------------|
| `text` | `String`: The text to measure. Cannot be null. <br /> |

|                Returns                ||
|---------|------------------------------|
| `float` | The width of the text <br /> |

### reset

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

```
public void reset ()
```

Restores the paint to its default settings.

<br />

### set

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

```
public void set (Paint src)
```

Copy the fields from src into this paint. This is equivalent to calling get() on all of the src fields, and calling the corresponding set() methods on this.

<br />

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

### setARGB

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

```
public void setARGB (int a, 
                int r, 
                int g, 
                int b)
```

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

<br />

|                                Parameters                                 ||
|-----|----------------------------------------------------------------------|
| `a` | `int`: The new alpha component (0..255) of the paint's color. <br /> |
| `r` | `int`: The new red component (0..255) of the paint's color. <br />   |
| `g` | `int`: The new green component (0..255) of the paint's color. <br /> |
| `b` | `int`: The new blue component (0..255) of the paint's color. <br />  |

### setAlpha

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

```
public void setAlpha (int a)
```

Helper to setColor(), that only assigns the color's alpha value, leaving its r,g,b values unchanged. Results are undefined if the alpha value is outside of the range \[0..255\]

<br />

|                                 Parameters                                  ||
|-----|------------------------------------------------------------------------|
| `a` | `int`: set the alpha component \[0..255\] of the paint's color. <br /> |

### setAntiAlias

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

```
public void setAntiAlias (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. See setDither() and setFilterBitmap() to affect how colors are treated.

<br />

|                                      Parameters                                       ||
|------|---------------------------------------------------------------------------------|
| `aa` | `boolean`: true to set the antialias bit in the flags, false to clear it <br /> |

### setBlendMode

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

```
public void setBlendMode (BlendMode blendmode)
```

Set or clear the blend mode. A blend mode defines how source pixels (generated by a drawing command) are composited with the destination pixels (content of the render target).

<br />

Pass null to clear any previous blend mode.

<br />

<br />

<br />

|                                        Parameters                                         ||
|-------------|------------------------------------------------------------------------------|
| `blendmode` | `BlendMode`: May be null. The blend mode to be installed in the paint <br /> |

**See also:**

- [BlendMode](https://developer.android.com/reference/android/graphics/BlendMode)  

### setColor

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

```
public void setColor (long color)
```

Set the paint's color with a`ColorLong`. Note that the color is a long with an encoded[ColorSpace](https://developer.android.com/reference/android/graphics/ColorSpace)as well as alpha and r,g,b. These values are not premultiplied, meaning that alpha can be any value, regardless of the values of r,g,b. See the[Color](https://developer.android.com/reference/android/graphics/Color)class for more details.

<br />

|                                                                            Parameters                                                                             ||
|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------|
| `color` | `long`: The new color (including alpha and[ColorSpace](https://developer.android.com/reference/android/graphics/ColorSpace)) to set in the paint. <br /> |

|                                                                                   Throws                                                                                   ||
|--------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------|
| [IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException) | if the color space encoded in the`ColorLong`is invalid or unknown. |

### setColor

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

```
public void setColor (int color)
```

Set the paint's color. Note that the color is an int containing alpha as well as r,g,b. This 32bit value is not premultiplied, meaning that its alpha can be any value, regardless of the values of r,g,b. See the Color class for more details.

<br />

|                                 Parameters                                  ||
|---------|--------------------------------------------------------------------|
| `color` | `int`: The new color (including alpha) to set in the paint. <br /> |

### setColorFilter

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

```
public ColorFilter setColorFilter (ColorFilter filter)
```

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

<br />

|                                        Parameters                                        ||
|----------|--------------------------------------------------------------------------------|
| `filter` | `ColorFilter`: May be null. The new filter to be installed in the paint <br /> |

|                                              Returns                                               ||
|-------------------------------------------------------------------------------------|---------------|
| [ColorFilter](https://developer.android.com/reference/android/graphics/ColorFilter) | filter <br /> |

### setDither

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

```
public void setDither (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. No dithering is generally faster, but higher precision colors are just truncated down (e.g. 8888 -\> 565). Dithering tries to distribute the error inherent in this process, to reduce the visual artifacts.

<br />

|                                      Parameters                                       ||
|----------|-----------------------------------------------------------------------------|
| `dither` | `boolean`: true to set the dithering bit in flags, false to clear it <br /> |

### setElegantTextHeight

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

```
public void setElegantTextHeight (boolean elegant)
```

<br />

**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.

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.

Note: For applications target API 35 or later, the default value will be true by default. For applications target API 36 or later, the function call will be ignored and the elegant text height is always enabled.

<br />

|                                     Parameters                                      ||
|-----------|--------------------------------------------------------------------------|
| `elegant` | `boolean`: set the paint's elegant metrics flag for drawing text. <br /> |

### setEndHyphenEdit

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

```
public void setEndHyphenEdit (int endHyphen)
```

Set a end hyphen edit on the paint. By setting end hyphen edit, the measurement and drawing is performed with modifying hyphenation at the end of line. For example, by passing[END_HYPHEN_EDIT_INSERT_HYPHEN](https://developer.android.com/reference/android/graphics/Paint#END_HYPHEN_EDIT_INSERT_HYPHEN)like as follows, HYPHEN(U+2010) character is appended at the end of line.  

     
       Paint paint = new Paint();
       paint.setEndHyphenEdit(Paint.END_HYPHEN_EDIT_INSERT_HYPHEN);
       paint.measureText("abc", 0, 3);  // Returns the width of "abc-"
       Canvas.drawText("abc", 0, 3, 0f, 0f, paint);  // Draws "abc-"
     
     
The default value is 0 which is equivalent to[END_HYPHEN_EDIT_NO_EDIT](https://developer.android.com/reference/android/graphics/Paint#END_HYPHEN_EDIT_NO_EDIT).

<br />

<br />

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         Parameters                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         ||
|-------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `endHyphen` | `int`: a end hyphen edit value. Value is[END_HYPHEN_EDIT_NO_EDIT](https://developer.android.com/reference/android/graphics/Paint#END_HYPHEN_EDIT_NO_EDIT),[END_HYPHEN_EDIT_REPLACE_WITH_HYPHEN](https://developer.android.com/reference/android/graphics/Paint#END_HYPHEN_EDIT_REPLACE_WITH_HYPHEN),[END_HYPHEN_EDIT_INSERT_HYPHEN](https://developer.android.com/reference/android/graphics/Paint#END_HYPHEN_EDIT_INSERT_HYPHEN),[END_HYPHEN_EDIT_INSERT_ARMENIAN_HYPHEN](https://developer.android.com/reference/android/graphics/Paint#END_HYPHEN_EDIT_INSERT_ARMENIAN_HYPHEN),[END_HYPHEN_EDIT_INSERT_MAQAF](https://developer.android.com/reference/android/graphics/Paint#END_HYPHEN_EDIT_INSERT_MAQAF),[END_HYPHEN_EDIT_INSERT_UCAS_HYPHEN](https://developer.android.com/reference/android/graphics/Paint#END_HYPHEN_EDIT_INSERT_UCAS_HYPHEN), or[END_HYPHEN_EDIT_INSERT_ZWJ_AND_HYPHEN](https://developer.android.com/reference/android/graphics/Paint#END_HYPHEN_EDIT_INSERT_ZWJ_AND_HYPHEN) <br /> |

**See also:**

- [getEndHyphenEdit()](https://developer.android.com/reference/android/graphics/Paint#getEndHyphenEdit())  

### setFakeBoldText

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

```
public void setFakeBoldText (boolean fakeBoldText)
```

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

<br />

|                                                 Parameters                                                  ||
|----------------|---------------------------------------------------------------------------------------------|
| `fakeBoldText` | `boolean`: true to set the fakeBoldText bit in the paint's flags, false to clear it. <br /> |

### setFilterBitmap

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

```
public void setFilterBitmap (boolean filter)
```

Helper for setFlags(), setting or clearing the FILTER_BITMAP_FLAG bit. Filtering affects the sampling of bitmaps when they are transformed. Filtering does not affect how the colors in the bitmap are converted into device pixels. That is dependent on dithering and xfermodes.

<br />

|                                                 Parameters                                                  ||
|----------|---------------------------------------------------------------------------------------------------|
| `filter` | `boolean`: true to set the FILTER_BITMAP_FLAG bit in the paint's flags, false to clear it. <br /> |

**See also:**

- [FILTER_BITMAP_FLAG](https://developer.android.com/reference/android/graphics/Paint#FILTER_BITMAP_FLAG)  

### setFlags

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

```
public void setFlags (int flags)
```

Set the paint's flags. Use the Flag enum to specific flag values.

<br />

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Parameters                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   ||
|---------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `flags` | `int`: The new flag bits for the paint Value is either`0`or a combination of[ANTI_ALIAS_FLAG](https://developer.android.com/reference/android/graphics/Paint#ANTI_ALIAS_FLAG),[FILTER_BITMAP_FLAG](https://developer.android.com/reference/android/graphics/Paint#FILTER_BITMAP_FLAG),[DITHER_FLAG](https://developer.android.com/reference/android/graphics/Paint#DITHER_FLAG),[UNDERLINE_TEXT_FLAG](https://developer.android.com/reference/android/graphics/Paint#UNDERLINE_TEXT_FLAG),[STRIKE_THRU_TEXT_FLAG](https://developer.android.com/reference/android/graphics/Paint#STRIKE_THRU_TEXT_FLAG),[FAKE_BOLD_TEXT_FLAG](https://developer.android.com/reference/android/graphics/Paint#FAKE_BOLD_TEXT_FLAG),[LINEAR_TEXT_FLAG](https://developer.android.com/reference/android/graphics/Paint#LINEAR_TEXT_FLAG),[SUBPIXEL_TEXT_FLAG](https://developer.android.com/reference/android/graphics/Paint#SUBPIXEL_TEXT_FLAG),[EMBEDDED_BITMAP_TEXT_FLAG](https://developer.android.com/reference/android/graphics/Paint#EMBEDDED_BITMAP_TEXT_FLAG),[TEXT_RUN_FLAG_LEFT_EDGE](https://developer.android.com/reference/android/graphics/Paint#TEXT_RUN_FLAG_LEFT_EDGE), and[TEXT_RUN_FLAG_RIGHT_EDGE](https://developer.android.com/reference/android/graphics/Paint#TEXT_RUN_FLAG_RIGHT_EDGE) <br /> |

### setFontFeatureSettings

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

```
public void setFontFeatureSettings (String settings)
```

Set font feature settings. The format is the same as the CSS font-feature-settings attribute:<https://www.w3.org/TR/css-fonts-3/#font-feature-settings-prop>

<br />

|                                     Parameters                                     ||
|------------|------------------------------------------------------------------------|
| `settings` | `String`: the font feature settings string to use, may be null. <br /> |

**See also:**

- [getFontFeatureSettings()](https://developer.android.com/reference/android/graphics/Paint#getFontFeatureSettings())  

### setFontVariationOverride

Added in[version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)  

```
public void setFontVariationOverride (String fontVariationOverride)
```

Sets TrueType or OpenType font variation settings for overriding. The settings string is constructed from multiple pairs of axis tag and style values. The axis tag must contain four ASCII characters and must be wrapped with single quotes (U+0027) or double quotes (U+0022). Axis strings that are longer or shorter than four characters, or contain characters outside of U+0020..U+007E are invalid. If invalid font variation settings is provided, this method does nothing and returning false with printing error message to the logcat. Different from[setFontVariationSettings(java.lang.String)](https://developer.android.com/reference/android/graphics/Paint#setFontVariationSettings(java.lang.String)), this overrides the font variation settings which is already assigned to the font instance. For example, if the underlying font is configured as`'wght' 500, 'ital' 1`, and if the override is specified as``'wght' 700, `wdth` 150``, then the effective font variation setting is```wght' 700, 'ital' 1, 'wdth' 150``. The \`wght\` value is updated by override, 'ital' value is preserved because no overrides, and \`wdth\` value is added by override. If the font variation override is empty or null, nothing overrides and original font variation settings assigned to the font instance is used as it is.

<br />

|                                                                 Parameters                                                                 ||
|-------------------------|-------------------------------------------------------------------------------------------------------------------|
| `fontVariationOverride` | `String`: font variation override. You can pass null or empty string for clearing font variation override. <br /> |

|                                                                                Throws                                                                                 ||
|--------------------------------------------------------------------------------------------------------|---------------------------------------------------------------|
| [IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException) | If given string is not a valid font variation settings format |

**See also:**

- [getFontVariationSettings()](https://developer.android.com/reference/android/graphics/Paint#getFontVariationSettings())
- [setFontVariationSettings(String)](https://developer.android.com/reference/android/graphics/Paint#setFontVariationSettings(java.lang.String))
- [getFontVariationOverride()](https://developer.android.com/reference/android/graphics/Paint#getFontVariationOverride())
- [FontVariationAxis](https://developer.android.com/reference/android/graphics/fonts/FontVariationAxis)  

### setFontVariationSettings

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

```
public boolean setFontVariationSettings (String fontVariationSettings)
```

Sets TrueType or OpenType font variation settings. The settings string is constructed from multiple pairs of axis tag and style values. The axis tag must contain four ASCII characters and must be wrapped with single quotes (U+0027) or double quotes (U+0022). Axis strings that are longer or shorter than four characters, or contain characters outside of U+0020..U+007E are invalid. If a specified axis name is not defined in the font, the settings will be ignored. Examples,

- Set font width to 150.  

       
         Paint paint = new Paint();
         paint.setFontVariationSettings("'wdth' 150");
       
       
- Set the font slant to 20 degrees and ask for italic style.  

       
         Paint paint = new Paint();
         paint.setFontVariationSettings("'slnt' 20, 'ital' 1");
       
       
<br />

<br />

|                                                           Parameters                                                           ||
|-------------------------|-------------------------------------------------------------------------------------------------------|
| `fontVariationSettings` | `String`: font variation settings. You can pass null or empty string as no variation settings. <br /> |

|                                                                                             Returns                                                                                              ||
|-----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `boolean` | true if the given settings is effective to at least one font file underlying this typeface. This function also returns true for empty settings string. Otherwise returns false <br /> |

|                                                                                Throws                                                                                 ||
|--------------------------------------------------------------------------------------------------------|---------------------------------------------------------------|
| [IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException) | If given string is not a valid font variation settings format |

**See also:**

- [getFontVariationSettings()](https://developer.android.com/reference/android/graphics/Paint#getFontVariationSettings())
- [FontVariationAxis](https://developer.android.com/reference/android/graphics/fonts/FontVariationAxis)  

### setHinting

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

```
public void setHinting (int mode)
```

Set the paint's hinting mode. May be either[HINTING_OFF](https://developer.android.com/reference/android/graphics/Paint#HINTING_OFF)or[HINTING_ON](https://developer.android.com/reference/android/graphics/Paint#HINTING_ON).

<br />

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

### setLetterSpacing

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

```
public void setLetterSpacing (float letterSpacing)
```

Set the paint's letter-spacing for text. The default value is 0. The value is in 'EM' units. Typical values for slight expansion will be around 0.05. Negative values tighten text.

<br />

|                                    Parameters                                     ||
|-----------------|------------------------------------------------------------------|
| `letterSpacing` | `float`: set the paint's letter-spacing for drawing text. <br /> |

### setLinearText

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

```
public void setLinearText (boolean linearText)
```

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

<br />

|                                               Parameters                                                ||
|--------------|-------------------------------------------------------------------------------------------|
| `linearText` | `boolean`: true to set the linearText bit in the paint's flags, false to clear it. <br /> |

### setMaskFilter

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

```
public MaskFilter setMaskFilter (MaskFilter maskfilter)
```

Set or clear the maskfilter object.

<br />

Pass null to clear any previous maskfilter. As a convenience, the parameter passed is also returned.

<br />

<br />

|                                         Parameters                                          ||
|--------------|-------------------------------------------------------------------------------|
| `maskfilter` | `MaskFilter`: May be null. The maskfilter to be installed in the paint <br /> |

|                                               Returns                                                ||
|-----------------------------------------------------------------------------------|-------------------|
| [MaskFilter](https://developer.android.com/reference/android/graphics/MaskFilter) | maskfilter <br /> |

### setPathEffect

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

```
public PathEffect setPathEffect (PathEffect effect)
```

Set or clear the patheffect object.

<br />

Pass null to clear any previous patheffect. As a convenience, the parameter passed is also returned.

<br />

<br />

|                                       Parameters                                        ||
|----------|-------------------------------------------------------------------------------|
| `effect` | `PathEffect`: May be null. The patheffect to be installed in the paint <br /> |

|                                             Returns                                              ||
|-----------------------------------------------------------------------------------|---------------|
| [PathEffect](https://developer.android.com/reference/android/graphics/PathEffect) | effect <br /> |

### setShader

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

```
public Shader setShader (Shader shader)
```

Set or clear the shader object.

<br />

Pass null to clear any previous shader. As a convenience, the parameter passed is also returned.

<br />

<br />

|                                     Parameters                                      ||
|----------|---------------------------------------------------------------------------|
| `shader` | `Shader`: May be null. the new shader to be installed in the paint <br /> |

|                                         Returns                                          ||
|---------------------------------------------------------------------------|---------------|
| [Shader](https://developer.android.com/reference/android/graphics/Shader) | shader <br /> |

### setShadowLayer

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

```
public void setShadowLayer (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. If radius is 0, then the shadow layer is removed.

Can be used to create a blurred shadow underneath text. Support for use with other drawing operations is constrained to the software rendering pipeline.

The alpha of the shadow will be the paint's alpha if the shadow color is opaque, or the alpha from the shadow color if not.

<br />

|          Parameters           ||
|---------------|----------------|
| `radius`      | `float` <br /> |
| `dx`          | `float` <br /> |
| `dy`          | `float` <br /> |
| `shadowColor` | `int` <br />   |

### setShadowLayer

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

```
public void setShadowLayer (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. If radius is 0, then the shadow layer is removed.

Can be used to create a blurred shadow underneath text. Support for use with other drawing operations is constrained to the software rendering pipeline.

The alpha of the shadow will be the paint's alpha if the shadow color is opaque, or the alpha from the shadow color if not.

<br />

|          Parameters           ||
|---------------|----------------|
| `radius`      | `float` <br /> |
| `dx`          | `float` <br /> |
| `dy`          | `float` <br /> |
| `shadowColor` | `long` <br />  |

|                                                                                   Throws                                                                                   ||
|--------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------|
| [IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException) | if the color space encoded in the`ColorLong`is invalid or unknown. |

### setStartHyphenEdit

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

```
public void setStartHyphenEdit (int startHyphen)
```

Set a start hyphen edit on the paint. By setting start hyphen edit, the measurement and drawing is performed with modifying hyphenation at the start of line. For example, by passing[START_HYPHEN_EDIT_INSERT_HYPHEN](https://developer.android.com/reference/android/graphics/Paint#START_HYPHEN_EDIT_INSERT_HYPHEN)like as follows, HYPHEN(U+2010) character is appended at the start of line.  

     
       Paint paint = new Paint();
       paint.setStartHyphenEdit(Paint.START_HYPHEN_EDIT_INSERT_HYPHEN);
       paint.measureText("abc", 0, 3);  // Returns the width of "-abc"
       Canvas.drawText("abc", 0, 3, 0f, 0f, paint);  // Draws "-abc"
     
     
The default value is 0 which is equivalent to[START_HYPHEN_EDIT_NO_EDIT](https://developer.android.com/reference/android/graphics/Paint#START_HYPHEN_EDIT_NO_EDIT).

<br />

<br />

|                                                                                                                                                                                                                       Parameters                                                                                                                                                                                                                       ||
|---------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `startHyphen` | `int`: a start hyphen edit value. Value is[START_HYPHEN_EDIT_NO_EDIT](https://developer.android.com/reference/android/graphics/Paint#START_HYPHEN_EDIT_NO_EDIT),[START_HYPHEN_EDIT_INSERT_HYPHEN](https://developer.android.com/reference/android/graphics/Paint#START_HYPHEN_EDIT_INSERT_HYPHEN), or[START_HYPHEN_EDIT_INSERT_ZWJ](https://developer.android.com/reference/android/graphics/Paint#START_HYPHEN_EDIT_INSERT_ZWJ) <br /> |

**See also:**

- [getStartHyphenEdit()](https://developer.android.com/reference/android/graphics/Paint#getStartHyphenEdit())  

### setStrikeThruText

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

```
public void setStrikeThruText (boolean strikeThruText)
```

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

<br />

|                                                   Parameters                                                    ||
|------------------|-----------------------------------------------------------------------------------------------|
| `strikeThruText` | `boolean`: true to set the strikeThruText bit in the paint's flags, false to clear it. <br /> |

**See also:**

- [getStrikeThruPosition()](https://developer.android.com/reference/android/graphics/Paint#getStrikeThruPosition())
- [getStrikeThruThickness()](https://developer.android.com/reference/android/graphics/Paint#getStrikeThruThickness())
- [isStrikeThruText()](https://developer.android.com/reference/android/graphics/Paint#isStrikeThruText())  

### setStrokeCap

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

```
public void setStrokeCap (Paint.Cap cap)
```

Set the paint's Cap.

<br />

|                                                       Parameters                                                       ||
|-------|-----------------------------------------------------------------------------------------------------------------|
| `cap` | `Paint.Cap`: set the paint's line cap style, used whenever the paint's style is Stroke or StrokeAndFill. <br /> |

### setStrokeJoin

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

```
public void setStrokeJoin (Paint.Join join)
```

Set the paint's Join.

<br />

|                                                   Parameters                                                   ||
|--------|--------------------------------------------------------------------------------------------------------|
| `join` | `Paint.Join`: set the paint's Join, used whenever the paint's style is Stroke or StrokeAndFill. <br /> |

### setStrokeMiter

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

```
public void setStrokeMiter (float miter)
```

Set the paint's stroke miter value. This is used to control the behavior of miter joins when the joins angle is sharp. This value must be \>= 0.

<br />

|                                                       Parameters                                                       ||
|---------|---------------------------------------------------------------------------------------------------------------|
| `miter` | `float`: set the miter limit on the paint, used whenever the paint's style is Stroke or StrokeAndFill. <br /> |

### setStrokeWidth

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

```
public void setStrokeWidth (float width)
```

Set the width for stroking. Pass 0 to stroke in hairline mode. Hairlines always draws a single pixel independent of the canvas's matrix.

<br />

|                                                     Parameters                                                     ||
|---------|-----------------------------------------------------------------------------------------------------------|
| `width` | `float`: set the paint's stroke width, used whenever the paint's style is Stroke or StrokeAndFill. <br /> |

### setStyle

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

```
public void setStyle (Paint.Style style)
```

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

<br />

|                            Parameters                            ||
|---------|---------------------------------------------------------|
| `style` | `Paint.Style`: The new style to set in the paint <br /> |

### setSubpixelText

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

```
public void setSubpixelText (boolean subpixelText)
```

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

<br />

|                                                 Parameters                                                  ||
|----------------|---------------------------------------------------------------------------------------------|
| `subpixelText` | `boolean`: true to set the subpixelText bit in the paint's flags, false to clear it. <br /> |

### setTextAlign

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

```
public void setTextAlign (Paint.Align align)
```

Set the paint's text alignment. This controls how the text is positioned relative to its origin. LEFT align means that all of the text will be drawn to the right of its origin (i.e. the origin specifies the LEFT edge of the text) and so on.

<br />

|                                  Parameters                                  ||
|---------|---------------------------------------------------------------------|
| `align` | `Paint.Align`: set the paint's Align value for drawing text. <br /> |

### setTextLocale

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

```
public void setTextLocale (Locale locale)
```

Set the text locale list to a one-member list consisting of just the locale. See[setTextLocales(android.os.LocaleList)](https://developer.android.com/reference/android/graphics/Paint#setTextLocales(android.os.LocaleList))for how the locale list affects the way the text is drawn for some languages.

<br />

|                                       Parameters                                        ||
|----------|-------------------------------------------------------------------------------|
| `locale` | `Locale`: the paint's locale value for drawing text, must not be null. <br /> |

### setTextLocales

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

```
public void setTextLocales (LocaleList locales)
```

Set the text locale list. The text locale list affects how the text is drawn for some languages. For example, if the locale list contains[Locale.CHINESE](https://developer.android.com/reference/java/util/Locale#CHINESE)or[Locale.CHINA](https://developer.android.com/reference/java/util/Locale#CHINA), then the text renderer will prefer to draw text using a Chinese font. Likewise, if the locale list contains[Locale.JAPANESE](https://developer.android.com/reference/java/util/Locale#JAPANESE)or[Locale.JAPAN](https://developer.android.com/reference/java/util/Locale#JAPAN), then the text renderer will prefer to draw text using a Japanese font. If the locale list contains both, the order those locales appear in the list is considered for deciding the font. This distinction is important because Chinese and Japanese text both use many of the same Unicode code points but their appearance is subtly different for each language. By default, the text locale list is initialized to a one-member list just containing the system locales. This assumes that the text to be rendered will most likely be in the user's preferred language. If the actual language or languages of the text is/are known, then they can be provided to the text renderer using this method. The text renderer may attempt to guess the language script based on the contents of the text to be drawn independent of the text locale here. Specifying the text locales just helps it do a better job in certain ambiguous cases.

<br />

|                                              Parameters                                              ||
|-----------|-------------------------------------------------------------------------------------------|
| `locales` | `LocaleList`: the paint's locale list for drawing text, must not be null or empty. <br /> |

### setTextScaleX

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

```
public void setTextScaleX (float scaleX)
```

Set the paint's horizontal scale factor for text. The default value is 1.0. Values \> 1.0 will stretch the text wider. Values \< 1.0 will stretch the text narrower.

<br />

|                                    Parameters                                    ||
|----------|------------------------------------------------------------------------|
| `scaleX` | `float`: set the paint's scale in X for drawing/measuring text. <br /> |

### setTextSize

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

```
public void setTextSize (float textSize)
```

Set the paint's text size. This value must be \> 0

<br />

|                              Parameters                               ||
|------------|-----------------------------------------------------------|
| `textSize` | `float`: set the paint's text size in pixel units. <br /> |

### setTextSkewX

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

```
public void setTextSkewX (float skewX)
```

Set the paint's horizontal skew factor for text. The default value is 0. For approximating oblique text, use values around -0.25.

<br />

|                                 Parameters                                  ||
|---------|--------------------------------------------------------------------|
| `skewX` | `float`: set the paint's skew factor in X for drawing text. <br /> |

### setTypeface

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

```
public Typeface setTypeface (Typeface typeface)
```

Set or clear the typeface object.

<br />

Pass null to clear any previous typeface. As a convenience, the parameter passed is also returned.

<br />

<br />

|                                      Parameters                                       ||
|------------|---------------------------------------------------------------------------|
| `typeface` | `Typeface`: May be null. The typeface to be installed in the paint <br /> |

|                                            Returns                                             ||
|-------------------------------------------------------------------------------|-----------------|
| [Typeface](https://developer.android.com/reference/android/graphics/Typeface) | typeface <br /> |

### setUnderlineText

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

```
public void setUnderlineText (boolean underlineText)
```

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

<br />

|                                                  Parameters                                                   ||
|-----------------|----------------------------------------------------------------------------------------------|
| `underlineText` | `boolean`: true to set the underlineText bit in the paint's flags, false to clear it. <br /> |

**See also:**

- [isUnderlineText()](https://developer.android.com/reference/android/graphics/Paint#isUnderlineText())
- [getUnderlinePosition()](https://developer.android.com/reference/android/graphics/Paint#getUnderlinePosition())
- [getUnderlineThickness()](https://developer.android.com/reference/android/graphics/Paint#getUnderlineThickness())  

### setWordSpacing

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

```
public void setWordSpacing (float wordSpacing)
```

Set the paint's extra word-spacing for text. Increases the white space width between words with the given amount of pixels. The default value is 0.

<br />

|                                                            Parameters                                                             ||
|---------------|--------------------------------------------------------------------------------------------------------------------|
| `wordSpacing` | `float`: set the paint's extra word-spacing for drawing text in pixels. The units of this value are pixels. <br /> |

**See also:**

- [getWordSpacing()](https://developer.android.com/reference/android/graphics/Paint#getWordSpacing())  

### setXfermode

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

```
public Xfermode setXfermode (Xfermode xfermode)
```

Set or clear the transfer mode object. A transfer mode defines how source pixels (generate by a drawing command) are composited with the destination pixels (content of the render target).

<br />

Pass null to clear any previous transfer mode. As a convenience, the parameter passed is also returned.

<br />

[PorterDuffXfermode](https://developer.android.com/reference/android/graphics/PorterDuffXfermode)is the most common transfer mode.

<br />

<br />

|                                      Parameters                                       ||
|------------|---------------------------------------------------------------------------|
| `xfermode` | `Xfermode`: May be null. The xfermode to be installed in the paint <br /> |

|                                            Returns                                             ||
|-------------------------------------------------------------------------------|-----------------|
| [Xfermode](https://developer.android.com/reference/android/graphics/Xfermode) | xfermode <br /> |