CreateFontAsset
Creates a new font asset instance from the given family name and style.
Read time 2 minutesLast updated 13 days ago
Definition
- Type: Method
- Namespace: UnityEngine.TextCore.Text
- Assembly: UnityEngine.TextCoreTextEngineModule
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
Returns
Type | Description |
|---|---|
| FontAsset | An 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
The family name of the source font.
The style name of the source font face.
The desired point size.
The font padding.
The glyph render mode (ie. sdf vs. bitmap).
Returns
Type | Description |
|---|---|
| FontAsset | An 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
The file path of the font file.
The index of font face.
The sampling point size.
The padding between individual glyphs in the font atlas texture.
The atlas render mode.
The atlas texture width.
The atlas texture height.
Returns
Type | Description |
|---|---|
| FontAsset | An 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
The source font object.
Returns
Type | Description |
|---|---|
| FontAsset | An 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
The source font object.
The sampling point size.
The padding between individual glyphs in the font atlas texture.
The atlas render mode.
The atlas texture width.
The atlas texture height.
The atlas population mode.
Enable multi atlas texture.
Returns
Type | Description |
|---|---|
| FontAsset | An instance of the newly created font asset. |