Closed Bug 1528065 Opened 6 years ago Closed 6 years ago

Font on website change if system font is changed too

Categories

(Firefox for Android Graveyard :: General, defect)

Firefox 67
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: timur.yildirim55, Unassigned)

Details

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0

Steps to reproduce:

  • Go to a website like "www.google.com" and search for someting
  • Look at the font
  • Change font of your phone (Via Magisk or Root font installer from Playstore)
  • Go back to "www.google.com" and search for the same thing.

Actual results:

The font on that website changed. Actually it's not only on google it's on all website that the font change with the system font

Expected results:

It shouldn't change. It should use font that google use for their website, or other website use for their website

This happened on latest nightly for android, I didn't test on Beta or Stable

It shouldn't change. It should use font that google use for their website, or other website use for their website

All those websites (including Google) specify a system font [1], so if you go about replacing that, such effects would only be expected, especially as by default, Firefox maps the generic sans-serif font family to Roboto, too.

https://i.ibb.co/rZ6fC09/Screenshot-20190214-224855.jpg

The particular manner in which that happens is still somewhat interesting, though.

Change font of your phone (Via Magisk or Root font installer from Playstore)

I assume that this works by effectively overwriting the regular Roboto font files in /system/font, right? Could it be that in that particular screenshot, the alternative font you've installed doesn't cover all possible font weight/style-combinations?
I'm not familiar with how Firefox processes fonts, but it almost feels like Firefox looks at the actual metadata (look at the "Naming table" section) instead of merely going by the file name. Therefore I'd guess that in that particular screenshot, the font you've installed doesn't include an italic variation and leaves Roboto in place for that, hence when asked to render font in Roboto, Firefox cannot find regular Roboto and then falls back to the next best font that claims to be part of the Roboto font family, which in this case happens to be the italic variation.

You might be able to fix this by going into about:config and editing the various font.name-list.sans-serif.* prefs to include the name of your replacement font, too. I think the name you need is what you find under Naming table -> fontFamily in the metadata inspector. That way, Firefox should preferentially use your new font and only fall back to Roboto if a page is using a font-weight/style that isn't supported by your replacement.

If you really want to keep using Roboto for web sites - as it seems that Android selects font files only by file name, whereas Firefox apparently looks at the font's metadata, what might work is to copy the original Roboto fonts and keep them in /system/fonts under an alternative file name. No guarantees as to whether that'll actually work, though...

[1] Google's search e.g. uses font-family: Roboto,HelveticaNeue,Arial,sans-serif;.

Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago
Resolution: --- → INVALID

Well I don't really understand everything you said haha but why is this happening on Firefox even if I check the "show web font" and also it doesn't happen on Chrome browser for Android, so Chrome browser always showing the good font for any website.. What ever the system font I'm using..

"show web font" is only relevant if a page wants the browser to download some fonts from somewhere and use those directly.

Yeah ok but then why Google Chrome browser are showing the right font on all website even if system font is changed ?

Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.