> the firefox pdf viewer has problems with at least two sans serif
> fonts.
> 
> Using this mwe I get a bad display in ff with Gyre font and Alegreya
> Font.
> 

What do you mean by "bad display"? Are the fonts blurry, or are the
shapes all slightly distorted? Your test file displays fine on my
system.

> But there are many Firefox users out there who never use a real 
> pdf-viewer. I would like to show them a good result.

I've been using Firefox (and pdf.js) as my PDF viewer almost exclusively
for the past ~2 years, and I've been using ConTeXt LMTX for about the
same amount of time. I haven't noticed any font issues, so I suspect
that this issue is system-dependant. I've mostly been on Windows for the
past few years, but I'm now on Linux, and I haven't noticed any issues
with either.

> I have no idea if the difference is the cause of the bad display.
> 
> Luckily chrome based browsers shows the fonts without any flaws.

Ok, random guess time (so I may be waaaaaay off here):

I think that this is a hinting problem. The TeX Gyre fonts are all
professionally hinted, so what might be happening be that when ConTeXt
is subsetting the fonts, it is removing all of the hinting information,
while LibreOffice is keeping all of the hints. I've opened PDFs from
ConTeXt and LibreOffice in FontForge and the hints are still there, so I
don't think that this is the case, but maybe? The hinting format is also
wildly different between Type 1 and CFF/OTF, so maybe there is just a
bug in one of the font renderers. 

Chrome uses an internal backend to render all of its text, but Firefox
uses system-dependant backends (I think). Most renderers these days will
autohint unhinted fonts using an embedded FreeType so that they still
display somewhat-well. You can adjust the "hinting strength" in
FreeType, which I would guess would usually be set to the maximum. So
LibreOffice includes the font hints and things display fine, and Chrome
uses a bundled FreeType with maximum hinting so things display fine.

Firefox on Windows would need to bundle its own FreeType since there
isn't a system one, and it renders fine in my experience. But Firefox on
Linux would just use the system FreeType. I think that you are on Linux
(?) and the default in Linux is for minimal/no hinting. Now, I've
specifically enabled maximum hinting on my system, and I'm not seeing
any problems with rendering. If you're using Gnome, can you try enabling
"full" hinting in Gnome Tweaks, reboot, then test again? No idea how to
configure this with other DEs, but I'm sure that it's possible. 

Another related guess is that older versions of FreeType maybe had a bug
with parsing/displaying hints. I think that Chrome bundles its own
FreeType which would be recent, but if you're using Firefox on Linux, it
is probably using the system FreeType library. If you're on an older LTS
distro, then the system FreeType may be really old and buggy.

If you're using macOS, I can't really help you too much except for to
say that text rendering on macOS is usually pretty bad unless you have a
really high resolution screen.

So those are my random guesses. Maybe one of them is helpful somehow.

-- Max
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
___________________________________________________________________________________

Reply via email to