Prepared text — shaped once, can be reflowed at any width.
More...
#include <text_shaper.hpp>
|
| | PreparedText ()=default |
| const std::vector< ShapedSegment > & | segments () const |
| | The segments (measured).
|
| float | line_height () const |
| | Line height for this text.
|
| float | ascent () const |
| | SkFontMetrics-derived line box of the resolved typeface, as positive distances above (ascent) and below (descent) the baseline.
|
| float | descent () const |
| float | leading () const |
| bool | metrics_are_real () const |
| float | typographic_ascent () const |
| | The face's TYPOGRAPHIC ascent and descent (Skia's fAscent/fDescent, flipped positive) — the metrics CSS builds a line's content area and baseline from.
|
| float | typographic_descent () const |
| int | font_weight () const |
| | The CSS numeric weight these segments were measured at.
|
| float | total_width () const |
| | Total width if laid out on a single line.
|
| bool | empty () const |
| | Whether this prepared text has content.
|
Prepared text — shaped once, can be reflowed at any width.
◆ PreparedText()
| pulp::canvas::PreparedText::PreparedText |
( |
| ) |
|
|
default |
◆ ascent()
| float pulp::canvas::PreparedText::ascent |
( |
| ) |
const |
|
inline |
SkFontMetrics-derived line box of the resolved typeface, as positive distances above (ascent) and below (descent) the baseline.
These are the WORST-CASE glyph extents — the larger of fTop/fAscent and fBottom/fDescent — so a box sized from them never clips a glyph. leading is the extra inter-line gap; line_height equals ascent + descent + leading. real is true when these came from a resolved typeface, false when the fallback heuristic ran (no Skia, family unresolvable, etc.).
◆ descent()
| float pulp::canvas::PreparedText::descent |
( |
| ) |
const |
|
inline |
◆ empty()
| bool pulp::canvas::PreparedText::empty |
( |
| ) |
const |
|
inline |
Whether this prepared text has content.
◆ font_weight()
| int pulp::canvas::PreparedText::font_weight |
( |
| ) |
const |
|
inline |
The CSS numeric weight these segments were measured at.
Part of the prepared text's identity, not decoration: a Bold face is a different set of advances, not a Regular one drawn heavier, so a layout computed from segments measured at 400 does not describe text painted at 700.
◆ leading()
| float pulp::canvas::PreparedText::leading |
( |
| ) |
const |
|
inline |
◆ line_height()
| float pulp::canvas::PreparedText::line_height |
( |
| ) |
const |
|
inline |
Line height for this text.
◆ metrics_are_real()
| bool pulp::canvas::PreparedText::metrics_are_real |
( |
| ) |
const |
|
inline |
◆ segments()
| const std::vector< ShapedSegment > & pulp::canvas::PreparedText::segments |
( |
| ) |
const |
|
inline |
◆ total_width()
| float pulp::canvas::PreparedText::total_width |
( |
| ) |
const |
Total width if laid out on a single line.
◆ typographic_ascent()
| float pulp::canvas::PreparedText::typographic_ascent |
( |
| ) |
const |
|
inline |
The face's TYPOGRAPHIC ascent and descent (Skia's fAscent/fDescent, flipped positive) — the metrics CSS builds a line's content area and baseline from.
Unlike ascent()/descent() these are not widened to the worst-case glyph, so a face whose tallest glyph rises above its declared ascent (Arial Bold, Inter) reports a smaller number here. Use these to reproduce a browser's baseline; use ascent() to size a box that must contain every glyph.
◆ typographic_descent()
| float pulp::canvas::PreparedText::typographic_descent |
( |
| ) |
const |
|
inline |
◆ TextShaper
The documentation for this class was generated from the following file:
- /home/runner/work/pulp/pulp/core/canvas/include/pulp/canvas/text_shaper.hpp