I’m developing a preview plugin like “Text Preview” in Glyphs3.
BTW, when I redraw a full window with “setNeedsDisplay_(True)” while editing a glyph, there is a lag or delay in an editing window in case I have to redraw lots of characters.
For instance, if there is a text “Good morning!” in a preview window and I’m editing ‘o’, I want to redraw ‘o’ characters only without redrawing a full window.
You can use setNeedsDisplayInRect_(). So if you observe that on letter needs redrawing, find out what area it was using and invalidate that area. Then the drawRect_ will have that same rect as an argument. Then you only draw whatever is in that rect.
All that bookkeeping can expensive, too. So just redrawing everything might be actually quicker.
And if you have an “o” and an “ö” (that uses the “o” as a component) in your view, you need to redraw both. That makes the bookkeeping much more complicated.