Scripting API

Font

class in UnityEngine · UnityEngine.TextRenderingModule · inherits from Object

16 of 16 of Unity's membersUnity's documentation
In Tassix

A dynamic font: glyphs are rasterized on request, at the sizes and styles text asks for, into one texture (grown and rebuilt when full, which raises textureRebuilt). Metrics are in whole pixels, as Unity's are: advances, ascent, descent and line gap each rounded at the requested size. Bold is synthesized by widening the glyph's strokes; italic is a slant applied by the text generator.

Constructors 1

Font()
Font(string name)

An OS font by name; Tassix has no OS fonts yet, so this is the built-in font.

Properties 7

int ascent { get; }
CharacterInfo[] characterInfo { get; set; }
bool dynamic { get; }
string[] fontNames { get; set; }
int fontSize { get; }

The size the font was imported at.

int lineHeight { get; }
Material material { get; set; }

The material text draws with: GUI/Text Shader on this font's glyph texture.

Methods 7

static Font CreateDynamicFontFromOSFont(string fontname, int size)
static Font CreateDynamicFontFromOSFont(string[] fontnames, int size)

An installed font by family name; the built-in font when it isn't installed.

The first of the families that's installed; the built-in font when none is.

bool GetCharacterInfo(char ch, out CharacterInfo info)
bool GetCharacterInfo(char ch, out CharacterInfo info, int size)
bool GetCharacterInfo(char ch, out CharacterInfo info, int size, FontStyle style)

Only characters already requested at this size and style are found, as in Unity.

int GetMaxVertsForString(string str)
static string[] GetOSInstalledFontNames()

The installed fonts' family names.

static string[] GetPathsToOSFonts()

The installed font files.

bool HasCharacter(char c)
bool HasCharacter(int c)
void RequestCharactersInTexture(string characters)
void RequestCharactersInTexture(string characters, int size)
void RequestCharactersInTexture(string characters, int size, FontStyle style)

Events 1

static event Action<Font>? textureRebuilt