Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


TryGetGlyphMetrics(uint, out GlyphMetrics)

Tries to get the metrics of the glyph at the given glyph index.
Read time 1 minuteLast updated 12 days ago

Definition

TryGetGlyphMetrics(uint, GlyphMetrics)

public bool TryGetGlyphMetrics(uint glyphIndex, out GlyphMetrics metrics)

Parameters

glyphIndex

The index of the glyph in the font asset's source font.

The metrics of the glyph, or default if the font has no glyph at that index.

Returns

Type

Description

boolReturns true if the font has a glyph at the given index. Otherwise, returns false.

Remarks

Metrics are expressed in pixels at the font asset's _faceInfo point size. To get values for another font size, multiply them by that size divided by _pointSize. Glyphs without a visual representation, such as spaces, have zero width and height but a valid horizontal advance. This query reads the font data directly and doesn't add the glyph to the atlas.