Class FontUtil
Centralized font loading and management utility for the Scylla framework.
Provides a single source of truth for font access, supporting both Unity's built-in
UnityEngine.Font (TTF) and TextMesh Pro's TMPro.TMP_FontAsset (SDF)
formats. Uses lazy per-name dictionaries to cache loaded assets so that repeated
calls to any Load* method never trigger a redundant Load<T>(string)
call.
Inherited Members
Namespace: Scylla.Core.Util
Assembly: ScyllaCore.dll
Syntax
public static class FontUtil
Remarks
The Scylla monospace font ships in two families: ScyllaMono (standard width) and
ScyllaMono-Cond (condensed). The standard-width family is the framework default. Both are
stored under Resources/Fonts/TTF/ for TTF assets and Resources/Fonts/SDF/
for TMP SDF assets, in three weights mapped via FontVariant. The
LoadDefaultMono methods select the family via a condensed flag and, when a
requested weight is not found on disk, can walk a fallback chain toward
Regular.
Character extraction methods (GetSupportedCharacters(Font, UnicodeRange[]) and GetSupportedCharacters(TMP_FontAsset)) also use their own caches keyed by font instance ID and Unicode range hash, so expensive glyph-table scans are never repeated for the same font and range combination.
DPI-based text scaling (GetDPITextScale()) is computed once and cached for the session. It uses a fifth-root curve relative to a 24" 1080p reference monitor to boost readability on physically small high-DPI screens.
Editor-only methods (LoadFromAssetPath, LoadSDFFromAssetPath,
GetDefaultMonoAssetPath, GetDefaultMonoSDFAssetPath) load assets
outside the Resources folder through LoadAssetAtPath<T>(string),
and the loaders return null in a player build.
Fields
DPI_TEXT_SCALE_MAX
Maximum value returned by GetDPITextScale().
Declaration
public const float DPI_TEXT_SCALE_MAX = 2
Field Value
| Type | Description |
|---|---|
| float |
DPI_TEXT_SCALE_MIN
Minimum value returned by GetDPITextScale().
Declaration
public const float DPI_TEXT_SCALE_MIN = 1
Field Value
| Type | Description |
|---|---|
| float |
FALLBACK_SCREEN_DPI
Default screen DPI assumed when UnityEngine.Screen.dpi returns 0 (unknown).
Declaration
public const float FALLBACK_SCREEN_DPI = 96
Field Value
| Type | Description |
|---|---|
| float |
FONT_FOLDER
Base fonts folder name under Resources.
Declaration
public const string FONT_FOLDER = "Fonts"
Field Value
| Type | Description |
|---|---|
| string |
FONT_SCYLLA_DEFAULT_MONO_NAME
Scylla default monospace TTF font name (standard-width Regular).
Declaration
public const string FONT_SCYLLA_DEFAULT_MONO_NAME = "ScyllaMono-Regular"
Field Value
| Type | Description |
|---|---|
| string |
FONT_SCYLLA_DEFAULT_MONO_SDF_NAME
Scylla default monospace TMP SDF font asset name (standard-width Regular SDF).
Declaration
public const string FONT_SCYLLA_DEFAULT_MONO_SDF_NAME = "ScyllaMono-Regular SDF"
Field Value
| Type | Description |
|---|---|
| string |
FONT_SCYLLA_MONO_BASE
Base name for the condensed Scylla monospace font family (ScyllaMono-Cond).
Declaration
public const string FONT_SCYLLA_MONO_BASE = "ScyllaMono-Cond"
Field Value
| Type | Description |
|---|---|
| string |
FONT_SCYLLA_MONO_BOLD
Condensed monospace Bold (ExtraBold) TTF font name.
Declaration
public const string FONT_SCYLLA_MONO_BOLD = "ScyllaMono-Cond-ExtraBold"
Field Value
| Type | Description |
|---|---|
| string |
FONT_SCYLLA_MONO_BOLD_SDF
Condensed monospace Bold (ExtraBold) SDF font asset name.
Declaration
public const string FONT_SCYLLA_MONO_BOLD_SDF = "ScyllaMono-Cond-ExtraBold SDF"
Field Value
| Type | Description |
|---|---|
| string |
FONT_SCYLLA_MONO_LIGHT
Condensed monospace Light (Thin) TTF font name.
Declaration
public const string FONT_SCYLLA_MONO_LIGHT = "ScyllaMono-Cond-Thin"
Field Value
| Type | Description |
|---|---|
| string |
FONT_SCYLLA_MONO_LIGHT_SDF
Condensed monospace Light (Thin) SDF font asset name.
Declaration
public const string FONT_SCYLLA_MONO_LIGHT_SDF = "ScyllaMono-Cond-Thin SDF"
Field Value
| Type | Description |
|---|---|
| string |
FONT_SCYLLA_MONO_REGULAR
Condensed monospace Regular TTF font name.
Declaration
public const string FONT_SCYLLA_MONO_REGULAR = "ScyllaMono-Cond-Regular"
Field Value
| Type | Description |
|---|---|
| string |
FONT_SCYLLA_MONO_REGULAR_SDF
Condensed monospace Regular SDF font asset name.
Declaration
public const string FONT_SCYLLA_MONO_REGULAR_SDF = "ScyllaMono-Cond-Regular SDF"
Field Value
| Type | Description |
|---|---|
| string |
FONT_SCYLLA_MONO_STD_BASE
Base name for the standard-width Scylla monospace font family (ScyllaMono), the framework default.
Declaration
public const string FONT_SCYLLA_MONO_STD_BASE = "ScyllaMono"
Field Value
| Type | Description |
|---|---|
| string |
FONT_SCYLLA_MONO_STD_BOLD
Standard-width monospace Bold (ExtraBold) TTF font name.
Declaration
public const string FONT_SCYLLA_MONO_STD_BOLD = "ScyllaMono-ExtraBold"
Field Value
| Type | Description |
|---|---|
| string |
FONT_SCYLLA_MONO_STD_BOLD_SDF
Standard-width monospace Bold (ExtraBold) SDF font asset name.
Declaration
public const string FONT_SCYLLA_MONO_STD_BOLD_SDF = "ScyllaMono-ExtraBold SDF"
Field Value
| Type | Description |
|---|---|
| string |
FONT_SCYLLA_MONO_STD_LIGHT
Standard-width monospace Light (Thin) TTF font name.
Declaration
public const string FONT_SCYLLA_MONO_STD_LIGHT = "ScyllaMono-Thin"
Field Value
| Type | Description |
|---|---|
| string |
FONT_SCYLLA_MONO_STD_LIGHT_SDF
Standard-width monospace Light (Thin) SDF font asset name.
Declaration
public const string FONT_SCYLLA_MONO_STD_LIGHT_SDF = "ScyllaMono-Thin SDF"
Field Value
| Type | Description |
|---|---|
| string |
FONT_SCYLLA_MONO_STD_REGULAR
Standard-width monospace Regular TTF font name.
Declaration
public const string FONT_SCYLLA_MONO_STD_REGULAR = "ScyllaMono-Regular"
Field Value
| Type | Description |
|---|---|
| string |
FONT_SCYLLA_MONO_STD_REGULAR_SDF
Standard-width monospace Regular SDF font asset name.
Declaration
public const string FONT_SCYLLA_MONO_STD_REGULAR_SDF = "ScyllaMono-Regular SDF"
Field Value
| Type | Description |
|---|---|
| string |
FONT_SCYLLA_STATS_NAME
Scylla performance-monitor stats TTF font name (ScyllaStats).
Declaration
public const string FONT_SCYLLA_STATS_NAME = "ScyllaStats"
Field Value
| Type | Description |
|---|---|
| string |
FONT_SCYLLA_STATS_SDF_NAME
Scylla performance-monitor stats SDF font asset name (ScyllaStats SDF).
Declaration
public const string FONT_SCYLLA_STATS_SDF_NAME = "ScyllaStats SDF"
Field Value
| Type | Description |
|---|---|
| string |
FONT_SDF_ASSET_PATH
Default asset path for Scylla SDF fonts folder.
Declaration
public const string FONT_SDF_ASSET_PATH = "Assets/Scylla/Framework/Core/Resources/Fonts/SDF"
Field Value
| Type | Description |
|---|---|
| string |
FONT_SDF_PATH
Full Resources path to SDF fonts folder.
Declaration
public const string FONT_SDF_PATH = "Fonts/SDF"
Field Value
| Type | Description |
|---|---|
| string |
FONT_SDF_SUBFOLDER
SDF fonts subfolder name.
Declaration
public const string FONT_SDF_SUBFOLDER = "SDF"
Field Value
| Type | Description |
|---|---|
| string |
FONT_SDF_SUFFIX
SDF font asset name suffix.
Declaration
public const string FONT_SDF_SUFFIX = " SDF"
Field Value
| Type | Description |
|---|---|
| string |
FONT_TMPRO_DEFAULT_NAME
TMPro default SDF font asset name (LiberationSans SDF).
Declaration
public const string FONT_TMPRO_DEFAULT_NAME = "LiberationSans SDF"
Field Value
| Type | Description |
|---|---|
| string |
FONT_TMPRO_DEFAULT_PATH_FALLBACK
Fallback path for TMPro default font (TMP default location).
Declaration
public const string FONT_TMPRO_DEFAULT_PATH_FALLBACK = "Fonts & Materials/LiberationSans SDF"
Field Value
| Type | Description |
|---|---|
| string |
FONT_TMPRO_DEFAULT_PATH_PRIMARY
Primary path for TMPro default font (Scylla custom location).
Declaration
public const string FONT_TMPRO_DEFAULT_PATH_PRIMARY = "Fonts/SDF/LiberationSans SDF"
Field Value
| Type | Description |
|---|---|
| string |
FONT_TTF_ASSET_PATH
Default asset path for Scylla TTF fonts folder.
Declaration
public const string FONT_TTF_ASSET_PATH = "Assets/Scylla/Framework/Core/Resources/Fonts/TTF"
Field Value
| Type | Description |
|---|---|
| string |
FONT_TTF_PATH
Full Resources path to TTF fonts folder.
Declaration
public const string FONT_TTF_PATH = "Fonts/TTF"
Field Value
| Type | Description |
|---|---|
| string |
FONT_TTF_SUBFOLDER
TTF fonts subfolder name.
Declaration
public const string FONT_TTF_SUBFOLDER = "TTF"
Field Value
| Type | Description |
|---|---|
| string |
FONT_VARIANT_BOLD
Font variant suffix for the Bold weight. Maps to the ExtraBold font asset.
Declaration
public const string FONT_VARIANT_BOLD = "-ExtraBold"
Field Value
| Type | Description |
|---|---|
| string |
FONT_VARIANT_LIGHT
Font variant suffix for the Light weight. Maps to the Thin font asset.
Declaration
public const string FONT_VARIANT_LIGHT = "-Thin"
Field Value
| Type | Description |
|---|---|
| string |
FONT_VARIANT_REGULAR
Font variant suffix for Regular weight.
Declaration
public const string FONT_VARIANT_REGULAR = "-Regular"
Field Value
| Type | Description |
|---|---|
| string |
REFERENCE_PHYSICAL_WIDTH_INCHES
Reference physical screen width in inches, based on a typical 24" 1080p monitor. Used as the baseline for DPI text scale calculations.
Declaration
public const float REFERENCE_PHYSICAL_WIDTH_INCHES = 20.9
Field Value
| Type | Description |
|---|---|
| float |
Properties
IsDefaultMonoCached
Gets whether the Scylla default monospace TTF font is currently cached.
Declaration
public static bool IsDefaultMonoCached { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsDefaultMonoSDFCached
Gets whether the Scylla default monospace TMP SDF font is currently cached.
Declaration
public static bool IsDefaultMonoSDFCached { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Methods
ClearCache()
Clears all cached fonts and character data from memory. Note: This does not unload the fonts from Unity's memory.
Declaration
public static void ClearCache()
ClearCharacterCache(TMP_FontAsset)
Clears the character cache for a specific TMP SDF font asset.
Declaration
public static void ClearCharacterCache(TMP_FontAsset font)
Parameters
| Type | Name | Description |
|---|---|---|
| TMP_FontAsset | font | The TMP SDF font asset to clear from cache. |
ClearCharacterCache(Font)
Clears the character cache for a specific TTF font.
Declaration
public static void ClearCharacterCache(Font font)
Parameters
| Type | Name | Description |
|---|---|---|
| Font | font | The TTF font to clear from cache. |
Exists(string)
Checks if a TTF font exists in the default Fonts folder.
Declaration
public static bool Exists(string fontName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | fontName | The font name without extension. |
Returns
| Type | Description |
|---|---|
| bool | True if the font exists, false otherwise. |
ExistsSDF(string)
Checks if an SDF font asset exists in the default Fonts folder.
Declaration
public static bool ExistsSDF(string fontName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | fontName | The font asset name without extension. |
Returns
| Type | Description |
|---|---|
| bool | True if the SDF font asset exists, false otherwise. |
GetAllFonts()
Gets all TTF fonts from the default Fonts/TTF folder.
Declaration
public static Font[] GetAllFonts()
Returns
| Type | Description |
|---|---|
| Font[] | Array of all available TTF fonts. |
GetAllSDFFonts()
Gets all SDF font assets from the default Fonts/SDF folder.
Declaration
public static TMP_FontAsset[] GetAllSDFFonts()
Returns
| Type | Description |
|---|---|
| TMP_FontAsset[] | Array of all available SDF font assets. |
GetDPITextScale()
Computes a text size multiplier to compensate for physically small high-DPI screens. On a typical desktop monitor (~24") the multiplier is 1.0 (no change). On smaller screens (e.g., 13" Retina MacBook) it returns a value greater than 1.0 to boost text readability. Uses a fourth-root curve for gentle scaling. The result is cached after the first call.
Declaration
public static float GetDPITextScale()
Returns
| Type | Description |
|---|---|
| float | A scale multiplier in the range [DPI_TEXT_SCALE_MIN, DPI_TEXT_SCALE_MAX]. |
GetDefaultMonoAssetPath()
Gets the full asset path for the Scylla default monospace TTF font. Editor-only method.
Declaration
public static string GetDefaultMonoAssetPath()
Returns
| Type | Description |
|---|---|
| string | The full asset path to the default monospace TTF font. |
GetDefaultMonoSDFAssetPath()
Gets the full asset path for the Scylla default monospace TMP SDF font asset. Editor-only method.
Declaration
public static string GetDefaultMonoSDFAssetPath()
Returns
| Type | Description |
|---|---|
| string | The full asset path to the default monospace TMP SDF font. |
GetSupportedCharacterCount(TMP_FontAsset)
Gets the number of supported characters in a TMP SDF font asset.
Declaration
public static int GetSupportedCharacterCount(TMP_FontAsset font)
Parameters
| Type | Name | Description |
|---|---|---|
| TMP_FontAsset | font | The TMP SDF font asset to check. |
Returns
| Type | Description |
|---|---|
| int | The number of supported characters, or 0 if font is null. |
GetSupportedCharacterCount(Font, UnicodeRange[])
Gets the number of supported characters in a TTF font within the specified Unicode ranges.
Declaration
public static int GetSupportedCharacterCount(Font font, UnicodeRange[] ranges = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Font | font | The TTF font to check. |
| UnicodeRange[] | ranges | Optional array of Unicode ranges to scan. If null or empty, uses Common. |
Returns
| Type | Description |
|---|---|
| int | The number of supported characters, or 0 if font is null. |
GetSupportedCharacters(TMP_FontAsset)
Gets all supported characters from a TMP SDF font asset. Results are cached for subsequent calls.
Declaration
public static string GetSupportedCharacters(TMP_FontAsset font)
Parameters
| Type | Name | Description |
|---|---|---|
| TMP_FontAsset | font | The TMP SDF font asset to extract characters from. |
Returns
| Type | Description |
|---|---|
| string | A string containing all supported characters, sorted by codepoint. Returns empty string if font is null. |
GetSupportedCharacters(Font, UnicodeRange[])
Gets all supported characters from a TTF font within the specified Unicode ranges. Results are cached for subsequent calls with the same font and ranges.
Declaration
public static string GetSupportedCharacters(Font font, UnicodeRange[] ranges = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Font | font | The TTF font to extract characters from. |
| UnicodeRange[] | ranges | Optional array of Unicode ranges to scan. If null or empty, uses Common. |
Returns
| Type | Description |
|---|---|
| string | A string containing all supported characters, sorted by codepoint. Returns empty string if font is null. |
GetSupportedCharactersFull(Font)
Gets all supported characters from a TTF font by scanning the full Basic Multilingual Plane (BMP). This scans approximately 65,000 codepoints and may be slow on first call. Results are cached for subsequent calls.
Declaration
public static string GetSupportedCharactersFull(Font font)
Parameters
| Type | Name | Description |
|---|---|---|
| Font | font | The TTF font to extract characters from. |
Returns
| Type | Description |
|---|---|
| string | A string containing all supported characters in the BMP, sorted by codepoint. Returns empty string if font is null. |
HasCharacter(TMP_FontAsset, char)
Checks if a TMP SDF font asset contains a specific character.
Declaration
public static bool HasCharacter(TMP_FontAsset font, char character)
Parameters
| Type | Name | Description |
|---|---|---|
| TMP_FontAsset | font | The TMP SDF font asset to check. |
| char | character | The character to check for. |
Returns
| Type | Description |
|---|---|
| bool | True if the font supports the character, false otherwise. |
HasCharacter(Font, char)
Checks if a TTF font contains a specific character.
Declaration
public static bool HasCharacter(Font font, char character)
Parameters
| Type | Name | Description |
|---|---|---|
| Font | font | The TTF font to check. |
| char | character | The character to check for. |
Returns
| Type | Description |
|---|---|
| bool | True if the font supports the character, false otherwise. |
Load(string)
Loads a TTF font by name from the default Fonts folder. The font is cached on first load for subsequent calls.
Declaration
public static Font Load(string fontName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | fontName | The font name without extension. |
Returns
| Type | Description |
|---|---|
| Font | The loaded font, or null if not found. |
LoadDefaultMono()
Loads the Scylla default monospace TTF font (standard-width Regular). The font is cached on first load for subsequent calls.
Declaration
public static Font LoadDefaultMono()
Returns
| Type | Description |
|---|---|
| Font | The default monospace font, or null if not found. |
LoadDefaultMono(FontVariant, bool, bool)
Loads a Scylla monospace TTF font weight with automatic fallback. If the requested weight is not found, attempts to load fallback weights. Fallback chain: Bold -> Regular, Light -> Regular. The family (condensed or standard) is preserved across the fallback chain.
Declaration
public static Font LoadDefaultMono(FontVariant variant, bool condensed = false, bool useFallback = true)
Parameters
| Type | Name | Description |
|---|---|---|
| FontVariant | variant | The font weight to load. |
| bool | condensed | If true, loads from the condensed family (ScyllaMono-Cond); if false (default), loads from the standard-width family (ScyllaMono). |
| bool | useFallback | If true, attempts fallback weights when the requested weight is not found. If false, returns null if the exact weight is not available. |
Returns
| Type | Description |
|---|---|
| Font | The loaded font weight, a fallback font, or null if none found. |
LoadDefaultMonoSDF()
Loads the Scylla default monospace SDF font asset (standard-width Regular SDF). The font is cached on first load for subsequent calls.
Declaration
public static TMP_FontAsset LoadDefaultMonoSDF()
Returns
| Type | Description |
|---|---|
| TMP_FontAsset | The default monospace SDF font asset, or null if not found. |
LoadDefaultMonoSDF(FontVariant, bool, bool)
Loads a Scylla monospace SDF font weight with automatic fallback. If the requested weight is not found, attempts to load fallback weights. Fallback chain: Bold -> Regular, Light -> Regular. The family (condensed or standard) is preserved across the fallback chain.
Declaration
public static TMP_FontAsset LoadDefaultMonoSDF(FontVariant variant, bool condensed = false, bool useFallback = true)
Parameters
| Type | Name | Description |
|---|---|---|
| FontVariant | variant | The font weight to load. |
| bool | condensed | If true, loads from the condensed family (ScyllaMono-Cond); if false (default), loads from the standard-width family (ScyllaMono). |
| bool | useFallback | If true, attempts fallback weights when the requested weight is not found. If false, returns null if the exact weight is not available. |
Returns
| Type | Description |
|---|---|
| TMP_FontAsset | The loaded SDF font weight, a fallback font, or null if none found. |
LoadFromAssetPath(string)
Loads a TTF font from a full asset path using AssetDatabase.
Editor-only method for loading fonts outside of Resources; returns null in a player build.
Declaration
public static Font LoadFromAssetPath(string assetPath)
Parameters
| Type | Name | Description |
|---|---|---|
| string | assetPath | The full asset path (e.g., "Assets/Fonts/MyFont.ttf"). |
Returns
| Type | Description |
|---|---|
| Font | The loaded font, or null if not found. |
LoadFromPath(string)
Loads a TTF font from a custom Resources path.
Declaration
public static Font LoadFromPath(string resourcePath)
Parameters
| Type | Name | Description |
|---|---|---|
| string | resourcePath | The full Resources path to the font (without extension). |
Returns
| Type | Description |
|---|---|
| Font | The loaded font, or null if not found. |
LoadSDF(string)
Loads an SDF font asset by name from the default Fonts folder. The font is cached on first load for subsequent calls.
Declaration
public static TMP_FontAsset LoadSDF(string fontName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | fontName | The font asset name without extension. |
Returns
| Type | Description |
|---|---|
| TMP_FontAsset | The loaded SDF font asset, or null if not found. |
LoadSDFFromAssetPath(string)
Loads an SDF font asset from a full asset path using AssetDatabase.
Editor-only method for loading fonts outside of Resources; returns null in a player build.
Declaration
public static TMP_FontAsset LoadSDFFromAssetPath(string assetPath)
Parameters
| Type | Name | Description |
|---|---|---|
| string | assetPath | The full asset path (e.g., "Assets/Fonts/MyFont SDF.asset"). |
Returns
| Type | Description |
|---|---|
| TMP_FontAsset | The loaded SDF font asset, or null if not found. |
LoadSDFFromPath(string)
Loads an SDF font asset from a custom Resources path.
Declaration
public static TMP_FontAsset LoadSDFFromPath(string resourcePath)
Parameters
| Type | Name | Description |
|---|---|---|
| string | resourcePath | The full Resources path to the SDF font asset (without extension). |
Returns
| Type | Description |
|---|---|
| TMP_FontAsset | The loaded SDF font asset, or null if not found. |
LoadTMProDefaultSDF()
Loads the TMPro default SDF font asset (LiberationSans SDF). First attempts to load from the Scylla custom location, then falls back to the TMP default location. The font is cached on first load for subsequent calls.
Declaration
public static TMP_FontAsset LoadTMProDefaultSDF()
Returns
| Type | Description |
|---|---|
| TMP_FontAsset | The TMPro default SDF font asset, or null if not found in either location. |
PreloadDefaultMono()
Preloads the Scylla default monospace TTF and TMP SDF fonts into the cache. Call this during initialization to ensure fonts are ready when needed.
Declaration
public static void PreloadDefaultMono()
ScaledFontSizeFor(float)
Applies the DPI text scale to a font size.
Convenience method equivalent to fontSize * GetDPITextScale().
Declaration
public static float ScaledFontSizeFor(float fontSize)
Parameters
| Type | Name | Description |
|---|---|---|
| float | fontSize | The base font size to scale. |
Returns
| Type | Description |
|---|---|
| float | The DPI-adjusted font size. |
TryGetSupportedCharacters(TMP_FontAsset, out string)
Attempts to get supported characters from a TMP SDF font asset.
Declaration
public static bool TryGetSupportedCharacters(TMP_FontAsset font, out string characters)
Parameters
| Type | Name | Description |
|---|---|---|
| TMP_FontAsset | font | The TMP SDF font asset to extract characters from. |
| string | characters | The resulting character string if successful. |
Returns
| Type | Description |
|---|---|
| bool | True if the font is valid and characters were extracted, false otherwise. |
TryGetSupportedCharacters(Font, out string, UnicodeRange[])
Attempts to get supported characters from a TTF font.
Declaration
public static bool TryGetSupportedCharacters(Font font, out string characters, UnicodeRange[] ranges = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Font | font | The TTF font to extract characters from. |
| string | characters | The resulting character string if successful. |
| UnicodeRange[] | ranges | Optional array of Unicode ranges to scan. If null or empty, uses Common. |
Returns
| Type | Description |
|---|---|
| bool | True if the font is valid and characters were extracted, false otherwise. |
TryLoad(string, out Font)
Attempts to load a TTF font by name.
Declaration
public static bool TryLoad(string fontName, out Font font)
Parameters
| Type | Name | Description |
|---|---|---|
| string | fontName | The font name without extension. |
| Font | font | The loaded font if successful. |
Returns
| Type | Description |
|---|---|
| bool | True if the font was loaded successfully, false otherwise. |
TryLoadDefaultMono(FontVariant, out Font, bool, bool)
Attempts to load a Scylla monospace TTF font weight with automatic fallback.
Declaration
public static bool TryLoadDefaultMono(FontVariant variant, out Font font, bool condensed = false, bool useFallback = true)
Parameters
| Type | Name | Description |
|---|---|---|
| FontVariant | variant | The font weight to load. |
| Font | font | The loaded font if successful. |
| bool | condensed | If true, loads from the condensed family (ScyllaMono-Cond); if false (default), loads from the standard-width family (ScyllaMono). |
| bool | useFallback | If true, attempts fallback weights when the requested weight is not found. |
Returns
| Type | Description |
|---|---|
| bool | True if a font was loaded (possibly a fallback), false otherwise. |
TryLoadDefaultMonoSDF(FontVariant, out TMP_FontAsset, bool, bool)
Attempts to load a Scylla monospace SDF font weight with automatic fallback.
Declaration
public static bool TryLoadDefaultMonoSDF(FontVariant variant, out TMP_FontAsset font, bool condensed = false, bool useFallback = true)
Parameters
| Type | Name | Description |
|---|---|---|
| FontVariant | variant | The font weight to load. |
| TMP_FontAsset | font | The loaded SDF font if successful. |
| bool | condensed | If true, loads from the condensed family (ScyllaMono-Cond); if false (default), loads from the standard-width family (ScyllaMono). |
| bool | useFallback | If true, attempts fallback weights when the requested weight is not found. |
Returns
| Type | Description |
|---|---|
| bool | True if a font was loaded (possibly a fallback), false otherwise. |
TryLoadSDF(string, out TMP_FontAsset)
Attempts to load an SDF font asset by name.
Declaration
public static bool TryLoadSDF(string fontName, out TMP_FontAsset font)
Parameters
| Type | Name | Description |
|---|---|---|
| string | fontName | The font asset name without extension. |
| TMP_FontAsset | font | The loaded SDF font asset if successful. |
Returns
| Type | Description |
|---|---|
| bool | True if the font was loaded successfully, false otherwise. |
TryLoadTMProDefaultSDF(out TMP_FontAsset)
Attempts to load the TMPro default SDF font asset.
Declaration
public static bool TryLoadTMProDefaultSDF(out TMP_FontAsset font)
Parameters
| Type | Name | Description |
|---|---|---|
| TMP_FontAsset | font | The loaded SDF font asset if successful. |
Returns
| Type | Description |
|---|---|
| bool | True if the font was loaded successfully, false otherwise. |