Closed Bug 1827156 Opened 3 years ago Closed 3 years ago

fontconfig fontfeature settings ignored by Firefox

Categories

(Core :: Layout: Text and Fonts, defect)

Firefox 111
defect

Tracking

()

RESOLVED FIXED
114 Branch
Tracking Status
firefox114 --- fixed

People

(Reporter: anderyos, Assigned: jfkthame)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/111.0

Steps to reproduce:

Under Linux... set global fontconfig settings to disable font ligatures... the settings is ignored by Firefox. Other apps (Gnome/GTK) honor the settings.

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
<fontconfig>
<match target="font">
<test name="family" compare="eq" ignore-blanks="true">
<string>Outfit</string>
</test>
<edit name="fontfeatures" mode="append">
<string>liga off</string>
</edit>
</match>
</fontconfig>

Actual results:

Font ligatures still enabled in Firefox

Expected results:

Firefox should honor user's fontconfig fontfeature settings as per Bug 1744765 (and merged patch).

The Bugbug bot thinks this bug should belong to the 'Core::Layout: Text and Fonts' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Layout: Text and Fonts
Product: Firefox → Core

Adding the following block on Ubuntu 22.04 to ~/.config/fontconfig/fonts.conf:

<match target="font">
  <test name="family" compare="eq" ignore-blanks="true">
    <string>DejaVu Serif</string>
  </test>
  <edit name="fontfeatures" mode="append">
    <string>liga off</string>
  </edit>
</match>

Running echo -e "| worksheet |\n| buffering |\n| difficult |\n| finishing |\n| different |\n| efficient |" | pango-view --font="Dejavu Serif" --dpi 300 /dev/stdin (Example taken from ArchWiki) shows the difference but Firefox with

<!DOCTYPE html>
<style>
* {
  font-family: "Dejavu Serif";
}
</style>
worksheet<br>
buffering<br>
difficult<br>
finishing<br>
different<br>
efficient

Does not.

Severity: -- → S3
Status: UNCONFIRMED → NEW
Ever confirmed: true

We're supposed to handle them here I believe.

I haven't found much documentation about this, but from testing, it appears that it's necessary to call FcConfigSubstitute on the pattern with the kind parameter set to FcMatchFont in order for settings like this to be incorporated into the FcPattern. With this addition to our pattern initialization, the fontfeatures property behaves as expected.

Assignee: nobody → jfkthame
Status: NEW → ASSIGNED
Pushed by jkew@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/4f09c16c5434 Ensure custom fontconfig per-font settings such as fontfeatures are picked up. r=gfx-reviewers,lsalzman
Pushed by jkew@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/7a4fe637c12a Ensure custom fontconfig per-font settings such as fontfeatures are picked up. r=gfx-reviewers,lsalzman
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 114 Branch
Flags: needinfo?(jfkthame)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: