freetype icon indicating copy to clipboard operation
freetype copied to clipboard

Round scale to nearest 26.6 fixed point.

Open dmitshur opened this issue 4 years ago • 4 comments

With this change, the computation of the scale factor becomes identical across the freetype and truetype packages, removing deviations in the font metrics that are derived from scale.

Apply the same change to the Context.PointToFixed method to keep it in sync.

The rounding computation is newer; it was introduced when the truetype.Face type was added in commit 6deea2414309d03c665a7b.

Fixes #85.

dmitshur avatar Oct 24 '21 01:10 dmitshur

I just noticed there's a Context.PointToFixed method that does the same conversion:

return fixed.Int26_6(x * float64(c.dpi) * (64.0 / 72.0))

We should not change one without also changing the other, as that would fix #85 but introduce another inconsistency within this package. Hmm.

dmitshur avatar Nov 06 '21 23:11 dmitshur

We should not change one without also changing the other, as that would fix #85 but introduce another inconsistency within this package. Hmm.

Yeah, that's unfortunate. :-/

nigeltao avatar Nov 16 '21 08:11 nigeltao

Commit https://github.com/golang/freetype/pull/86/commits/5ca484442d6b0459dd173943de3ddea9c7bf1da9 in this PR updates PointToFixed too, and https://github.com/golang/freetype/pull/86/commits/51c1af1b6d627b188e6cab7a876b03e2e895b092 adds more test cases.

dmitshur avatar Nov 16 '21 13:11 dmitshur

applied this to https://github.com/goki/freetype

rcoreilly avatar Mar 28 '23 23:03 rcoreilly