class
Font
Font resource containing data about textual characters and how to render text.
Contains one or multiple font bitmaps, each for a specific size.
Public
Methods
~Font
GetBitmap
Returns font bitmap information for a specific font size.
- size
- Size of the font in points.
Returns: Bitmap object if it exists, false otherwise.
GetClosestExistingBitmapSize
Finds a rendered bitmap closest to the provided size.
- size
- Size of the bitmap in points.
Returns: Nearest available bitmap size.
GetPointSizeForGlyphThatFitsArea
Calculates the required font size (in points) in order to render a glyph that fits within an area of pixels, without stretching or cropping.
FindCharacterInformation
Attempts to find information about a character with the specified id and size.
Returns null if character was not yet rendered via RenderGlyphs.
GetPage
Returns a font page information for a page at the specified index.
RenderGlyphs
Renders glyphs for particular characters in a particular size.
The rendered glyphs will be added to the first free texture page, or new texture page(s) will be allocated. Returns true if successful.
- sizeInPoints
- Size of the glyph in points.
- characterIds
- UTF32 character identifiers of the characters to render.
- bake
- If true the rendered glyph will be saved with the font the next time it is serialized, so it doesn't need to be re-rendered the next time its loaded.
ClearGlyphs
Clears all the rendered glyph information.
- onlyRuntime
- If true, only data for runtime rendered glyphs will be cleared, baked data will remain.
ClearGlyphs
Clears all the rendered glyph information for a specific font size.
- size
- Font size in points.
- onlyRuntime
- If true, only data for runtime rendered glyphs will be cleared, baked data will remain.
staticCreate
Creates a new font.
staticGetRttiStatic
Internal
Methods
ClearGlyphs
Clears all the rendered glyph information from the provided bitmap information.
- bitmapInformation
- Structure containing all character and other information for a particular font size.
- onlyRuntime
- If true, only data for runtime rendered glyphs will be cleared, baked data will remain.
RemovePage
Removes a page at the specified index and updates all the existing character information to point to the next page.
All characters referencing this particular page must have been removed before calling this method.
Initialize
Initializes all the internal data of this object.
Must be called right after construction for new objects, or after deserialization for deserialized objects. If requested, render proxy is created and queued for initialization on the render thread.
Destroy
Frees all the data held by this object.
If the object has a render proxy, the internal reference to the render proxy will be released, but the proxy will not be destroyed unless this was the last reference. If render proxy destruction does happen, it is not immediate, but rather queued for destruction on the render thread.
staticGetQuantizedFontSize
Retrieves font size that is quantized in a way we can use it to perform bitmap lookup.
Protected
Constructors
Font
Methods
InitializeFontRenderer
Creates the font renderer for the currently assigned font data.
This must be called before RenderGlyph() is called. Returns false if the renderer cannot be initialized (usually means the font data is missing, or the renderer is already initialized).
DestroyFontRenderer
Destroys the font renderer created in InitializeFontRenderer().
GetCoreDependencies
Populates the provided array with all core objects that this core object depends upon.
Dependencies are required for syncing to the render thread, so the system can be aware to update the dependant objects if a dependency is marked as dirty (for example updating a camera's viewport should also trigger an update on camera so it has a chance to potentially update its data).