Legacy Documentation: Version 2018.1 (Go to current version)
LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

Font.GetCharacterInfo

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

Switch to Manual
public method GetCharacterInfo(ch: char, out info: characterInfo, size: int = 0, style: FontStyle = FontStyle.Normal): bool;
public bool GetCharacterInfo(char ch, out characterInfo info, int size = 0, FontStyle style = FontStyle.Normal);

Parameters

chThe character you need rendering information for.
infoReturns the CharacterInfo struct with the rendering information for the character (if available).
sizeThe size of the character (default value of zero will use font default size).
styleThe style of the character.

Description

Get rendering info for a specific character.

Note: You should only ever need to use this when you want to implement your own text rendering. If the character ch with the specified size and style is present in the font texture, then this method will return true, and info will contain the texture placement information for that character. If the character is not present, this method returns false. If size is zero, it will use the default size for the font.

See Also: characterInfo. Example at RequestCharactersInTexture.

Did you find this page useful? Please give it a rating: