MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ index_at()

size_t MayaFlux::Portal::Text::TextRun::index_at ( glm::vec2  px)

Byte offset of the codepoint boundary nearest a layout pixel.

Parameters
pxPoint in layout pixels with y down.

Definition at line 129 of file TextRun.cpp.

130{
131 if (stale()) {
132 lay_out_text();
133 }
134 if (!m_atlas) {
135 return 0;
136 }
137
138 GlyphAtlas& current = *atlas();
139 return Text::index_at(
140 m_text, m_layout, current, px.x, px.y,
141 0.F, static_cast<float>(current.ascender()), m_params.render_bounds.x, k_tab_width);
142}
glm::vec2 current
uint32_t px
GlyphAtlas * atlas() const
The atlas the run draws from: params().atlas, else the default.
Definition TextRun.cpp:38
bool stale() const
True when the atlas the layout was built against has since been replaced or has grown,...
Definition TextRun.cpp:43
const GlyphAtlas * m_atlas
Definition TextRun.hpp:105
size_t index_at(std::string_view text, const LayoutResult &layout, GlyphAtlas &atlas, float x, float y, float pen_x, float pen_y, uint32_t wrap_w, uint32_t tab_width)
Byte offset of the codepoint boundary nearest a screen-space point.
glm::uvec2 render_bounds
Hard render bounds in pixels.
Definition InkPress.hpp:88

References atlas(), current, MayaFlux::Portal::Text::index_at(), lay_out_text(), m_atlas, m_layout, m_params, m_text, px, MayaFlux::Portal::Text::PressParams::render_bounds, and stale().

+ Here is the call graph for this function: