Donner 0.5.0
Embeddable browser-grade SVG2 engine
Loading...
Searching...
No Matches
donner::svg::MockTextBackend Class Reference
Inheritance diagram for donner::svg::MockTextBackend:
[legend]
Collaboration diagram for donner::svg::MockTextBackend:
[legend]

Public Member Functions

 MOCK_METHOD (FontVMetrics, fontVMetrics,(FontHandle),(const, override))
 MOCK_METHOD (float, scaleForPixelHeight,(FontHandle, float),(const, override))
 MOCK_METHOD (float, scaleForEmToPixels,(FontHandle, float),(const, override))
 MOCK_METHOD (std::optional< UnderlineMetrics >, underlineMetrics,(FontHandle),(const, override))
 MOCK_METHOD (std::optional< UnderlineMetrics >, strikeoutMetrics,(FontHandle),(const, override))
 MOCK_METHOD (std::optional< SubSuperMetrics >, subSuperMetrics,(FontHandle),(const, override))
 MOCK_METHOD (Path, glyphOutline,(FontHandle, int, float),(const, override))
 MOCK_METHOD (bool, isBitmapOnly,(FontHandle),(const, override))
 MOCK_METHOD (bool, isCursive,(uint32_t),(const, override))
 MOCK_METHOD (bool, hasSmallCapsFeature,(FontHandle),(const, override))
 MOCK_METHOD (std::optional< BitmapGlyph >, bitmapGlyph,(FontHandle, int, float),(const, override))
 MOCK_METHOD (ShapedRun, shapeRun,(FontHandle, float, std::string_view, size_t, size_t, bool, FontVariant, bool),(const, override))
 MOCK_METHOD (double, crossSpanKern,(FontHandle, float, FontHandle, float, uint32_t, uint32_t, bool),(const, override))
Public Member Functions inherited from donner::svg::TextBackend
virtual FontVMetrics fontVMetrics (FontHandle font) const =0
 Vertical metrics (ascent, descent, lineGap) in font design units.
virtual float scaleForPixelHeight (FontHandle font, float pixelHeight) const =0
 Scale factor: font design units → pixels, normalized to ascent−descent height. This is stbtt_ScaleForPixelHeight semantics.
virtual float scaleForEmToPixels (FontHandle font, float pixelHeight) const =0
 Scale factor: em units → pixels. Differs from scaleForPixelHeight when ascent−descent != unitsPerEm. This is the correct scale for CSS font-size.
virtual std::optional< UnderlineMetricsunderlineMetrics (FontHandle font) const =0
 Underline position/thickness from the 'post' table, in font design units. Returns std::nullopt if the table is missing.
virtual std::optional< UnderlineMetricsstrikeoutMetrics (FontHandle font) const =0
 Strikeout position/thickness from the OS/2 table, in font design units. Returns std::nullopt if the table is missing.
virtual std::optional< SubSuperMetricssubSuperMetrics (FontHandle font) const =0
 Sub/superscript Y offsets from the OS/2 table, in font design units. Returns std::nullopt if the table is missing.
virtual Path glyphOutline (FontHandle font, int glyphIndex, float scale) const =0
 Extract a glyph outline as a Path. Coordinates are in font units scaled by scale, with Y flipped for SVG's y-down convention.
virtual bool isBitmapOnly (FontHandle font) const =0
 Returns true if the font is bitmap-only (no vector outlines).
virtual bool isCursive (uint32_t codepoint) const =0
 Returns true if letter-spacing should be suppressed for this codepoint (cursive/connected scripts like Arabic). Simple backends return false.
virtual bool hasSmallCapsFeature (FontHandle font) const =0
 Returns true if the font has a native OpenType small-caps feature (smcp). If false, the engine synthesizes small-caps via uppercase + reduced size.
virtual std::optional< BitmapGlyphbitmapGlyph (FontHandle font, int glyphIndex, float scale) const =0
 Extract a bitmap glyph (CBDT/CBLC color emoji). Returns std::nullopt if the glyph is not a bitmap. Simple backends always return std::nullopt.
virtual ShapedRun shapeRun (FontHandle font, float fontSizePx, std::string_view spanText, size_t byteOffset, size_t byteLength, bool isVertical, FontVariant fontVariant, bool forceLogicalOrder) const =0
 Shape a range of text, producing glyph IDs with advances and kerning.
virtual double crossSpanKern (FontHandle prevFont, float prevSizePx, FontHandle curFont, float curSizePx, uint32_t prevCodepoint, uint32_t curCodepoint, bool isVertical) const =0
 Compute cross-span kerning between the last codepoint of the previous span and the first codepoint of the current span.

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