|
TorqueScript Reference
|
Functions | |
| void | clearUncachedFonts () |
| void | dumpFontCacheStatus () |
| void | duplicateCachedFont (oldFontName, oldFontSize, newFontName) |
| void | exportCachedFont (fontName, size, fileName, padding, kerning) |
| String | getInstalledFonts () |
| String | getUncachedFonts () |
| void | importCachedFont (fontName, size, fileName, padding, kerning) |
| void | populateAllFontCacheRange (rangeStart, rangeEnd) |
| void | populateAllFontCacheString (string inString) |
| void | populateFontCacheRange (faceName, size, rangeStart, rangeEnd) |
| void | populateFontCacheString (faceName, size, string) |
| void | writeFontCache () |
| Boolean | writeOneFontCache (faceName, size) |
| void | writeSingleFontCache (fontName) |
| void clearUncachedFonts | ( | ) |
Forget every recorded font cache miss. Called after baking, so the next report lists only what has come up since.
| void dumpFontCacheStatus | ( | ) |
Dump a full description of all cached fonts, along with info on the codepoints each contains.
| void duplicateCachedFont | ( | oldFontName | , |
| oldFontSize | , | ||
| newFontName | ) |
Copy the specified old font to a new name. The new copy will not have a platform font backing it, and so will never have characters added to it. But this is useful for making copies of fonts to add postprocessing effects to via exportCachedFont.
| oldFontName | The original font. |
| oldFontSize | The original font's size property. |
| newFontName | The name to set the copy to. |
Export specified font to the specified filename as a PNG. The image can then be processed in Photoshop or another tool and reimported using importCachedFont. Characters in the font are exported as one long strip.
| fontName | The name of the font to export. |
| size | The size of the font |
| fileName | The export file name. |
| padding | Desired padding settings. |
| kerning | Kerning settings (space between elements) |
| String getInstalledFonts | ( | ) |
List the font faces installed on this machine. These are the faces the platform can rasterize without any cache on disk – what a tool offers the user to choose from. Sorted and de-duplicated here rather than in script: Windows enumerates a family once per character set, and sorting a few hundred names in TorqueScript is not free. Platforms with no font enumeration (iOS, Android, the web build) return an empty string, so a caller should treat the list as an offer, not the whole truth – a face can still be usable through a cached .uft it finds on disk.
| String getUncachedFonts | ( | ) |
List the face/size pairs that had to be rasterized because no cache existed. A tool bakes exactly these: the face is installed here, so it can be written, but a machine without it would have nothing to fall back on. The list covers sizes no field declares – a control's fontSizeAdjust multiplies its profile's fontSize – which is why it is recorded as it happens rather than derived. Each row also carries the font directory that was searched, so a caller can keep one project's caches out of another's folder.
Import an image strip from exportCachedFont. Call with the same parameters you called exportCachedFont.
| fontName | The name of the font to import. |
| size | The size of the font |
| fileName | The imported file name. |
| padding | Desired padding settings. |
| kerning | Kerning settings (space between elements) |
| void populateAllFontCacheRange | ( | rangeStart | , |
| rangeEnd | ) |
Populate the font cache for all fonts with Unicode code points in the specified range. Note we only support BMP-0, so code points range from 0 to 65535.
| rangeStart,rangeEnd | The range of the unicode points to populate caches with |
| void populateAllFontCacheString | ( | string | inString | ) |
Populate the font cache for all fonts with characters from the specified string.
| inString | The string to use to set the font caches |
| void populateFontCacheRange | ( | faceName | , |
| size | , | ||
| rangeStart | , | ||
| rangeEnd | ) |
Populate the font cache for the specified font with Unicode code points in the specified range. Note we only support BMP-0, so code points range from 0 to 65535.
| faceName | The name of the font |
| size | The size of the font. |
| rangeStart | The initial Unicode point |
| rangeEnd | The final Unicode point in range |
| void populateFontCacheString | ( | faceName | , |
| size | , | ||
| string | ) |
Populate the font cache for the specified font with characters from the specified string.
| faceName | The font's name |
| size | The size of the font. |
| string | The string to use to fill font cache |
| void writeFontCache | ( | ) |
force all cached fonts to serialize themselves to the cache.
| Boolean writeOneFontCache | ( | faceName | , |
| size | ) |
Write one font's cache file to disk. The other two writers are broad: writeFontCache() serializes every cached font, and writeSingleFontCache() scans the project for *.uft and rewrites each one whose path contains the face name. This one touches exactly the face and size asked for, which is what a tool wants after populating a single font – the scanning version costs the same second and a half however little changed, and gets slower as caches accumulate. The cache path comes from GFont::getFontCacheFilename, so it lands under $GUI::fontCacheDirectory – the same place populateFontCacheRange reads from.
| faceName | The name of the font. |
| size | The size of the font. |
| void writeSingleFontCache | ( | fontName | ) |
Force all cached fonts with a given font name in their paths to serialize themselves to the cache.
| fontName | The name of the font to search for in the path. Will save if found. |