WYSIWYG text-edit metrics — the geometry an inspector edit overlay needs to draw a caret + selection band that EXACTLY matches the glyphs paint() renders. More...
#include <widgets.hpp>
Public Attributes | |
| std::string | display_text |
| float | local_text_left = 0.0f |
| local x where text starts (handles center/right align) | |
| float | local_band_y = 0.0f |
| local y of the caret/selection band (top of text) | |
| float | band_height = 0.0f |
| std::vector< float > | caret_x_by_byte |
| size == display_text.size()+1 | |
WYSIWYG text-edit metrics — the geometry an inspector edit overlay needs to draw a caret + selection band that EXACTLY matches the glyphs paint() renders.
The label's painter resolves inherited size/weight/letter-spacing, family fallback, slant, text-transform, and an alignment-dependent draw origin; an overlay that re-measures with the Label's OWN fields drifts whenever any of those differ (e.g. a PARENT sets letter-spacing, or the label is center/right aligned). This factors the same style/origin resolution paint() uses so the two can never disagree.
caret_x_by_byte[i] is the caret x (local, measured from local_text_left) for the byte boundary at index i over the supplied edit_text — the buffer the overlay is currently editing, NOT text() (which is mid-edit). It has edit_text.size() + 1 entries (one per boundary, including end-of-text).
| float pulp::view::Label::TextEditMetrics::band_height = 0.0f |
| std::vector<float> pulp::view::Label::TextEditMetrics::caret_x_by_byte |
size == display_text.size()+1
| std::string pulp::view::Label::TextEditMetrics::display_text |
| float pulp::view::Label::TextEditMetrics::local_band_y = 0.0f |
local y of the caret/selection band (top of text)
| float pulp::view::Label::TextEditMetrics::local_text_left = 0.0f |
local x where text starts (handles center/right align)