Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


CreateFontAsset

Creates a new font asset instance from the given family name and style.
Read time 2 minutesLast updated 13 days ago

Definition

CreateFontAsset(string, string, int)

Creates a new font asset instance from the given family name and style.
public static FontAsset CreateFontAsset(string familyName, string styleName, int pointSize = 90)

Parameters

familyName

The family name of the source font.

styleName

The style name of the source font face.

pointSize

Optional point size.

Returns

Type

Description

FontAssetAn instance of the newly created font asset.

CreateFontAsset(string, string, int, int, GlyphRenderMode)

Creates a new font asset instance from the given family name, style, point size, padding and render mode.
public static FontAsset? CreateFontAsset(string familyName, string styleName, int pointSize, int padding, GlyphRenderMode renderMode)

Parameters

familyName

The family name of the source font.

styleName

The style name of the source font face.

pointSize

The desired point size.

padding

The font padding.

renderMode

The glyph render mode (ie. sdf vs. bitmap).

Returns

Type

Description

FontAssetAn instance of the newly created font asset.

CreateFontAsset(string, int, int, int, GlyphRenderMode, int, int)

Creates a new font asset instance from the font file at the given file path.
public static FontAsset CreateFontAsset(string fontFilePath, int faceIndex, int samplingPointSize, int atlasPadding, GlyphRenderMode renderMode, int atlasWidth, int atlasHeight)

Parameters

fontFilePath

The file path of the font file.

faceIndex

The index of font face.

samplingPointSize

The sampling point size.

atlasPadding

The padding between individual glyphs in the font atlas texture.

renderMode

The atlas render mode.

atlasWidth

The atlas texture width.

atlasHeight

The atlas texture height.

Returns

Type

Description

FontAssetAn instance of the newly created font asset.

CreateFontAsset(Font)

Creates a new font asset instance from the provided font object.
public static FontAsset CreateFontAsset(Font font)

Parameters

font

The source font object.

Returns

Type

Description

FontAssetAn instance of the newly created font asset.

CreateFontAsset(Font, int, int, GlyphRenderMode, int, int, AtlasPopulationMode, bool)

Creates a new font asset instance from the provided font object.
public static FontAsset CreateFontAsset(Font font, int samplingPointSize, int atlasPadding, GlyphRenderMode renderMode, int atlasWidth, int atlasHeight, AtlasPopulationMode atlasPopulationMode = AtlasPopulationMode.Dynamic, bool enableMultiAtlasSupport = true)

Parameters

font

The source font object.

samplingPointSize

The sampling point size.

atlasPadding

The padding between individual glyphs in the font atlas texture.

renderMode

The atlas render mode.

atlasWidth

The atlas texture width.

atlasHeight

The atlas texture height.

atlasPopulationMode

The atlas population mode.

enableMultiAtlasSupport

Enable multi atlas texture.

Returns

Type

Description

FontAssetAn instance of the newly created font asset.