Font3D
[PreferBinarySerialization][CreateAssetMenu(fileName = "New 3D Font", menuName = "Text Studio/3D/Appearance/Font", order = 103)]public class Font3D : ScriptableObjectFont ScriptableObject for Text Studio — 3D. Stores prebuilt character meshes and/or raw TTF bytes for runtime generation. Adopted from TGS pattern with [PreferBinarySerialization] for font byte efficiency.
Methods
Section titled “Methods”
GetFontBytesSnapshot()
Section titled “GetFontBytesSnapshot()”public byte[] GetFontBytesSnapshot()Returns a detached caller-owned copy of the embedded font data.
Returns
System.Byte[]
TryGetCharacter(char, out Character3D)
Section titled “TryGetCharacter(char, out Character3D)”public bool TryGetCharacter(char c, out Character3D character)Tries to resolve prepared outline and metric data for a UTF-16 character from this font asset.
Parameters
| Name | Type |
|---|---|
c |
System.Char |
character |
TextStudio.ThreeD.Character3D |
Returns
System.Boolean
ConvertSpacing(float)
Section titled “ConvertSpacing(float)”public float ConvertSpacing(float rawSpacing)Convert raw font spacing to game units. Formula: (rawSpacing * characterSpacing) / (unitPerEM * 8)
Parameters
| Name | Type |
|---|---|
rawSpacing |
System.Single |
Returns
System.Single
GetKerningOffset(char, char)
Section titled “GetKerningOffset(char, char)”public float GetKerningOffset(char left, char right)O(1) kerning offset lookup for a character pair. Serialized pairs take priority;
falls back to the live provider (e.g. TTF kern table) when one is attached.
Parameters
| Name | Type |
|---|---|
left |
System.Char |
right |
System.Char |
Returns
System.Single
SetLiveKerningSource(LiveKerningLookup)
Section titled “SetLiveKerningSource(LiveKerningLookup)”public void SetLiveKerningSource(Font3D.LiveKerningLookup source)Install a runtime kerning source. Typically invoked by TextStudio3DText
once the TTF outline provider is built, so TextStudio.ThreeD.Font3D.GetKerningOffset(System.Char%2cSystem.Char) can
pull pairs from the font’s kern table without baking them into
TextStudio.ThreeD.Font3D._kerningPairs. Pass null to detach.
Parameters
| Name | Type |
|---|---|
source |
TextStudio.ThreeD.Font3D.LiveKerningLookup |
Constructors
Section titled “Constructors”
Font3D()
Section titled “Font3D()”public Font3D()Properties
Section titled “Properties”
Characters
Section titled “Characters”public IReadOnlyList<Character3D> Characters { get; }Returns
System.Collections.Generic.IReadOnlyList{TextStudio.ThreeD.Character3D}
FontData
Section titled “FontData”public TextStudioReadOnlyBuffer<byte> FontData { get; }Read-only view over embedded font data. The view remains valid until the asset is prepared again.
Returns
TextStudio.TextStudioReadOnlyBuffer{System.Byte}
FontByteCount
Section titled “FontByteCount”public int FontByteCount { get; }Number of embedded font-data bytes.
Returns
System.Int32
CharacterSpacing
Section titled “CharacterSpacing”public float CharacterSpacing { get; }Returns
System.Single
EmptySpaceSpacing
Section titled “EmptySpaceSpacing”public float EmptySpaceSpacing { get; }Returns
System.Single
MonoSpaceFont
Section titled “MonoSpaceFont”public bool MonoSpaceFont { get; }Returns
System.Boolean
MonoSpaceSpacing
Section titled “MonoSpaceSpacing”public float MonoSpaceSpacing { get; }Returns
System.Single
EnableKerning
Section titled “EnableKerning”public bool EnableKerning { get; }Returns
System.Boolean
KerningMultiplier
Section titled “KerningMultiplier”public float KerningMultiplier { get; }Returns
System.Single
KerningPairs
Section titled “KerningPairs”public IReadOnlyList<KerningPair> KerningPairs { get; }Returns
System.Collections.Generic.IReadOnlyList{TextStudio.ThreeD.KerningPair}
UnitPerEM
Section titled “UnitPerEM”public int UnitPerEM { get; }Returns
System.Int32
LineHeight
Section titled “LineHeight”public float LineHeight { get; }Returns
System.Single
SizeXY
Section titled “SizeXY”public float SizeXY { get; }Returns
System.Single
public float SizeZ { get; }Returns
System.Single
VertexDensity
Section titled “VertexDensity”public float VertexDensity { get; }Returns
System.Single
AutoSmoothAngle
Section titled “AutoSmoothAngle”public float AutoSmoothAngle { get; }Returns
System.Single
FallbackFonts
Section titled “FallbackFonts”public IReadOnlyList<Font3D> FallbackFonts { get; }Returns
System.Collections.Generic.IReadOnlyList{TextStudio.ThreeD.Font3D}