Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
appearance_defects.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <pulp/view/view.hpp>
4
5#include <string>
6#include <vector>
7
8namespace pulp::view {
9
22
47
49
60
62struct TextRun {
63 std::string node_id;
64 std::string kind;
65 std::string text;
75 int paint_order = 0;
80 const View* scroll_frame = nullptr;
81 bool from_canvas = false;
82};
83
130
133 std::string a_id, a_text;
134 std::string b_id, b_text;
136 float painted_width = 0.0f;
137 float box_width = 0.0f;
144 float overflow_px = 0.0f;
145
146 std::string describe() const;
147};
148
150 std::vector<AppearanceFinding> findings;
154 std::vector<TextRun> runs;
155
156 bool clean() const { return findings.empty(); }
157 std::string to_string() const;
158};
159
186
189 const AppearanceOptions& options = {});
190
191} // namespace pulp::view
Definition view.hpp:73
Hover-cursor tracking for platform window hosts.
Definition fwd.hpp:27
TextRunSkip
Why a piece of text was not evaluated.
Definition appearance_defects.hpp:52
@ none
Definition appearance_defects.hpp:53
@ empty_text
nothing to paint
Definition appearance_defects.hpp:55
@ invisible
the node or an ancestor is not visible
Definition appearance_defects.hpp:54
@ degenerate_box
the layout box has no area to paint into
Definition appearance_defects.hpp:58
@ clipped_away
ink falls entirely outside its effective clip
Definition appearance_defects.hpp:56
@ unmeasurable
the shaper returned no extents for non-empty text
Definition appearance_defects.hpp:57
const char * to_string(AppearanceDefectKind kind)
AppearanceReport detect_appearance_defects(const View &root, const AppearanceOptions &options={})
Walk root (already laid out) and report painted-text defects.
AppearanceDefectKind
Visual-appearance defect detection over a laid-out View tree.
Definition appearance_defects.hpp:23
@ painted_wider_than_box
A run's glyphs are wider than the box that is supposed to contain them, so the tail is clipped or tru...
Definition appearance_defects.hpp:28
@ text_overlap
Two pieces of painted text share pixels.
Definition appearance_defects.hpp:25
@ canvas_text_overlap
Two canvas-command text runs (CanvasDrawCmd::fill_text / stroke_text) share pixels.
Definition appearance_defects.hpp:32
@ container_paints_no_text
A visible clipping container holds text and shows none of it — the viewer sees an empty panel.
Definition appearance_defects.hpp:45
N of M evaluated, K skipped and why. Printed on every run.
Definition appearance_defects.hpp:85
int total_skipped() const
Definition appearance_defects.hpp:114
int skipped_clipped_in_empty_container
The part of skipped_clipped that fell inside a container reported as container_paints_no_text.
Definition appearance_defects.hpp:97
int skipped_unmeasurable
Definition appearance_defects.hpp:98
bool trustworthy() const
A run that measured nothing, measured a minority of the text it saw, or could not see into a region a...
int text_nodes_seen
text-bearing views encountered
Definition appearance_defects.hpp:86
std::string to_string() const
int skipped_invisible
Definition appearance_defects.hpp:88
int canvas_text_commands
Definition appearance_defects.hpp:102
int text_runs_measured
runs with real ink extents
Definition appearance_defects.hpp:87
int text_runs_total() const
Definition appearance_defects.hpp:118
int pairs_compared
Definition appearance_defects.hpp:106
int canvas_text_measured
Definition appearance_defects.hpp:103
int skipped_clipped
Definition appearance_defects.hpp:90
bool shaping_is_real
False when the text shaper is the character-width estimator rather than a real shaping engine.
Definition appearance_defects.hpp:112
int pairs_skipped_cross_frame
Definition appearance_defects.hpp:107
int skipped_degenerate_box
Definition appearance_defects.hpp:99
int skipped_empty
Definition appearance_defects.hpp:89
int canvas_text_skipped
Definition appearance_defects.hpp:104
int canvas_widgets
Definition appearance_defects.hpp:101
Definition appearance_defects.hpp:131
AppearanceDefectKind kind
Definition appearance_defects.hpp:132
Rect overlap
Definition appearance_defects.hpp:135
Rect a_rect
Definition appearance_defects.hpp:135
float box_width
Definition appearance_defects.hpp:137
std::string b_id
Definition appearance_defects.hpp:134
float painted_width
Definition appearance_defects.hpp:136
std::string describe() const
std::string a_id
Definition appearance_defects.hpp:133
std::string a_text
Definition appearance_defects.hpp:133
std::string b_text
Definition appearance_defects.hpp:134
int clipped_runs
For container_paints_no_text: how many text runs the container holds, every one of them clipped away.
Definition appearance_defects.hpp:140
float overflow_px
How far the ink reaches past the worse of the box's two vertical edges.
Definition appearance_defects.hpp:144
Rect b_rect
Definition appearance_defects.hpp:135
Definition appearance_defects.hpp:160
float min_overlap_area_px2
Overlaps smaller than this area are ignored.
Definition appearance_defects.hpp:167
bool compare_across_scroll_frames
Compare runs that live in different scroll frames.
Definition appearance_defects.hpp:173
float width_tolerance_px
Ink may exceed its box by this much before it counts as truncation.
Definition appearance_defects.hpp:165
float control_inflate_ink_px
Grow every measured run's ink by this many pixels on each side before the collision detectors run.
Definition appearance_defects.hpp:184
float overlap_tolerance_px
Overlaps thinner than this in either axis are ignored — adjacent text commonly shares a boundary pixe...
Definition appearance_defects.hpp:163
bool include_canvas_text
Definition appearance_defects.hpp:168
Definition appearance_defects.hpp:149
std::string to_string() const
std::vector< AppearanceFinding > findings
Definition appearance_defects.hpp:150
AppearanceCoverage coverage
Definition appearance_defects.hpp:151
std::vector< TextRun > runs
Every run the walk resolved, in paint order.
Definition appearance_defects.hpp:154
bool clean() const
Definition appearance_defects.hpp:156
Axis-aligned rectangle in continuous (float) coordinates.
Definition geometry.hpp:52
One piece of painted text, resolved to screen space.
Definition appearance_defects.hpp:62
Rect clip
effective clip at paint time, absolute
Definition appearance_defects.hpp:74
Rect ink
painted glyph extents, absolute, alignment applied
Definition appearance_defects.hpp:66
Rect visible_ink
The part of ink that survives the clip — the pixels a viewer can actually see.
Definition appearance_defects.hpp:72
int paint_order
Definition appearance_defects.hpp:75
std::string node_id
Definition appearance_defects.hpp:63
std::string kind
View type name, or "canvas:fill_text".
Definition appearance_defects.hpp:64
const View * scroll_frame
Nearest scrolling ancestor.
Definition appearance_defects.hpp:80
std::string text
Definition appearance_defects.hpp:65
Rect box
the layout box the ink is meant to live in
Definition appearance_defects.hpp:73
bool from_canvas
Definition appearance_defects.hpp:81