|
|
Donner 0.5.1
Embeddable browser-grade SVG2 engine
|
Shared SVG text engine. More...
#include "donner/svg/text/TextEngine.h"
Public Member Functions | |
| TextEngine (FontManager &fontManager, Registry ®istry) | |
| Construct a text engine using the provided font manager and ECS registry. | |
| TextEngine (FontManager &fontManager, Registry ®istry, std::unique_ptr< TextBackend > backend) | |
| Test-only constructor that injects a custom TextBackend. | |
| TextEngine (const TextEngine &)=delete | |
| TextEngine & | operator= (const TextEngine &)=delete |
| void | addFontFace (const css::FontFace &face) |
Register a single face with the engine's font manager. | |
| void | addFontFaces (std::span< const css::FontFace > faces) |
Register a batch of faces with the engine's font manager. | |
| void | prepareForElement (EntityHandle handle, ParseWarningSink &warningSink) |
Prepare text dependencies for the text root containing handle. | |
| std::vector< TextRun > | layout (const components::ComputedTextComponent &text, const TextLayoutParams ¶ms) |
| Lay out all spans, returning positioned glyph runs. | |
| FontVMetrics | fontVMetrics (FontHandle font) const |
Return vertical font metrics for font. | |
| float | scaleForPixelHeight (FontHandle font, float pixelHeight) const |
Return the scale factor mapping design units to pixelHeight pixels for font. | |
| float | scaleForEmToPixels (FontHandle font, float pixelHeight) const |
Return the scale factor mapping one em to pixelHeight pixels for font. | |
| std::optional< UnderlineMetrics > | underlineMetrics (FontHandle font) const |
Return underline position/thickness for font, if available. | |
| std::optional< UnderlineMetrics > | strikeoutMetrics (FontHandle font) const |
Return strikeout position/thickness for font, if available. | |
| std::optional< SubSuperMetrics > | subSuperMetrics (FontHandle font) const |
Return subscript/superscript offset metrics for font, if available. | |
| Path | glyphOutline (FontHandle font, int glyphIndex, float scale) const |
Return the vector outline for glyphIndex in font at the given scale. | |
| bool | isBitmapOnly (FontHandle font) const |
Return true if font only contains bitmap glyphs (e.g. color emoji). | |
| std::optional< TextBackend::BitmapGlyph > | bitmapGlyph (FontHandle font, int glyphIndex, float scale) const |
Return a rasterized bitmap glyph for glyphIndex in font at the given scale. | |
| std::optional< double > | measureChUnitInEm (std::span< const RcString > fontFamilies) |
| Measure the ch unit in ems for the given font-family cascade. | |
| void | resolvePerSpanLayoutStyles (EntityHandle textRootHandle, components::ComputedTextComponent &text) const |
| Resolve per-span layout-affecting style state on a computed text tree. | |
| const components::ComputedTextGeometryComponent & | ensureComputedTextGeometryComponent (EntityHandle handle) const |
Ensure cached text geometry exists for the text root containing handle. | |
| std::vector< Path > | computedGlyphPaths (EntityHandle handle) const |
Return glyph outlines for the text subtree rooted at handle. | |
| Box2d | computedInkBounds (EntityHandle handle) const |
Return the ink bounds for the text subtree rooted at handle. | |
| Box2d | computedObjectBoundingBox (EntityHandle handle) const |
Return the object bounding box for the text subtree rooted at handle. | |
| long | getNumberOfChars (EntityHandle handle) const |
Return the number of addressable characters for the text subtree rooted at handle. | |
| double | getComputedTextLength (EntityHandle handle) const |
Return the computed text length for the text subtree rooted at handle. | |
| double | getSubStringLength (EntityHandle handle, std::size_t charnum, std::size_t nchars) const |
Return the substring length for the text subtree rooted at handle. | |
| Vector2d | getStartPositionOfChar (EntityHandle handle, std::size_t charnum) const |
Return the start position of a character for the text subtree rooted at handle. | |
| Vector2d | getEndPositionOfChar (EntityHandle handle, std::size_t charnum) const |
Return the end position of a character for the text subtree rooted at handle. | |
| Box2d | getExtentOfChar (EntityHandle handle, std::size_t charnum) const |
Return the extent of a character for the text subtree rooted at handle. | |
| double | getRotationOfChar (EntityHandle handle, std::size_t charnum) const |
Return the rotation of a character for the text subtree rooted at handle. | |
| long | getCharNumAtPosition (EntityHandle handle, const Vector2d &point) const |
Return the character index at the given point for the text subtree rooted at handle. | |
Shared SVG text engine.
Owns the selected text backend and provides layout plus font-related operations while hiding backend selection from callers.
Usage: