Re: subpixel text rendering on Linux
Jeroen van der Zijp <[email protected]>
| Newsgroups | gmane.comp.lib.fox-toolkit.user |
|---|---|
| Organization | FOX Toolkit |
| Message-ID | <20220930001933.2df1e7df@leviathan> |
On Thu, 29 Sep 2022 22:15:19 +0200 Francesco Abbate <[email protected]> wrote: >Dear Jeroen, > >I have another question completely unrelated to the previous one. > >I noticed that on Linux the FOX library draws the text using grayscale >rendering irrespective of the text rendering setting of the host system, >for example GNOME. > >That happens using the Xft option that I use now by default. > >My question is, why is grayscale smoothing always used and is there any way >to align the text rendering with the host system or, in alternative, to >force subpixel smoothing ? > >To put this in perspective: the FOX library looks quite fine on Windows >where the text rendering is done like a native application but on Linux the >FOX applications looks out of place and one of the reasons is that text >rendering clashes with those of native applications because of the >grayscale. > >Thanks in advance for all comments or help. > >Kind regards >Francesco Well, Turns out, we *can* enable the "ClearType" appearance in FOX, even w/o me updating any code. The reason is, its already supported! Here's how to enable: In file: ~/.config/fox.rc Which is the main registry setting affecting all FOX applications on your machine, you can add the following lines: [Xft] rgba=bgr hintstyle=full hinting=true autohint=false antialias=true The first line affects the clear-type support. The other one of interest is "hinting" which mostly affects small font pitch sizes: it ensures text remains legible even when small. The other ones are flags, enabling these features. I know of no way to obtain the sub-pixel RGB element-ordering of the monitor attached to the computer [and if there's more than one, hopefully they both have the same RGB in-pixel ordering]. Perhaps there's an API for it. I don't know if this information is passed through from the display to the connected computer, or if the value set via desktop config is available via some API. At any rate, we have our own settings database. FOX applications have three levels of configurables: 1) For All FOX applications (~/.config/fox.rc on Linux, C:\Program Files\fox.ini or C:\Windows\fox.ini on Windows (if ascii mode in effect)). 2) For all applications from certain vendor key [this is why you may want to pass a vendor-key when creating FXApp]. Appropriate if you e.g. want to give all applications in your collection the same background color, or special file associations. 3) For the application itself only. We read them in this order, and configuration values loaded later override the ones loaded earlier; apart from these three files, there's another group of these in system-wide folder (/etc/xdg on Linux; not available on Windows). We therefore try to load 6 config files when starting an application. Usually it is found only in ~/.config/fox.rc and the ~/.config/AppName.rc files, however. So depending on which FOX programs should see this change, put it in one of these files. When an application quits, only the per-application configs are written, unless you write explicit code to do differently. The ControlPanel does this, for instance; the FOX ControlPanel can control common settings affecting all FOX applications so that File Bindings, colors, etc. can be centrally configured. You could argue that these Xft configs should have been settings that could be adjusted by the ControlPanel... And you'd be right! -- JVZ P.S. Added these to my own fox.rc and the sub-pixel hinting is indeed now available. So it should work. -- +----------------------------------------------------------------------------+ | Copyright (C) 23:40 09/29/2022 Jeroen van der Zijp. All Rights Reserved. | +----------------------------------------------------------------------------+