hecrj / wgpu_glyph

A fast text renderer for wgpu (https://github.com/gfx-rs/wgpu)
https://docs.rs/wgpu_glyph
MIT License
443 stars 77 forks source link

Getting individual glyph positions for cursor rendering #37

Closed HalfVoxel closed 4 years ago

HalfVoxel commented 4 years ago

Suppose I want to make an editable text field. This requires displaying a cursor in the text. However I cannot figure out how to get the position (baseline of the row would probably also be required) of a given glyph at a particular index in a section. I see that it is possible to get the bounding box a complete section, but I individual glyphs seem harder.