[Fontconfig] Making all Roboto font weights work on Ubuntu 14.04

Dan Cătălin Burzo danburzo at gmail.com
Wed Jan 27 01:01:55 PST 2016


Hi everyone,

I have a problem with getting the font weights for Roboto (and other Google
Fonts) to work on Ubuntu 14.04 (fontconfig 2.11.0).

*Problem*

We use Phantom.js on an Ubuntu 14.04 server for exporting pages that
contain web fonts, which we've installed locally from
https://github.com/google/fonts

A webpage containing all font weights (roman + italic) for Roboto outputs
this PDF: https://www.dropbox.com/s/3q5eanoqaimc0jx/project.pdf?dl=0

And the embedded fonts are as follows, based on running `strings file.pdf |
grep "FontName"`:

/FontName /QNBAAA+Roboto-Thin
/FontName /QCCAAA+Roboto-Regular
/FontName /QSBAAA+Roboto-Bold
/FontName /QHCAAA+Roboto-Black
/FontName /QYAAAA+Roboto-LightItalic
/FontName /QDBAAA+Roboto-MediumItalic
/FontName /QXBAAA+Roboto-BoldItalic
/FontName /QIBAAA+Roboto-BlackItalic



*What I've tried*
I came across this repository https://github.com/andreasf/Roboto/ which
states it's *"A fontconfig-compatible version of the Roboto font family"*.
It got me thinking "Of course, there must be something wrong with the
metadata!" (although installing those versions of Roboto still did not fix
the issue), and that led me through several hours of tinkering with the
font medatata with the *fonttools* https://github.com/behdad/fonttools/
library -- which is amazing btw -- but that did not help, regardless of the
various combinations of values in the naming table and OS/2 flags
(usWidthClass / fsSelection / etc).

I then found this bug https://bugs.freedesktop.org/show_bug.cgi?id=81453
which suggests that *fontconfig 2.11.91* has some fixes related with the
improper mapping between weights and font files, but it seems the latest
version released for Ubuntu is 2.11.0 (on our 14.04 version) or 2.11.1 (on
later versions).



*Questions*
* Is there a way to get the font weight fixes up and running on Ubuntu
14.04?
* Alternatively, is there a way to make fonts with multiple weights work on
the current setup? (fontconfig 2.11.0) -- It's still not clear for me what
font metadata gets taken into consideration when deciding which font
corresponds to each weight -- is there some source code I can take a look
at?
* Is the limitation of not being able to have more than 4 font files
sharing the same Font Family in the name table nameID = 1 still relevant?
Does it fall back to nameID 16 & 17 (Typographic Family Name / Typographic
Subfamily Name) if they are present?

~

Thank you very much! And sorry if I'm asking any stupid questions, I'm in
way over my head with this :-)

Bests,
Dan B.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/fontconfig/attachments/20160127/e3593c17/attachment.html>


More information about the Fontconfig mailing list