Closed Bug 1714282 Opened 3 years ago Closed 3 years ago

Shared font list doesn't deal correctly with bitmap fonts (was: Bitmap system font only shows at smallest available size in Firefox 89)

Categories

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

Firefox 89
defect

Tracking

()

RESOLVED FIXED
91 Branch
Tracking Status
firefox-esr78 --- unaffected
firefox89 --- fixed
firefox90 --- fixed
firefox91 --- fixed

People

(Reporter: riku, Assigned: jfkthame)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 file)

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

Steps to reproduce:

Set the system default GTK font to a bitmap font, I used the ProFont OTB build by Riku Salminen, which can be found here.
https://tobiasjung.name/profont/

Actual results:

Firefox will only display UI text at the smallest size the font has and doesn't respect system DPI or font settings.

Expected results:

This used to work just fine before Firefox 89. Firefox would display the UI text at the size configured by the system.

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 revert this change in case you think the bot is wrong.

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

I wonder if I broke this in bug 1698495; or maybe it's related to bug 1708285. Emilio, could you see if you can reproduce this?

Flags: needinfo?(emilio)

I pulled the font, set it as default system font and default firefox font, and I can't seem to reproduce a behavior difference between this and Firefox 82. But chances are I'm missing something?

Reporter, can you post an screenshot of the wrong behavior you're seeing? Alternatively, can you run mozregression to see what broke this for you? (Something like pip3 install --user mozregression && mozregression --good 88 --bad 89 should do).

Flags: needinfo?(emilio) → needinfo?(riku)

Ah, I just realized I have a newer build of the font that isn't on the website yet.
https://rekurs.io/files/EOnpQ.zip

This should be the exact same font, just the different sizes are split to separate files. I tried the single file font and that indeed seems to work fine. However, there was some reason I rebuilt it as separate files. I think there were some programs that didn't play nice with the single file version.

I tried mozregression but was unable to find a version that worked with the split font so maybe it isn't a Firefox issue. For what it's worth though, the split version didn't seem to break anywhere else.

Here's a couple of screenshots just in case (using the split font).
https://imgur.com/a/xDjzUDb

Flags: needinfo?(riku)

Ah, that I can reproduce, though it doesn't seem like a recent regression. I see a behavior change from bug 1533462, but before that we weren't even using the bitmap font... Jonathan do you know what's the expected behavior there?

Flags: needinfo?(jfkthame)

Ideally, we should choose the bitmap size that best matches the actual size requested. Normally, when a font resource has bitmap faces, this is done by ChooseFontSize. However, that is just for the case where a single font entry (corresponding to an individual font file on disk) contains multiple bitmap strikes.

In this case with the individual files, it looks like gfxFontconfigFontFamily::FindAllFontsForStyle is supposed to look for the best size match among the faces that shared the same style attributes. So we should try to understand why that's not working. Maybe fontconfig doesn't give us the appropriate FC_PIXEL_SIZE for these fonts, and so confuses the SizeDistance function?

Flags: needinfo?(jfkthame)

Pixel sizes are fine afaict:

[rr 277061 15883][Parent 277061: Main Thread]: D/fontlist (shared-fontlist) family (ProFontOTB) added face (ProFontOTB-[0 3276.75]:familylang=en:style=Regular:stylelang=en:fullname=ProFontOTB:fullnamelang=en:slant=0:weight=80:width=100:pixelsize=10:spacing=100:foundry=UNKN:antialias=False:file=/home/emilio/.local/share/fonts/ProFont\_r400-10.otb:index=0:outline=False:scalable=False:charset=20-ff:lang=aa|ay|bi|br|ch|da|de|en|es|eu|fj|fo|fur|fy|gd|gl|gv|ho|ia|id|ie|io|is|it|lb|mg|nb|nds|nl|nn|no|nr|oc|om|pt|rm|sma|smj|so|sq|ss|st|sv|sw|tl|ts|uz|vo|wa|xh|yap|zu|an|fil|ht|jv|kj|kwm|li|ms|ng|pap-an|pap-aw|rn|rw|sc|sg|sn|su|za:fontversion=65536:fontformat=TrueType:decorative=False:postscriptname=ProFontOTB:color=False:symbol=False:variable=False:fonthashint=False:order=0) index 0, weight 400, style normal, stretch 100
[rr 277061 15887][Parent 277061: Main Thread]: D/fontlist (shared-fontlist) family (ProFontOTB) added face (ProFontOTB-[0 3276.75]:familylang=en:style=Regular:stylelang=en:fullname=ProFontOTB:fullnamelang=en:slant=0:weight=80:width=100:pixelsize=11:spacing=100:foundry=UNKN:antialias=False:file=/home/emilio/.local/share/fonts/ProFont\_r400-11.otb:index=0:outline=False:scalable=False:charset=20-ff:lang=aa|ay|bi|br|ch|da|de|en|es|eu|fj|fo|fur|fy|gd|gl|gv|ho|ia|id|ie|io|is|it|lb|mg|nb|nds|nl|nn|no|nr|oc|om|pt|rm|sma|smj|so|sq|ss|st|sv|sw|tl|ts|uz|vo|wa|xh|yap|zu|an|fil|ht|jv|kj|kwm|li|ms|ng|pap-an|pap-aw|rn|rw|sc|sg|sn|su|za:fontversion=65536:fontformat=TrueType:decorative=False:postscriptname=ProFontOTB:color=False:symbol=False:variable=False:fonthashint=False:order=0) index 0, weight 400, style normal, stretch 100
[rr 277061 15891][Parent 277061: Main Thread]: D/fontlist (shared-fontlist) family (ProFontOTB) added face (ProFontOTB-[0 3276.75]:familylang=en:style=Regular:stylelang=en:fullname=ProFontOTB:fullnamelang=en:slant=0:weight=80:width=100:pixelsize=12:spacing=100:foundry=UNKN:antialias=False:file=/home/emilio/.local/share/fonts/ProFont\_r400-12.otb:index=0:outline=False:scalable=False:charset=20-ff:lang=aa|ay|bi|br|ch|da|de|en|es|eu|fj|fo|fur|fy|gd|gl|gv|ho|ia|id|ie|io|is|it|lb|mg|nb|nds|nl|nn|no|nr|oc|om|pt|rm|sma|smj|so|sq|ss|st|sv|sw|tl|ts|uz|vo|wa|xh|yap|zu|an|fil|ht|jv|kj|kwm|li|ms|ng|pap-an|pap-aw|rn|rw|sc|sg|sn|su|za:fontversion=65536:fontformat=TrueType:decorative=False:postscriptname=ProFontOTB:color=False:symbol=False:variable=False:fonthashint=False:order=0) index 0, weight 400, style normal, stretch 100
[rr 277061 15895][Parent 277061: Main Thread]: D/fontlist (shared-fontlist) family (ProFontOTB) added face (ProFontOTB-[0 3276.75]:familylang=en:style=Regular:stylelang=en:fullname=ProFontOTB:fullnamelang=en:slant=0:weight=80:width=100:pixelsize=15:spacing=100:foundry=UNKN:antialias=False:file=/home/emilio/.local/share/fonts/ProFont\_r400-15.otb:index=0:outline=False:scalable=False:charset=20-ff:lang=aa|ay|bi|br|ch|da|de|en|es|eu|fj|fo|fur|fy|gd|gl|gv|ho|ia|id|ie|io|is|it|lb|mg|nb|nds|nl|nn|no|nr|oc|om|pt|rm|sma|smj|so|sq|ss|st|sv|sw|tl|ts|uz|vo|wa|xh|yap|zu|an|fil|ht|jv|kj|kwm|li|ms|ng|pap-an|pap-aw|rn|rw|sc|sg|sn|su|za:fontversion=65536:fontformat=TrueType:decorative=False:postscriptname=ProFontOTB:color=False:symbol=False:variable=False:fonthashint=False:order=0) index 0, weight 400, style normal, stretch 100
[rr 277061 15899][Parent 277061: Main Thread]: D/fontlist (shared-fontlist) family (ProFontOTB) added face (ProFontOTB-[0 3276.75]:familylang=en:style=Regular:stylelang=en:fullname=ProFontOTB:fullnamelang=en:slant=0:weight=80:width=100:pixelsize=17:spacing=100:foundry=UNKN:antialias=False:file=/home/emilio/.local/share/fonts/ProFont\_r400-17.otb:index=0:outline=False:scalable=False:charset=20-ff:lang=aa|ay|bi|br|ch|da|de|en|es|eu|fj|fo|fur|fy|gd|gl|gv|ho|ia|id|ie|io|is|it|lb|mg|nb|nds|nl|nn|no|nr|oc|om|pt|rm|sma|smj|so|sq|ss|st|sv|sw|tl|ts|uz|vo|wa|xh|yap|zu|an|fil|ht|jv|kj|kwm|li|ms|ng|pap-an|pap-aw|rn|rw|sc|sg|sn|su|za:fontversion=65536:fontformat=TrueType:decorative=False:postscriptname=ProFontOTB:color=False:symbol=False:variable=False:fonthashint=False:order=0) index 0, weight 400, style normal, stretch 100
[rr 277061 15903][Parent 277061: Main Thread]: D/fontlist (shared-fontlist) family (ProFontOTB) added face (ProFontOTB-[0 3276.75]:familylang=en:style=Regular:stylelang=en:fullname=ProFontOTB:fullnamelang=en:slant=0:weight=80:width=100:pixelsize=22:spacing=100:foundry=UNKN:antialias=False:file=/home/emilio/.local/share/fonts/ProFont\_r400-22.otb:index=0:outline=False:scalable=False:charset=20-ff:lang=aa|ay|bi|br|ch|da|de|en|es|eu|fj|fo|fur|fy|gd|gl|gv|ho|ia|id|ie|io|is|it|lb|mg|nb|nds|nl|nn|no|nr|oc|om|pt|rm|sma|smj|so|sq|ss|st|sv|sw|tl|ts|uz|vo|wa|xh|yap|zu|an|fil|ht|jv|kj|kwm|li|ms|ng|pap-an|pap-aw|rn|rw|sc|sg|sn|su|za:fontversion=65536:fontformat=TrueType:decorative=False:postscriptname=ProFontOTB:color=False:symbol=False:variable=False:fonthashint=False:order=0) index 0, weight 400, style normal, stretch 100
[rr 277061 15907][Parent 277061: Main Thread]: D/fontlist (shared-fontlist) family (ProFontOTB) added face (ProFontOTB-[0 3276.75]:familylang=en:style=Regular:stylelang=en:fullname=ProFontOTB:fullnamelang=en:slant=0:weight=80:width=100:pixelsize=29:spacing=100:foundry=UNKN:antialias=False:file=/home/emilio/.local/share/fonts/ProFont\_r400-29.otb:index=0:outline=False:scalable=False:charset=20-ff:lang=aa|ay|bi|br|ch|da|de|en|es|eu|fj|fo|fur|fy|gd|gl|gv|ho|ia|id|ie|io|is|it|lb|mg|nb|nds|nl|nn|no|nr|oc|om|pt|rm|sma|smj|so|sq|ss|st|sv|sw|tl|ts|uz|vo|wa|xh|yap|zu|an|fil|ht|jv|kj|kwm|li|ms|ng|pap-an|pap-aw|rn|rw|sc|sg|sn|su|za:fontversion=65536:fontformat=TrueType:decorative=False:postscriptname=ProFontOTB:color=False:symbol=False:variable=False:fonthashint=False:order=0) index 0, weight 400, style normal, stretch 100
[rr 277061 15911][Parent 277061: Main Thread]: D/fontlist (shared-fontlist) family (ProFontOTB) added face (ProFontOTB-[0 3276.75]:familylang=en:style=Regular:stylelang=en:fullname=ProFontOTB:fullnamelang=en:slant=0:weight=80:width=100:pixelsize=10:spacing=100:foundry=UNKN:antialias=False:file=/home/emilio/.fonts/ProFont\_r400-10.otb:index=0:outline=False:scalable=False:charset=20-ff:lang=aa|ay|bi|br|ch|da|de|en|es|eu|fj|fo|fur|fy|gd|gl|gv|ho|ia|id|ie|io|is|it|lb|mg|nb|nds|nl|nn|no|nr|oc|om|pt|rm|sma|smj|so|sq|ss|st|sv|sw|tl|ts|uz|vo|wa|xh|yap|zu|an|fil|ht|jv|kj|kwm|li|ms|ng|pap-an|pap-aw|rn|rw|sc|sg|sn|su|za:fontversion=65536:fontformat=TrueType:decorative=False:postscriptname=ProFontOTB:color=False:symbol=False:variable=False:fonthashint=False:order=0) index 0, weight 400, style normal, stretch 100
[rr 277061 15915][Parent 277061: Main Thread]: D/fontlist (shared-fontlist) family (ProFontOTB) added face (ProFontOTB-[0 3276.75]:familylang=en:style=Regular:stylelang=en:fullname=ProFontOTB:fullnamelang=en:slant=0:weight=80:width=100:pixelsize=11:spacing=100:foundry=UNKN:antialias=False:file=/home/emilio/.fonts/ProFont\_r400-11.otb:index=0:outline=False:scalable=False:charset=20-ff:lang=aa|ay|bi|br|ch|da|de|en|es|eu|fj|fo|fur|fy|gd|gl|gv|ho|ia|id|ie|io|is|it|lb|mg|nb|nds|nl|nn|no|nr|oc|om|pt|rm|sma|smj|so|sq|ss|st|sv|sw|tl|ts|uz|vo|wa|xh|yap|zu|an|fil|ht|jv|kj|kwm|li|ms|ng|pap-an|pap-aw|rn|rw|sc|sg|sn|su|za:fontversion=65536:fontformat=TrueType:decorative=False:postscriptname=ProFontOTB:color=False:symbol=False:variable=False:fonthashint=False:order=0) index 0, weight 400, style normal, stretch 100
[rr 277061 15919][Parent 277061: Main Thread]: D/fontlist (shared-fontlist) family (ProFontOTB) added face (ProFontOTB-[0 3276.75]:familylang=en:style=Regular:stylelang=en:fullname=ProFontOTB:fullnamelang=en:slant=0:weight=80:width=100:pixelsize=12:spacing=100:foundry=UNKN:antialias=False:file=/home/emilio/.fonts/ProFont\_r400-12.otb:index=0:outline=False:scalable=False:charset=20-ff:lang=aa|ay|bi|br|ch|da|de|en|es|eu|fj|fo|fur|fy|gd|gl|gv|ho|ia|id|ie|io|is|it|lb|mg|nb|nds|nl|nn|no|nr|oc|om|pt|rm|sma|smj|so|sq|ss|st|sv|sw|tl|ts|uz|vo|wa|xh|yap|zu|an|fil|ht|jv|kj|kwm|li|ms|ng|pap-an|pap-aw|rn|rw|sc|sg|sn|su|za:fontversion=65536:fontformat=TrueType:decorative=False:postscriptname=ProFontOTB:color=False:symbol=False:variable=False:fonthashint=False:order=0) index 0, weight 400, style normal, stretch 100
[rr 277061 15923][Parent 277061: Main Thread]: D/fontlist (shared-fontlist) family (ProFontOTB) added face (ProFontOTB-[0 3276.75]:familylang=en:style=Regular:stylelang=en:fullname=ProFontOTB:fullnamelang=en:slant=0:weight=80:width=100:pixelsize=15:spacing=100:foundry=UNKN:antialias=False:file=/home/emilio/.fonts/ProFont\_r400-15.otb:index=0:outline=False:scalable=False:charset=20-ff:lang=aa|ay|bi|br|ch|da|de|en|es|eu|fj|fo|fur|fy|gd|gl|gv|ho|ia|id|ie|io|is|it|lb|mg|nb|nds|nl|nn|no|nr|oc|om|pt|rm|sma|smj|so|sq|ss|st|sv|sw|tl|ts|uz|vo|wa|xh|yap|zu|an|fil|ht|jv|kj|kwm|li|ms|ng|pap-an|pap-aw|rn|rw|sc|sg|sn|su|za:fontversion=65536:fontformat=TrueType:decorative=False:postscriptname=ProFontOTB:color=False:symbol=False:variable=False:fonthashint=False:order=0) index 0, weight 400, style normal, stretch 100
[rr 277061 15927][Parent 277061: Main Thread]: D/fontlist (shared-fontlist) family (ProFontOTB) added face (ProFontOTB-[0 3276.75]:familylang=en:style=Regular:stylelang=en:fullname=ProFontOTB:fullnamelang=en:slant=0:weight=80:width=100:pixelsize=17:spacing=100:foundry=UNKN:antialias=False:file=/home/emilio/.fonts/ProFont\_r400-17.otb:index=0:outline=False:scalable=False:charset=20-ff:lang=aa|ay|bi|br|ch|da|de|en|es|eu|fj|fo|fur|fy|gd|gl|gv|ho|ia|id|ie|io|is|it|lb|mg|nb|nds|nl|nn|no|nr|oc|om|pt|rm|sma|smj|so|sq|ss|st|sv|sw|tl|ts|uz|vo|wa|xh|yap|zu|an|fil|ht|jv|kj|kwm|li|ms|ng|pap-an|pap-aw|rn|rw|sc|sg|sn|su|za:fontversion=65536:fontformat=TrueType:decorative=False:postscriptname=ProFontOTB:color=False:symbol=False:variable=False:fonthashint=False:order=0) index 0, weight 400, style normal, stretch 100
[rr 277061 15931][Parent 277061: Main Thread]: D/fontlist (shared-fontlist) family (ProFontOTB) added face (ProFontOTB-[0 3276.75]:familylang=en:style=Regular:stylelang=en:fullname=ProFontOTB:fullnamelang=en:slant=0:weight=80:width=100:pixelsize=22:spacing=100:foundry=UNKN:antialias=False:file=/home/emilio/.fonts/ProFont\_r400-22.otb:index=0:outline=False:scalable=False:charset=20-ff:lang=aa|ay|bi|br|ch|da|de|en|es|eu|fj|fo|fur|fy|gd|gl|gv|ho|ia|id|ie|io|is|it|lb|mg|nb|nds|nl|nn|no|nr|oc|om|pt|rm|sma|smj|so|sq|ss|st|sv|sw|tl|ts|uz|vo|wa|xh|yap|zu|an|fil|ht|jv|kj|kwm|li|ms|ng|pap-an|pap-aw|rn|rw|sc|sg|sn|su|za:fontversion=65536:fontformat=TrueType:decorative=False:postscriptname=ProFontOTB:color=False:symbol=False:variable=False:fonthashint=False:order=0) index 0, weight 400, style normal, stretch 100
[rr 277061 15935][Parent 277061: Main Thread]: D/fontlist (shared-fontlist) family (ProFontOTB) added face (ProFontOTB-[0 3276.75]:familylang=en:style=Regular:stylelang=en:fullname=ProFontOTB:fullnamelang=en:slant=0:weight=80:width=100:pixelsize=29:spacing=100:foundry=UNKN:antialias=False:file=/home/emilio/.fonts/ProFont\_r400-29.otb:index=0:outline=False:scalable=False:charset=20-ff:lang=aa|ay|bi|br|ch|da|de|en|es|eu|fj|fo|fur|fy|gd|gl|gv|ho|ia|id|ie|io|is|it|lb|mg|nb|nds|nl|nn|no|nr|oc|om|pt|rm|sma|smj|so|sq|ss|st|sv|sw|tl|ts|uz|vo|wa|xh|yap|zu|an|fil|ht|jv|kj|kwm|li|ms|ng|pap-an|pap-aw|rn|rw|sc|sg|sn|su|za:fontversion=65536:fontformat=TrueType:decorative=False:postscriptname=ProFontOTB:color=False:symbol=False:variable=False:fonthashint=False:order=0) index 0, weight 400, style normal, stretch 100

However I don't see that code being executed with the shared font-list at all, which I guess is not totally unexpected. And probably we don't have an equivalent code-path for the shared font-list or something?

Yeah, so the shared font list doesn't deal at all with bitmap fonts afaict, so we just choose the first matched face.

Status: UNCONFIRMED → NEW
Ever confirmed: true

Oh, right - of course gfxFontconfigFontFamily::FindAllFontsForStyle only applies to the unshared font list; the shared list doesn't use the gfxFontFamily subclasses at all. So that's the missing piece.

Summary: Bitmap system font only shows at smallest available size in Firefox 89 → Shared font list doesn't deal correctly with bitmap fonts (was: Bitmap system font only shows at smallest available size in Firefox 89)
Assignee: nobody → jfkthame
Status: NEW → ASSIGNED
Severity: -- → S2

I think I am also experiencing this regression, I found it by the old title "Bitmap system font only shows at smallest available size in Firefox 89".

In my case, I am setup to use a bitmap Helvetica font which always incorrectly renders at 11px, despite style sheet or zoom settings, and the inspector "Fonts" shows:

Helvetica:familylang=en:style=Bold:stylelang=en:slant=0:weight=200:width=100:pixelsize=11:foundry=Adobe:antialias=False:file=/usr/share/fonts/100dpi/helvB08-ISO8859-1.pcf.gz:index=0:outline=False:scalable=False:charset=0 20-7e a0-ff:lang=aa|ay|bi|br|ch|da|de|en|es|eu|fj|fo|fur|fy|gd|gl|gv|ho|ia|id|ie|io|is|it|lb|mg|nb|nds|nl|nn|no|nr|oc|om|pt|rm|sma|smj|so|sq|ss|st|sv|sw|tl|ts|uz|vo|wa|xh|yap|zu|an|fil|ht|jv|kj|kwm|li|ms|ng|pap-an|pap-aw|rn|rw|sc|sg|sn|su|za:fontversion=0:fontformat=PCF:decorative=False:postscriptname=Helvetica:color=False:symbol=False:variable=False:fonthashint=False

This bug is seen in Slackware-current using the Mozilla distribution of Firefox 89.0, and Alpine Linux running its own firefox-89.0-r0 package. All worked fine in Firefox 88.0.1.

Yes, that sounds like this bug. A fix is on the way; in the meantime you can avoid the problem by setting gfx.e10s.font-list.shared to false in the about:config settings (and re-launching Firefox).

Pushed by jkew@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/36959879110c Handle bitmap font sizes in the shared font list on Linux. r=emilio
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 91 Branch
Regressed by: 1694174
Has Regression Range: --- → yes

Set release status flags based on info from the regressing bug 1694174

Comment on attachment 9225260 [details]
Bug 1714282 - Handle bitmap font sizes in the shared font list on Linux. r?emilio

Beta/Release Uplift Approval Request

  • User impact if declined: Bitmap font sizes on Linux are not correctly selected (generally results in tiny text)
  • Is this code covered by automated tests?: No
  • Has the fix been verified in Nightly?: Yes
  • Needs manual test from QE?: No
  • If yes, steps to reproduce:
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): No change to existing behavior for normal (scalable) fonts; only affects bitmap fonts with explicit pixel sizes, only on Linux (the touched code is mostly even #ifdef'd away for other platforms).
  • String changes made/needed:
Attachment #9225260 - Flags: approval-mozilla-beta?

Comment on attachment 9225260 [details]
Bug 1714282 - Handle bitmap font sizes in the shared font list on Linux. r?emilio

approved for 90.0b5

Attachment #9225260 - Flags: approval-mozilla-beta? → approval-mozilla-beta+

Bug 1694174 was backed out on the release channel which fixes this regression in the just released 89.0.1 version.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: