Miracode icon indicating copy to clipboard operation
Miracode copied to clipboard

Pixel-perfect rendering at medium size impeded

Open jengelh opened this issue 1 year ago • 0 comments

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.

  • 32 x 96 x PT / 2304 / 72 = ...
  • 1248 x 96 x PT / 2304 / 72 = ...
  • 1536 x 96 x PT / 2304 / 72 = ...

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.

jengelh avatar Apr 17 '24 13:04 jengelh