Vixen
02b45cc4
csharp
public sealed class GlyphFieldCache

Turns a glyph into an atlas entry, generating its field the first time it is asked for.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

The join between the three pieces below it: FontFace reads the outline, DistanceField encodes it, GlyphAtlas holds it. A renderer asks one question — where is this glyph — and never learns that any of them exist.

⚠ The placement is remembered separately from the atlas entry, and outlives it. Eviction takes the pixels; it does not change where the glyph sits relative to the pen, because that came from the font. Recomputing it on every miss would mean reading the outline again to learn something that cannot have changed.

Fields and properties (5)

  • public GlyphAtlas Atlas

    The atlas the fields live in.

  • public int Resolution

    How many pixels a glyph's longer side is encoded at.

  • public float Range

    How many pixels either side of the edge the field spans.

  • public long Generated

    How many glyphs have had a field generated for them.

  • public long Reads

    How many lookups had to go back to the font for an outline.

Methods (2)

  • public GlyphFieldCache(GlyphAtlas atlas, int resolution = 32, float range = 4)

    Creates a cache over an atlas.

  • public bool TryGet(FontFace font, int fontIndex, ushort glyph, out AtlasGlyph placement)

    Finds a glyph in the atlas, encoding it first if it is not there.

Used by (12)

  • UiHostHelloUi
  • GlyphFieldCacheTestsVixen.Ui.Text.Tests
  • IconAtlasTestsVixen.Ui.Tests
  • NineSliceImageTestsVixen.Ui.Tests
  • PathTessellationCacheTestsVixen.Ui.Tests
  • UiFrameLifetimeTestsVixen.Graphics.Golden.Tests
  • UiGeometryBuilderVixen.Ui
  • UiGeometryTestsVixen.Ui.Tests
  • UiImageTestsVixen.Graphics.Golden.Tests
  • UiTestVixen.Ui.Testing
  • VideoInUiTestsVixen.Video.Rendering.Tests
  • EditorHostVixen.Editor.Host