cog1to / st-ligatures

Patches for ST (suckless terminal) that add support for ligatures drawing
53 stars 5 forks source link

Fix glyph sequence expansion bug #30

Closed cog1to closed 1 year ago

cog1to commented 1 year ago

Fix for a bug #29.

For some fonts, applying Harfbuzz to a segment might produce an increased number of glyphs than the original number of Unocode codepoints. This might result in memory corruption, as drawing logic will fill the specbuf beyond its capacity.

This patch fixes the problem:

  1. The specbuf is increased to 4 times the line size to accomodate possible string expansion.
  2. The hbtransform is refactored to be able to produce more glyphs than the were codepoints in the original string.
  3. xdrawline is refactored to be able to compose and draw multiple line segments.