IdreesInc / Miracode

A sharp, readable, vector-y version of Monocraft, the programming font based on Minecraft
https://idreesinc.com
SIL Open Font License 1.1
776 stars 4 forks source link

Pixel-perfect rendering at medium size impeded #6

Open jengelh opened 3 months ago

jengelh commented 3 months ago

Describe the bug

The minimum pt size to get pixel-perfect rendering is too high. Consider the glyph U+0030 DIGIT ZERO: left edge is at x=32u, right edge at x=1248u, cell width is 1536u. Font declares 1em=2304u.

To get pixel-perfect rendering, one must choose a pt size such that (x-in-units x screendpi x ptchosen / emsize / 72) is integral.

One will find that (for a 96dpi environment) 54pt gives exact rendering. All smaller sizes therefore incur smoothing artfiacts.

Expected behavior

As many glyphs seem to share a left edge of 32 units, I suggest to move all glyph nodes left (or right) by 32u. For '0', the left edge is now at x=0 (or x=64), right edge at x=1216 (or x=1280).

64 x 96 x PT / 2304 / 72 = 1280 x 96 x PT / 2304 / 72 = ... 1536 x 96 x PT / 2304 / 72 = ...

and one finds a result of 27. Incidentally, Monocraft also has 27, so that's a good sign.