9fans / plan9port

Plan 9 from User Space
https://9fans.github.io/plan9port/
Other
1.63k stars 321 forks source link

libdraw: fix subfont scaling #624

Closed matheuristic closed 1 year ago

matheuristic commented 1 year ago

A subfont struct with n chars has n+1 Fontchars in its info member.

Currently, when a subfont is scaled only n info entries are updated. Because of that, after scaling the last character uses an incorrect part of the subfont image for its glyph.

This pull request modifies scalesubfont() so all n+1 entries of info are scaled.

(All n+1 Fontchar entries appear necessary, see _unpackinfo() in src/libdraw/readsubfont.c .)

Example:

Using lucsans/euro.8.font font, whose first subfont range covers Unicode points 0x0000 through 0x00FF.

Before code change: on a non-HiDPI screen Unicode point 0x00FF "Latin Small Letter Y with Diaeresis" (ÿ) displays correctly, but the same character appears as an empty space when the font is scaled to 2x.

acme-pre

After code change: the character appears as expected post-scaling.

acme-post