FS#25499 - [fontconfig] 29-replace-bitmap-fonts.conf thwarts gsfonts

Attached to Project: Arch Linux
Opened by Ian Abbott (ijabbott) - Wednesday, 10 August 2011, 20:27 GMT
Last edited by Jan Alexander Steffens (heftig) - Friday, 11 October 2013, 14:44 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Jan de Groot (JGC)
Andreas Radke (AndyRTR)
Evangelos Foutras (foutrelis)
Jan Alexander Steffens (heftig)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 3
Private No

Details

Description:

The gsfonts package provides fonts from URW similar to the standard set of PostScript fonts with the same metrics. The /etc/fonts/conf.d/29-replace-bitmap-fonts.conf file provided by Arch Linux's fontconfig package is sub-optimal when the gsfonts package is installed.

If gsfonts is installed, the ideal substitutes for Helvetica, Times and Courier are as follows:

"Helvetica" -> "Nimbus Sans L"
"Times" -> "Nimbus Roman No9 L"
"Courier" -> "Nimbus Mono L"

The 30-metric-aliases.conf file would perform the above substitutions (unless the xorg-fonts-type1 package provides Courier or the real Adobe fonts are installed). However, the 29-replace-bitmap-fonts.conf file thwarts this as it gets in before 30-metric-aliases.conf.

29-replace-bitmap-fonts.conf replaces Helvetica, Times and Courier as follows:

"Helvetica" -> "Arial", "Liberation Sans", or "sans-serif"
"Times" -> "Times New Roman", "Liberation Serif", or "serif"
"Courier" -> "Courier New", "Liberation Mono", or "monospace"

I humbly suggest that the above replacement lists for "Helvetica", "Times" and "Courier" should begin with "Nimbus Sans L", "Nimbus Roman No9 L" and "Nimbus Mono L" respectively.

Alternatively, the existing 29-replace-bitmap-fonts.conf could be moved to 31-replace-bitmap-fonts.conf to achieve the same thing.

Additional info:
* package version(s)

fontconfig 2.8.0-1
gsfonts 1.0.7pre44-2

* config and/or log files etc.

/etc/fonts/conf.d/29-replace-bitmap-fonts.conf
/etc/fonts/conf.d/30-metric-aliases.conf

Steps to reproduce:

# pacman -S fontconfig
# pacman -S gsfonts
# pacman -S ttf-liberation
# fc-match Helvetica
# fc-match Times
# fc-match Courier

Actual results:

# fc-match Helvetica
LiberationSans-Regular.ttf: "Liberation Sans" "Regular"
# fc-match Times
LiberationSerif-Regular.ttf: "Liberation Serif" "Regular"
# fc-match Courier
LiberationMono-Regular.ttf: "Liberation Mono" "Regular"

Expected results:

# fc-match Helvetica
n019003l.pfb: "Nimbus Sans L" "Regular"
# fc-match Times
n021003l.pfb: "Nimbus Roman No9 L" "Regular"
# fc-match Courier
n022003l.pfb: "Nimbus Mono L" "Regular"
This task depends upon

Closed by  Jan Alexander Steffens (heftig)
Friday, 11 October 2013, 14:44 GMT
Reason for closing:  Fixed
Additional comments about closing:  fontconfig 2.11.0
Comment by Andreas Radke (AndyRTR) - Monday, 01 April 2013, 10:25 GMT
Is this still an issue? We had major fontconfig updates meanwhile. This is my current setup:

[andyrtr@workstation64 ~]$ fc-match Helvetica
arial.ttf: "Arial" "Normal"
[andyrtr@workstation64 ~]$ pacman -Q fontconfig gsfonts
fontconfig 2.10.2-1
gsfonts 1.0.7pre44-3
[andyrtr@workstation64 ~]$ fc-match Helvetica
arial.ttf: "Arial" "Normal"
[andyrtr@workstation64 ~]$ fc-match Times
times.ttf: "Times New Roman" "Normal"
[andyrtr@workstation64 ~]$ fc-match Courirer
DejaVuSans.ttf: "DejaVu Sans" "Book"

If there's still something to do I suggest to discuss this on the fontconfig mailing list as all distributions should be affected.

A local browser test works well here (http://zipcon.net/~swhite/docs/computers/browsers/fonttest.html).

btw: 2.10.92 coming soon to our repos doing more major rework.
Comment by Jan de Groot (JGC) - Monday, 01 April 2013, 13:05 GMT
2.10.92 is already in gnome unstable. Tested this version without the config file, looks good so far.
Comment by Ian Abbott (ijabbott) - Tuesday, 02 April 2013, 10:47 GMT
Andreas, the output from your commands suggests it's still an issue. You have gsfonts installed to get Postscript-compatible fonts and yet "fc-match Helvetica" is using "Arial" instead of the Postscript-compatible font "Nimbus Sans L". "Nimbus Sans L" has the same font metrics as Postscript "Helvetica" whereas "Arial" has very different font metrics.

There is no point discussing it on the fontconfig mailing list because the 29-replace-bitmap-fonts.conf is not part of upstream fontconfig. AFAICT it only appears in Arch Linux so this is an Arch bug, not an upstream bug.

Either of the two solutions outlined in the original bug report would work.
Comment by Evangelos Foutras (foutrelis) - Thursday, 11 April 2013, 10:56 GMT
With fontconfig 2.10.92-2 from [testing]:

$ fc-match Helvetica
helvR12-ISO8859-1.pcf.gz: "Helvetica" "Regular"

Which makes Github use this horrible bitmap font!
Comment by Andreas Radke (AndyRTR) - Thursday, 11 April 2013, 15:27 GMT
check http://zipcon.net/~swhite/docs/computers/browsers/fonttest.html

I've symlinked "ln -s /etc/fonts/conf.avail/70-no-bitmaps.conf /etc/fonts/conf.d/" to get proper browser font (Xombrero webkit gtk2) rendering with the new release. It doesn't have any effect on FF it seems.

with symlink: [andyrtr@workstation64 trunk]$ fc-match Helvetica
n019003l.pfb: "Nimbus Sans L" "Regular"

without symlink: [andyrtr@workstation64 trunk]$ fc-match Helvetica
helvR12-ISO8859-1.pcf.gz: "Helvetica" "Regular"

Can we live with that results?
Comment by Evangelos Foutras (foutrelis) - Thursday, 11 April 2013, 15:54 GMT
I tried enabling 70-no-bitmaps.conf and Firefox did switch to Nimbus Sans L on Github.

Problem with that was that I could no longer use the Terminus font in xfce4-terminal. ('fc-match terminus' would point to DejaVu Sans.)

Not sure where this leaves us...
Comment by Jan Alexander Steffens (heftig) - Saturday, 13 April 2013, 10:00 GMT
Hinting of the Nimbus fonts is noticeably poorer than the Microsoft fonts, and IMO interferes with reading.
I reinstated the replacement in the [testing] package. Select the Nimbus fonts (or the Freefonts) directly instead of using the PostScript alias, if you want them.

Recommend closing with "Won't fix."
Comment by Ian Abbott (ijabbott) - Monday, 15 April 2013, 09:56 GMT
Jan is possibly missing the point of the gsfonts package, which is to provide a poor man's (free) alternative to the 35 standard Postscript fonts with the same font metrics as the fonts they are replacing, in the same way that the "Liberation" fonts have the same font metrics as the old Microsoft Windows fonts ("Liberation Sans" having the same metrics as "Arial" for example). But Arial (and Liberation Sans) are a lot wider than Helvetica. This may make them look better on screen, but is useless as a substitute anywhere where the difference matters, for example in WYSIWIG applications where the final document will be printed in Helvetica.
Comment by Ian Abbott (ijabbott) - Saturday, 20 April 2013, 18:04 GMT
I think even if you have a _real_ Helvetica font installed, 29-replace-bitmap-fonts.conf would replace it. I'm sure that's not intended!

I'm not really sure why 29-replace-bitmap-fonts.conf is needed at all (seems like a poorly considered hack), but if one has deliberately removed the symlink to so solve a problem, it would be nice if it didn't reappear every time one upgraded the fontconfig package. Maybe the PKGBUILD could check if the symlink has been previously removed and not install it in that case. Something like:

install -m644 "$srcdir/29-replace-bitmap-fonts.conf" "$pkgdir/etc/fonts/conf.avail"
pushd $pkgdir/etc/fonts/conf.d
if [ ! -f /etc/fonts/conf.avail/29-replace-bitmap-fonts.conf -o \
-f /etc/fonts/conf.d/29-replace-bitmap-fonts.conf ]; then
ln -s /etc/fonts/conf.avail/29-replace-bitmap-fonts.conf .
fi
popd
Comment by Andreas Radke (AndyRTR) - Sunday, 07 July 2013, 10:31 GMT
I suggest to stay vanilla upstream here an leave it up to users and our wiki to solve if this is an issue for somebody.

Or bring it upstream to solve this in a proper way. Other distributions should be affected as well.
Comment by lukpod (lukpod) - Monday, 08 July 2013, 12:37 GMT
29-replace-bitmap-fonts.conf is provided by Arch, not the upstream.
Comment by Andreas Radke (AndyRTR) - Saturday, 13 July 2013, 06:48 GMT
I guess we can drop that file and leave it up to our users to add something for their wanted fonts if really needed.

That's what LFS also recommends. Back to vanilla config wherever possible. Would this break anything heavily?
Comment by Jan de Groot (JGC) - Saturday, 13 July 2013, 08:05 GMT
The problem here is bitmap fonts. If you dont install them, you will get truetype replacements anyways. If we keep the config, we should adjust it in a way that it only affects unscalable fonts, and it should replace them with something which is more metrics compatible than generic font families.
Comment by Jan Alexander Steffens (heftig) - Friday, 11 October 2013, 14:44 GMT
I put some effort into this. fontconfig 2.11.0 (currently in [testing]) has better metric replacements (which are upstream), and tex-gyre-fonts is in [extra] (providing some higher-quality PostScript substitutes).

Loading...