Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


Font

Script interface for font assets.
Read time 4 minutesLast updated 4 days ago

Definition

  • Type: Class
  • Namespace: UnityEngine
  • Assembly: UnityEngine.TextRenderingModule
  • Inherits from: Object
public sealed class Font : Object

Remarks

You can use this class to dynamically switch fonts on Text Meshes.
Additional Resources: TextMesh.

Constructors

Constructor

Description

Font()Create a new Font.
Font(System.String)Create a new Font.

Properties

Property

Description

ascentThe ascent of the font.
characterInfoAccess an array of all characters contained in the font texture.
dynamicIs the font a dynamic font.
fontSizeThe default size of the font.
lineHeightThe line height of the font.
materialThe material used for the font display.

Methods

Method

Description

GetCharacterInfoGet rendering info for a specific character.
HasCharacterDoes this font have a specific character?
RequestCharactersInTextureRequest characters to be added to the font texture (dynamic fonts only).

Static Methods

Method

Description

CreateDynamicFontFromOSFontCreates a Font object which lets you render a font installed on the user machine.
GetMaxVertsForStringReturns the maximum number of verts that the text generator may return for a given string.
GetOSInstalledFontNamesGet names of fonts installed on the machine.
GetPathsToOSFontsGets the file paths of the fonts that are installed on the operating system.

Static Events

Member

Description

textureRebuiltSet a function to be called when the dynamic font texture is rebuilt.

Inheritance

Inherited Members

Operators

Operator

Description

operator ==Compares two object references to see if they refer to the same object.
boolDetermines whether the object exists.
operator !=Compares if two objects refer to a different object.