Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::view::Label::TextEditMetrics Struct Reference

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

Detailed Description

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).

Member Data Documentation

◆ band_height

float pulp::view::Label::TextEditMetrics::band_height = 0.0f

◆ caret_x_by_byte

std::vector<float> pulp::view::Label::TextEditMetrics::caret_x_by_byte

size == display_text.size()+1

◆ display_text

std::string pulp::view::Label::TextEditMetrics::display_text

◆ local_band_y

float pulp::view::Label::TextEditMetrics::local_band_y = 0.0f

local y of the caret/selection band (top of text)

◆ local_text_left

float pulp::view::Label::TextEditMetrics::local_text_left = 0.0f

local x where text starts (handles center/right align)


The documentation for this struct was generated from the following file:
  • /home/runner/work/pulp/pulp/core/view/include/pulp/view/widgets.hpp