mooman219 / fontdue

The fastest font renderer in the world, written in pure rust.
Apache License 2.0
1.44k stars 72 forks source link

Visual quality regressions #23

Closed MarimeGui closed 4 years ago

MarimeGui commented 4 years ago

Hello again !

After upgrading my console from version 0.0.4 to 0.1.0 of fontdue, visual quality of the rendered characters significantly degraded.

Here is what it looked like before: Old

This is what it looks like now: New

(I am using font size 15.0 btw)

Certain characters look different, just slightly "denser" or "thinner" in certain areas. This is especially visible on 'o', 'a', 'g' and 'c' characters (mostly the ones that curve apparently).

It traced it back to this commit, fixing the std problem where std ops were used by implementing a custom atan2 fn.

I tried replacing it by copy-pasting the one found in libm, and it fixed this issue, restoring back the look before this commit.

I tried looking for what's wrong in the new code, but I'm not smart enough sadly.

Do you think a fix is possible ?

Thanks again, Marime Gui

mooman219 commented 4 years ago

A test font I used showed no diff with the new atan2, but my test font is kinda bad. I'll swap to libm's correct atan2 since this doesn't impact performance, all these slower math bits are part of the precomputation on font creation and not the raster pipeline. Thanks for catching this.

mooman219 commented 4 years ago

Can you give it a try with Sun's atan function (what libm uses)? I assume for fonts with not enough curves, the inaccuracy actually looks bad. The fonts I test with all are wall over done with geometry (Like roboto). Here's the commit: https://github.com/mooman219/fontdue/commit/f0054b67a709d953ab19107dbdb20616e62a908c

MarimeGui commented 4 years ago

Yup, that seems to have done the trick ! The rendered characters look exactly like before ! Thanks for the swift modification, I'll close this now.

mooman219 commented 4 years ago

Awesome, I'll publish 0.1.1 today eventually