Font

class Font : Managed

Constructors

Link copied to clipboard
constructor()

Returns Font initialized with default values

constructor(typeface: Typeface?)

Returns Font with Typeface and default size

constructor(typeface: Typeface?, size: Float)
constructor(typeface: Typeface?, size: Float, scaleX: Float, skewX: Float)

Constructs Font with default values with Typeface and size in points, horizontal scale, and horizontal skew. Horizontal scale emulates condensed and expanded fonts. Horizontal skew emulates oblique fonts.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Whether edge pixels draw opaque or with partial transparency.

Link copied to clipboard
Link copied to clipboard

If true, instructs the font manager to always hint glyphs. Returned value is only meaningful if platform uses FreeType as the font manager.

Link copied to clipboard

Returns true if baselines will be snapped to pixel positions when the current transformation matrix is axis aligned.

Link copied to clipboard
expect open val isClosed: Boolean

Check if underlying resource is closed.

Link copied to clipboard

Returns true if bold is approximated by increasing the stroke width when creating glyph bitmaps from outlines.

Link copied to clipboard
Link copied to clipboard

Returns FontMetrics associated with Typeface. Results are scaled by text size but does not take into account dimensions required by text scale, text skew, fake bold, style stroke, and PathEffect.

Link copied to clipboard
Link copied to clipboard
var size: Float
Link copied to clipboard
Link copied to clipboard

Returns the recommended spacing between lines: the sum of metrics descent, ascent, and leading. Result is scaled by text size but does not take into account dimensions required by stroking and SkPathEffect.

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
expect open fun close()

Free underlying native resource, peer is useless afterwards.

Link copied to clipboard
fun getBounds(glyphs: ShortArray?): Array<Rect>
fun getBounds(glyphs: ShortArray?, p: Paint?): Array<Rect>

Retrieves the bounds for each glyph

Link copied to clipboard
fun getPath(glyph: Short): Path?

If the glyph has an outline, returns it. The glyph outline may be empty. Degenerate contours in the glyph outline will be skipped. If glyph is described by a bitmap, returns null.

Link copied to clipboard
fun getPaths(glyphs: ShortArray?): Array<Path>

Return glyph outlines, some of which might be null.

Link copied to clipboard

Retrieves the positions for each glyph.

fun getPositions(glyphs: ShortArray?, offset: Point): Array<Point>

Retrieves the positions for each glyph, beginning at the specified origin.

Link copied to clipboard

Converts text into glyph indices.

Link copied to clipboard
Link copied to clipboard
fun getUTF32Glyph(unichar: Int): Short
Link copied to clipboard

Given an array of UTF32 character codes, return their corresponding glyph IDs.

Link copied to clipboard

Retrieves the advances for each glyph

Link copied to clipboard
fun getXPositions(glyphs: ShortArray?, offset: Float): FloatArray

Retrieves the x-positions for each glyph, beginning at the specified origin.

Link copied to clipboard
fun makeWithSize(size: Float): Font

Returns a font with the same attributes of this font, but with the specified size.

Link copied to clipboard
fun measureText(s: String?, p: Paint? = null): Rect
Link copied to clipboard
Link copied to clipboard

If true, requests, but does not require, to use bitmaps in fonts instead of outlines.

Link copied to clipboard
fun setTypeface(typeface: Typeface?): Font

Sets Typeface to typeface. Pass null to use the default typeface.

Link copied to clipboard
expect open override fun toString(): String