Donner SVG 0.8.0-pre
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
donner::geode::GlyphGeometryKey Struct Reference

Identity of one unique glyph outline: every input that can change the encoded geometry, and nothing that cannot. More...

#include "donner/svg/renderer/geode/GeodeGlyphResidency.h"

Public Member Functions

bool operator== (const GlyphGeometryKey &other) const

Static Public Member Functions

static uint32_t bits (float value)
 Raw bit pattern of a float, so -0.0f and NaN payloads compare and hash as the distinct inputs they are rather than by numeric equality.
static uint64_t bits (double value)
 Raw bit pattern of a double; same policy as the float overload.

Public Attributes

uint64_t fontId = 0
uint32_t glyphIndex = 0
float outlineScale = 0.0f
float stretchScaleX = 1.0f
float stretchScaleY = 1.0f
double rotateDegrees = 0.0

Detailed Description

Identity of one unique glyph outline: every input that can change the encoded geometry, and nothing that cannot.

fontId is the font handle's opaque identifier, outlineScale is the effective scale handed to the font backend (the run scale times the glyph's own font-size multiplier), the stretch factors are the lengthAdjust scale, and rotateDegrees is the per-glyph rotation - all four are baked into the outline before placement. Position is deliberately absent: it is the placement transform, which rides in the per-occurrence record.

Rotation belongs here rather than in the placement because a resident outline is also the space its rasteriser works in, and that space has to stay aligned with the pixel grid. The cost is one cached outline per distinct angle: a whole run rotated by one angle still collapses to one entry, and a textPath, which rotates every glyph differently, degrades to about one entry per glyph - which is what an uncached renderer pays anyway.

The numeric fields are compared and hashed BITWISE, matching how they reach the font backend: two scales or angles that differ in the last bit produce different outlines, so they must not share an entry.

fontId carries the font handle's version bits, so an unloaded font whose slot is later reused cannot be mistaken for the original. It is also not stable across a style mutation that makes the document re-resolve its fonts: the re-resolved font is a new identity and its glyphs are rebuilt. That costs a rebuild on a mutating document rather than serving stale geometry, and the superseded entries age out through the residency budget.


The documentation for this struct was generated from the following file: