drracket icon indicating copy to clipboard operation
drracket copied to clipboard

Where is drracket-core-lib/drracket/private/font.rkt getting the smoothing settings from?

Open Sunspark-007 opened this issue 6 months ago • 6 comments

Hi, on Windows I never updated DrRacket past 8.5 because the font smoothing values changed for the worse.

On Linux I have 8.17 flatpak installed and I do know my way around a fontconfig file and environment variables but I need to understand how DrRacket knows what and where to set for None, Some and All so I can see if I can make suggestions on making it better.

The file in the path in the subject line doesn't provide values, just calls something else. I can tell it is not using the values I have defined in the system.

From pixel-peeping I can tell that "All" is using sub-pixel with the colour fringes, "Some" is using greyscale. But settings for hinting, lcdfilter, etc. seem like they need to be adjusted for all 3 categories. Freetype interpreter version # as well makes a difference.

Is there a place where these values are defined? I know it is doing its own thing because it does on Windows.

Sunspark-007 avatar May 20 '25 17:05 Sunspark-007

That code is getting and setting the values in the preferences file. Then other places are using that value. You might want one of these locations: https://github.com/search?q=repo%3Aracket%2Fgui%20smoothing&type=code

samth avatar May 20 '25 20:05 samth

Thanks for the link. I looked at all of it, it's not clear to me, but is it calling a proprietary implementation of font rendering instead of simply using freetype?

Sunspark-007 avatar May 20 '25 23:05 Sunspark-007

The smoothing setting is eventually sent on to Cairo here, and then Cairo is driving Freetype: https://github.com/racket/draw/blob/master/draw-lib/racket/draw/private/dc.rkt#L627

mflatt avatar May 21 '25 00:05 mflatt

Also related, it appears that we upgraded from Cairo v1.14.12 to v1.16.0 for Racket v8.6, and from Freetype v2.9 to v2.12.1.

If the library upgrades should not have affected anything, it's possible that we inadvertently changed some compilation options for those libraries in a way that affected font rendering.

mflatt avatar May 21 '25 00:05 mflatt

... and in the just-released v8.17, we upgraded to Cairo v1.18.2. (These library versions are relevant for Windows, not Linux.)

mflatt avatar May 21 '25 00:05 mflatt

Hmm.. it is worth considering updating to Freetype 2.13.3 as the changelog states "- The B/W rasterizer has received a major upkeep that results in large performance improvements. The rendering speed has increased and even doubled for very complex glyphs."

Compilation options.. freetype turned on the bytecode interpreter by default as of 2.4, but it would be good to check to see if the compilation option had it turned off for legal reasons from years ago then never re-enabled because it was out of sight.

Sunspark-007 avatar May 21 '25 05:05 Sunspark-007