Skip to content

Font3D

ClassTextStudio.ThreeDTextStudio.3D
[PreferBinarySerialization]
[CreateAssetMenu(fileName = "New 3D Font", menuName = "Text Studio/3D/Appearance/Font", order = 103)]
public class Font3D : ScriptableObject

Font 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.

public byte[] GetFontBytesSnapshot()

Returns a detached caller-owned copy of the embedded font data.

Returns

System.Byte[]

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

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

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

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

public Font3D()

public IReadOnlyList<Character3D> Characters { get; }

Returns

System.Collections.Generic.IReadOnlyList{TextStudio.ThreeD.Character3D}

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}

public int FontByteCount { get; }

Number of embedded font-data bytes.

Returns

System.Int32

public float CharacterSpacing { get; }

Returns

System.Single

public float EmptySpaceSpacing { get; }

Returns

System.Single

public bool MonoSpaceFont { get; }

Returns

System.Boolean

public float MonoSpaceSpacing { get; }

Returns

System.Single

public bool EnableKerning { get; }

Returns

System.Boolean

public float KerningMultiplier { get; }

Returns

System.Single

public IReadOnlyList<KerningPair> KerningPairs { get; }

Returns

System.Collections.Generic.IReadOnlyList{TextStudio.ThreeD.KerningPair}

public int UnitPerEM { get; }

Returns

System.Int32

public float LineHeight { get; }

Returns

System.Single

public float SizeXY { get; }

Returns

System.Single

public float SizeZ { get; }

Returns

System.Single

public float VertexDensity { get; }

Returns

System.Single

public float AutoSmoothAngle { get; }

Returns

System.Single

public IReadOnlyList<Font3D> FallbackFonts { get; }

Returns

System.Collections.Generic.IReadOnlyList{TextStudio.ThreeD.Font3D}