Class FontAssetBuilder
- Namespace
- CustomFont
- Assembly
- CustomFont.dll
A builder class to create font asset.
public class FontAssetBuilder
- Inheritance
-
FontAssetBuilder
- Inherited Members
Constructors
FontAssetBuilder(Font)
public FontAssetBuilder(Font font)
Parameters
fontFontThe source font to create font asset from.
Properties
AtlasHeight
A parameter directly passed to FontAsset.CreateFontAsset().
Default: 1024
public int AtlasHeight { get; set; }
Property Value
AtlasPadding
A parameter directly passed to FontAsset.CreateFontAsset().
Default: 9
public int AtlasPadding { get; set; }
Property Value
AtlasWidth
A parameter directly passed to FontAsset.CreateFontAsset().
Default: 1024
public int AtlasWidth { get; set; }
Property Value
CharList
The characters to be included in the font asset. If this is empty, all characters are included.
public ISet<uint> CharList { get; set; }
Property Value
FaceIndex
A parameter directly passed to FontAsset.CreateFontAsset().
Default: 0
public int FaceIndex { get; set; }
Property Value
Font
The source font to create font asset from.
public Font Font { get; set; }
Property Value
RenderMode
A parameter directly passed to FontAsset.CreateFontAsset().
Default: GlyphRenderMode.SDFAA
public GlyphRenderMode RenderMode { get; set; }
Property Value
SamplingPointSize
A parameter directly passed to FontAsset.CreateFontAsset().
Default: 90
public int SamplingPointSize { get; set; }
Property Value
Methods
AddChars(ISet<uint>)
Add unicode code points to font asset. It's caller's responsibility to ensure the code points are valid.
public FontAssetBuilder AddChars(ISet<uint> unicodes)
Parameters
Returns
- FontAssetBuilder
The FontAssetBuilder that calls this method
AddChars(string)
Add a sequence of characters to font asset. If there are duplicate characters, only one of them is added.
public FontAssetBuilder AddChars(string chars)
Parameters
charsstringThe sequence of characters to add
Returns
- FontAssetBuilder
The FontAssetBuilder that calls this method
AddChars(uint, uint)
Add range of unicode code points to font asset (inclusive-inclusive). It's caller's responsibility to ensure the range does not include invalid code points.
public FontAssetBuilder AddChars(uint start, uint end)
Parameters
Returns
- FontAssetBuilder
The FontAssetBuilder that calls this method
Exceptions
- ArgumentException
startis greater than or equal toend
Create()
Create font asset with the properties.
public TMP_FontAsset Create()
Returns
- TMP_FontAsset
Exceptions
- CustomFontException
Failed to create font asset