Version: Unity 6.7 Beta (6000.7)
LanguageEnglish
  • C#

FontAsset.TryGetGlyphMetrics

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public bool TryGetGlyphMetrics(uint glyphIndex, out GlyphMetrics metrics);

Parameters

Parameter Description
glyphIndex The index of the glyph in the font asset's source font.
metrics The metrics of the glyph, or default if the font has no glyph at that index.

Returns

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

Description

Tries to get the metrics of the glyph at the given glyph index.

Metrics are expressed in pixels at the font asset's FontAsset.faceInfo point size. To get values for another font size, multiply them by that size divided by FaceInfo.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.