Stay organized with collections
Save and categorize content based on your preferences.
FontMetrics
open class FontMetrics
Class that describes the various metrics for a font at a given text size. Remember, Y values increase going down, so those values will be positive, and values that measure distances going up will be negative. This class is returned by getFontMetrics().
Summary
Properties |
Float |
The recommended distance above the baseline for singled spaced text.
|
Float |
The maximum distance below the baseline for the lowest glyph in the font at a given text size.
|
Float |
The recommended distance below the baseline for singled spaced text.
|
Float |
The recommended additional space to add between lines of text.
|
Float |
The maximum distance above the baseline for the tallest glyph in the font at a given text size.
|
Public constructors
FontMetrics
FontMetrics()
Public methods
equals
open fun equals(other: Any?): Boolean
Parameters |
obj |
the reference object with which to compare. |
Return |
Boolean |
true if this object is the same as the obj argument; false otherwise. |
hashCode
open fun hashCode(): Int
Return |
Int |
a hash code value for this object. |
toString
open fun toString(): String
Return |
String |
a string representation of the object. |
Properties
ascent
var ascent: Float
The recommended distance above the baseline for singled spaced text.
bottom
var bottom: Float
The maximum distance below the baseline for the lowest glyph in the font at a given text size.
descent
var descent: Float
The recommended distance below the baseline for singled spaced text.
leading
var leading: Float
The recommended additional space to add between lines of text.
top
var top: Float
The maximum distance above the baseline for the tallest glyph in the font at a given text size.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# Paint.FontMetrics\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nFontMetrics\n===========\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/graphics/Paint.FontMetrics \"View this page in Java\") \n\n```\nopen class FontMetrics\n```\n\n|---|-----------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.graphics.Paint.FontMetrics](#) |\n\nClass that describes the various metrics for a font at a given text size. Remember, Y values increase going down, so those values will be positive, and values that measure distances going up will be negative. This class is returned by getFontMetrics().\n\nSummary\n-------\n\n| Public constructors ||\n|------------------------------------------|---|\n| [FontMetrics](#FontMetrics())`()` \u003cbr /\u003e |\n\n| Public methods ||\n|-----------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------|\n| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [equals](#equals(kotlin.Any))`(`other:` `[Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)?`)` \u003cbr /\u003e |\n| open [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [hashCode](#hashCode())`()` \u003cbr /\u003e |\n| open [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [toString](#toString())`()` \u003cbr /\u003e |\n\n| Properties ||\n|--------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------|\n| [Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html) | [ascent](#ascent:kotlin.Float) The recommended distance above the baseline for singled spaced text. |\n| [Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html) | [bottom](#bottom:kotlin.Float) The maximum distance below the baseline for the lowest glyph in the font at a given text size. |\n| [Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html) | [descent](#descent:kotlin.Float) The recommended distance below the baseline for singled spaced text. |\n| [Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html) | [leading](#leading:kotlin.Float) The recommended additional space to add between lines of text. |\n| [Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html) | [top](#top:kotlin.Float) The maximum distance above the baseline for the tallest glyph in the font at a given text size. |\n\nPublic constructors\n-------------------\n\n### FontMetrics\n\n```\nFontMetrics()\n```\n\nPublic methods\n--------------\n\n### equals\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun equals(other: Any?): Boolean\n```\n\n| Parameters ||\n|-------|---------------------------------------------|\n| `obj` | the reference object with which to compare. |\n\n| Return ||\n|------------------------------------------------------------------------------------|---------------------------------------------------------------------------|\n| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `true` if this object is the same as the obj argument; `false` otherwise. |\n\n### hashCode\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun hashCode(): Int\n```\n\n| Return ||\n|----------------------------------------------------------------------------|------------------------------------|\n| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | a hash code value for this object. |\n\n### toString\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun toString(): String\n```\n\n| Return ||\n|----------------------------------------------------------------------------------|----------------------------------------|\n| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | a string representation of the object. |\n\nProperties\n----------\n\n### ascent\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nvar ascent: Float\n```\n\nThe recommended distance above the baseline for singled spaced text. \n\n### bottom\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nvar bottom: Float\n```\n\nThe maximum distance below the baseline for the lowest glyph in the font at a given text size. \n\n### descent\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nvar descent: Float\n```\n\nThe recommended distance below the baseline for singled spaced text. \n\n### leading\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nvar leading: Float\n```\n\nThe recommended additional space to add between lines of text. \n\n### top\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nvar top: Float\n```\n\nThe maximum distance above the baseline for the tallest glyph in the font at a given text size."]]