Donner SVG main
0.8.0 ยท 382bd0190.8.0 main
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
 Compare every key field by raw bits, including signed zero and NaN payloads.

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
 Versioned font handle identity.
uint32_t glyphIndex = 0
 Glyph index within the selected font.
float outlineScale = 0.0f
 Scale applied while extracting the outline.
float stretchScaleX = 1.0f
 Horizontal stretch applied to the outline.
float stretchScaleY = 1.0f
 Vertical stretch applied to the outline.
double rotateDegrees = 0.0
 Rotation applied to the outline, in degrees.
double fillTolerance = 0.1
 Device-derived cubic approximation tolerance.
bool allowSyntheticOblique = true
 Whether the outline may be synthetically obliqued.

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 when a different face is selected. An outline-only synthesis change can keep the same face, so its per-glyph permission is also part of the key. Superseded entries age out through the residency budget.

Member Function Documentation

◆ operator==()

bool donner::geode::GlyphGeometryKey::operator== ( const GlyphGeometryKey & other) const
inline

Compare every key field by raw bits, including signed zero and NaN payloads.

Parameters
otherGeometry key to compare.

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