memononen / nanovg

Antialiased 2D vector drawing library on top of OpenGL for UI and visualizations.
zlib License
5.15k stars 770 forks source link

fix-kern #658

Open msokalski opened 1 year ago

msokalski commented 1 year ago

Make NVGglyphPosition::x values filled by nvgTextGlyphPositions() correctly adjusted by kerning. So calling nvgText() with these coordinates on any sub-string will result in exactly same glyph placements,

Problem occurs when we need to draw text in multiple chunks, eg: to change a fill color for selected part of a text. Before this fix, drawing every chunk with nvgText() would suffer from not being adjusted by kerning with the last glyph of the previous chunk.