Getting the clicked glyph in a text

Hi! I’m working on a custom text preview script that draws glyphs as bezier paths on CanvasView and got a question — is there a recommended way how to get which glyph is clicked with the mouse, similar to how it works in Glyphs tabs? Anything better/faster than looping through a list of bounding boxes and checking if the mouse position matches?

Glyphs stores a list of bounds from when it was drawing. Then looping over it is easy.

1 Like