Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.

Bug 1965684

Summary: Fontconfig & Firefox font issues on KDE Spins since F32
Product: [Fedora] Fedora Reporter: pk <pimk1n>
Component: fontconfigAssignee: Akira TAGOH <tagoh>
Status: NEW --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 34CC: ajax, caillon+fedoraproject, fonts-bugs, gnome-sig, i18n-bugs, jdluhos, mclasen, pnemade, rhughes, rstrode, sandmann, tagoh
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
reddit.com poor font rendering
none
bugzilla poor font rendering
none
Firefox showing font issues with default config none

Description pk 2021-05-28 19:56:57 UTC
Created attachment 1787942 [details]
reddit.com poor font rendering

Description of problem:
Since F32 the KDE Spin has required manual creation of a local fontconfig in order to restore font rendering quality in Firefox back to standards seen in prior releases.

Version-Release number of selected component (if applicable):
F32 KDE onwards, Firefox 78 onwards.

How reproducible:
100% F32 KDE, F33 KDE, F34 KDE Spin
Reproducible with Fedora packaged Firefox, mozilla flatpak and direct Mozilla download.
Confirmed on various hardware, all under X11.

Steps to Reproduce:
1. Open Firefox (KDE Spin)
2. Observe lack of smooth font rendering. eg: https://old.reddit.com, https://bugzilla.redhat.org
3.

Actual results:
Poor quality font rendering, see screenshots.

Expected results:
Better quality font rendering, as seen in earlier Fedora 31 KDE and all tested  modern KDE distros.

Additional info:
I have tried reporting this against Firefox since F32 Beta, but no fix.
https://bugzilla.redhat.com/show_bug.cgi?id=1830509

The single end user fix is simple, just create a ~/.config/fontconfig/fonts.conf as below, run fc-cache and restart Firefox.

<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
    <match target="font">
        <edit name="antialias" mode="assign">
            <bool>true</bool>
        </edit>
        <edit name="autohint" mode="assign">
            <bool>false</bool>
        </edit>
        <edit name="hinting" mode="assign">
            <bool>true</bool>
        </edit>
        <edit name="hintstyle" mode="assign">
            <const>hintslight</const>
        </edit>
        <edit name="lcdfilter" mode="assign">
            <const>lcddefault</const>
        </edit>
        <edit name="rgba" mode="assign">
            <const>rgb</const>
        </edit>
    </match>
</fontconfig>

What changed with KDE or Firefox around F32 time that other distros have accounted for, but Fedora has not?

Would love to see Firefox back to usual quality in KDE spin, by default, so new users do not get this.
If this is still not the correct package to report against, please point me in the right direction.

Comment 1 pk 2021-05-28 19:57:35 UTC
Created attachment 1787943 [details]
bugzilla poor font rendering

Comment 2 Akira TAGOH 2021-05-31 06:19:31 UTC
Did you really need to enable those all properties? basically most desktops has default values for them and currently fontconfig's default configuration is respecting them and is for something not having such default values.

That screenshot looks like making some difference between hinting. we have 10-hinting-slight.conf enabled by default but as I said still respecting desktop's default. so if you drop hintstyle change from your conf and still see "poor rendering" you said, I'm afraid that's not our problem.

Anyway good to try finding out what the root cause are.

Comment 3 pk 2021-06-11 09:34:37 UTC
Created attachment 1790152 [details]
Firefox showing font issues with default config

Recent reddit post suggesting Firefox specific issue has fix that greatly improves the fonts for me (as new attachment)
This has been a problem with Firefox, but only in Fedora, for 3 releases.

>> Firefox also ignores the filter so you'll need to do this as well: sudo ln -s /usr/share/fontconfig/conf.avail/11-lcdfilter-default.conf /etc/fonts/conf.d


https://old.reddit.com/r/Fedora/comments/nwyva5/how_to_improve_fonts_on_fedora_34/h1cd0oh/

Comment 4 Akira TAGOH 2021-06-15 04:46:09 UTC
From FreeType docs:
Since 2.10.3 the LCD filtering is enabled with FT_LCD_FILTER_DEFAULT. It is no longer necessary to call this function explicitly except to choose a different filter or disable filtering altogether with FT_LCD_FILTER_NONE.

Even if we don't explicitly have 11-lcdfilter-default.conf enabled, FreeType should deal with it properly. if you still really see difference with it, something might be wrong.

Comment 5 pk 2021-06-15 21:27:31 UTC
Retested from live ISO of F32 KDE spin and confirmed issue present in Firefox and adding symlink to 11-lcdfilter-default.conf does resolve.
This has freetype 2.10.1-2 & firefox 75.0-1.

F32 is when I first noticed it, not an issue in F31.

Debian 11 KDE has 11-lcdfilter-default.conf symlink by default and no font issue in Firefox, openSUSE Tumbleweed KDE appears to work a bit differently, but also not showing this issue.

Comment 6 Akira TAGOH 2021-06-16 04:18:42 UTC
Please try the supported releases. Fedora 32 has been EOL'd. and we have 2.10.4 in all the supported releases[1], which uses FT_LCD_FILTER_DEFAULT as the above docs says.

[1]...https://src.fedoraproject.org/rpms/freetype

Comment 7 pk 2021-06-16 14:10:22 UTC
I retested with F32 KDE as this is when issue started, and thought it might predate freetype 2.10.3 you mentioned, which it does.

This issue is present in all KDE spin releases since F32, it is present in F33 and F34.
It is not present in F34 Gnome. 
Adding the lcdfilter symlink under the Gnome workstation does nothing that I could see, but give noticable quality improvement under KDE spin. This brings KDE spin back to parity with prior releases, and other KDE distrobutions.

You can reproduce just by booting a KDE spin iso and opening Firefox.

Thanks for replying.

Comment 8 Akira TAGOH 2021-07-08 12:27:24 UTC
*** Bug 1830509 has been marked as a duplicate of this bug. ***