Class BmFontIncrementalSession
- Namespace
- KernSmith
- Assembly
- KernSmith.dll
A live glyph-addition session (phase 183): the font is parsed once (unfiltered, so any character the font contains stays addable), the rasterizer stays loaded, and the MaxRects free-rectangle state is held between calls — so each AddGlyphs(string) costs work proportional to the glyphs being added, never to the font or the atlas. Glyphs that are already placed never move ("stable packing"): the caller can blit AddedGlyph bytes straight into a live GPU texture.
public sealed class BmFontIncrementalSession : IDisposable
- Inheritance
-
BmFontIncrementalSession
- Implements
- Inherited Members
Remarks
Not thread-safe. All members must be called from one thread at a time.
Created via BeginIncremental(byte[], FontGeneratorOptions?, AdditionOverflowPolicy) (empty session; the first AddGlyphs(string) sizes the atlas exactly as Generate(byte[], FontGeneratorOptions?) would) or ResumeIncremental(byte[], FontGeneratorOptions, BmFontModel, AdditionOverflowPolicy) (occupancy recovered from an existing BmFontModel).
Additions always pack with MaxRects. A Skyline configuration — or a custom Packer — falls back to MaxRects for additions: arbitrary packer state cannot be reconstructed from occupied rectangles, but existing placements stay valid; only the placement strategy for new glyphs differs.
Properties
CurrentModel
The full BMFont model for everything added so far. Round-trips through the standard formatters/readers like a Generate(byte[], FontGeneratorOptions?) model. Materialized on demand and cached; each AddGlyphs(string) invalidates the cache.
public BmFontModel CurrentModel { get; }
Property Value
PageCount
Current page count; 0 before the first AddGlyphs(string) of a begin-session.
public int PageCount { get; }
Property Value
PageHeight
Current page height in pixels; 0 before the first AddGlyphs(string) of a begin-session.
public int PageHeight { get; }
Property Value
PageWidth
Current page width in pixels; 0 before the first AddGlyphs(string) of a begin-session.
public int PageWidth { get; }
Property Value
Methods
AddGlyphs(IEnumerable<int>)
Adds the given unique codepoints to the atlas. See AddGlyphs(string).
public GlyphAdditionResult AddGlyphs(IEnumerable<int> codepoints)
Parameters
codepointsIEnumerable<int>
Returns
AddGlyphs(string)
Adds the unique characters of characters to the atlas.
Characters already in the session are reported in
AlreadyPresent; characters the font cannot render
land in FailedCodepoints. Surrogate pairs are
interpreted as single codepoints.
public GlyphAdditionResult AddGlyphs(string characters)
Parameters
charactersstring
Returns
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()