azul
azul copied to clipboard
Incorrect subpixel rendering layout with Label
Description
Font rendering with an azul::widgets::label::Label
exhibits subpixel rendering which is inconstant with my LCD layout. My monitor is RGB and Azul appears to be rendering with Vertical BGR. Attached below are a screenshots of Azul and a reference screenshot from the Plasma 5 System Settings. ~~Most apps on my system currently appears to not utilize subpixel rendering at all and I will do more checking into that however no subpixel rendering != incorrect subpixel rendering.~~(My system font rendering is correct across all apps without effect on Azul)
I could not find any references to any font rendering crates in any toml files throughout the Azul repo, is it provided by WR itself though system libraries? If so one would think that this would not be an issue as I am typing this in Firefox Nightly using WR and it has correct RGB subpixel rendering (screenshot attatched).
Version / OS
-
azul version:
master
https://github.com/maps4print/azul/commit/1eef92224e93a05ad584b88f671effa382afc7e2 -
Operating system: Manjaro Linux
-
Windowing system (X11 or Wayland, Linux only):
xorg 1.20.4-1
Additional Information
Azule
Reference from Plasma 5 System Settings
Firefox Nightly w/WebRender and correct RGB subpixel rendering
Azul uses a statically linked version of FreeType for font rendering (on Linux) and currently hard-codes the subpixel settings, it doesn't respect the system settings. The reason for that is that I have no idea how to implement it since there is no documentation on how to integrate a framework to use the system settings beside answers like "just use Qt lol". I would integrate it with the KDE settings, but I'd need to know how, that's the problem.
The Linux ecosystem has sadly just focused on patching Qt and Gnome, without standardizing the interfaces for system settings or documenting how to read / write these settings without using Qt or Gnome libraries. I'd happily support the system settings, but I need some form of guide or documentation on how to get them without using Qt or Gnome libraries.
I verified my system settings and RGB subpixel rendering is functioning across all my system, just wanted to clear that up.
If I am not mistaken if you could use the system FreeType it should load the system settings correctly (as the settings are not toolkit nor DE dependent but instead are FreeType settings)
If I am not mistaken if you could use the system FreeType it should load the system settings correctly (as the settings are not toolkit nor DE dependent but instead are FreeType settings)
Well they are settings in the KDE system settings, FreeType has to get them from somewhere. I mean, those settings have to be stored on-disk somewhere, KDE doesn't magically rewrite system libraries. I won't link against the system freetype because I've been there and the amount of bug reports for "it's not compiling" (because freetype wasn't installed), "why does it work on my computer but not my clients computer" (because of different freetype versions on different machines, etc.), packaging / dependency issues (since the app would not be a single binary anymore), etc. are not worth it. Nevermind that I can't use the system freetype, since webrender links statically against freetype, so I'd have to fork and change webrender in order to do that.
The problem is that nobody actually knows where the settings are stored, (sometimes in ~/.config
, sometimes in .kde/share/apps/
, sometimes in ~/.gtkrc
) - even though Linux is supposed to be very "open" about these things, the documentation is often very, very obscure or lacking and there are no clear standards as to where the setting.
If you can find a way to reliably find out the subpixel rendering, maybe write a crate for it and I can incorporate it into the azul-native-style
. Until then you'll sadly have to "enjoy" the bad font rendering, sorry.
This setting is not DE nor toolkit related. All FreeType settings should be stored in the paths mentioned here: https://wiki.archlinux.org/index.php/font_configuration#Fontconfig_configuration
Little excerpt from the wiki: Note: For some desktop environments (such as GNOME and KDE) using the Font Control Panel will automatically create or overwrite the user font configuration file.
If the existing FreeType version could be told to look for the system settings this issue should be resolved.
As usual in anything, please correct anything I have said which is incorrect :smile:
@ForLoveOfCats Those paths are FontConfig paths and not FreeType paths. FreeType does not depend on FontConfig. The Linux world has standardized on using FontConfig to configure FreeType applications, but Azul does not appear to be FontConfig-aware. An app is free to use FreeType without using FontConfig, if it so desires.
@fschutt As I understand it, FreeType doesn't get the settings from anywhere. GUI frameworks or FontConfig-aware apps load the saved FontConfig settings and configure FreeType through that. You would need FontConfig bindings to pick up on the system settings (or parse the XML files yourself).
An additional point of data for @fschutt:
- I don't know if it's intentional on your part, but the vast majority of consumer LCDs (well over 90% ever produced and probably 100% of what's still being produced today) are RGB and not BGR.
- Additionally, you probably want autohinting on as most (all?) fonts under Linux are not manually hinted in the TTF/OTF files.
- Is there a reason you specify
LCD_VERTICAL
? I believe that tells FreeType to load glyphs suitable for vertical text rendering whereas almost all your usages are going to be horizontal (most fonts don't have separate glyphs for that so it'll be OK for the regular case, except the webrender won't pass inFT_LOAD_TARGET_LCD
if it's used, meaning you'll at best get the results of (undeclared)FT_LOAD_TARGET_NORMAL
.