|
Packit |
46375d |
▶ Documentation for remapping-font-template.conf
|
|
Packit |
46375d |
|
|
Packit |
46375d |
This advanced template makes it possible to remap bad font metadata to correct
|
|
Packit |
46375d |
values at the fontconfig level. It is composed of four rules:
|
|
Packit |
46375d |
— the first one (the actual remapping block) detects fonts that declare
|
|
Packit |
46375d |
[problemfontname],[problemfontstyle] and remaps them to
|
|
Packit |
46375d |
[correctedfontname],[correctedfontstyle]. You can remap other attributes, use
|
|
Packit |
46375d |
fc-query to see what a font file declares and fc-scan to check how you
|
|
Packit |
46375d |
corrected it.
|
|
Packit |
46375d |
— the second one is similar to our substitution rule, and is used to alias
|
|
Packit |
46375d |
[problemfontname] to [correctedfontstyle]. This is necessary to avoid
|
|
Packit |
46375d |
breaking documents that reference the broken font naming hidden by the
|
|
Packit |
46375d |
previous rule. (it does not take the style into account because
|
|
Packit |
46375d |
unfortunately fontconfig can not handle it right now)
|
|
Packit |
46375d |
— the third one tells fontconfig it can use the font named [correctedfontname]
|
|
Packit |
46375d |
when an application asks for the generic family [genericname].
|
|
Packit |
46375d |
— the fourth one tells fontconfig it can complete the font named
|
|
Packit |
46375d |
[correctedfontname] with glyphs taken from fonts registered under
|
|
Packit |
46375d |
[genericname].
|
|
Packit |
46375d |
|
|
Packit |
46375d |
If the problem font includes more than one style, you will have to repeat the
|
|
Packit |
46375d |
two first blocks for each [problemfontname],[problemfontstyle] couple needing
|
|
Packit |
46375d |
fixing. The two last rules are similar to what we do in all our other
|
|
Packit |
46375d |
patterns.
|
|
Packit |
46375d |
|
|
Packit |
46375d |
This kind of remapping is necessary because there were few conventions for font
|
|
Packit |
46375d |
naming for a long time, and some font creators put random garbage in there
|
|
Packit |
46375d |
(also some fonts were converted from older legacy formats while keeping
|
|
Packit |
46375d |
the metadata limitations of those formats, and some authors even released fonts
|
|
Packit |
46375d |
with plain typos in their metadata). Now that the two main companies behind the
|
|
Packit |
46375d |
OpenType spec, Adobe and Microsoft, specified strict conventions (to help
|
|
Packit |
46375d |
applications make sense of available fonts), all those font files need to be
|
|
Packit |
46375d |
fixed.
|
|
Packit |
46375d |
|
|
Packit |
46375d |
Such problems should always be reported upstream first.
|
|
Packit |
46375d |
|
|
Packit |
46375d |
Unfortunately, upstream can take a long time to act, and meanwhile the problem
|
|
Packit |
46375d |
metadata will appear in font lists and confuse applications. Since fixing font
|
|
Packit |
46375d |
files downstream is unpalatable when they are not released as fontforge SFD
|
|
Packit |
46375d |
files (otherwise, just patch the sfds and re-generate), using fontconfig to
|
|
Packit |
46375d |
hide the breakage is very convenient.
|
|
Packit |
46375d |
|
|
Packit |
46375d |
If you have different needs, take a look at the other templates.
|
|
Packit |
46375d |
|
|
Packit |
46375d |
Please replace [problemfontname], [problemfontstyle], [correctedfontname],
|
|
Packit |
46375d |
[correctedfontstyle], [genericname], with the
|
|
Packit |
46375d |
appropriate values in the following blocks of instructions.
|
|
Packit |
46375d |
|
|
Packit |
46375d |
A [correctedfontname] example would be:
|
|
Packit |
46375d |
DejaVu Sans
|
|
Packit |
46375d |
It's the name under which the font appears in GUI font drop-downs.
|
|
Packit |
46375d |
|
|
Packit |
46375d |
[correctedfontname] and [correctedfontstyle] values should aim to conform
|
|
Packit |
46375d |
strictly to the rules defined by Microsoft in its WWS fonts white-paper:
|
|
Packit |
46375d |
http://blogs.msdn.com/text/attachment/2249036.ashx
|
|
Packit |
46375d |
|
|
Packit |
46375d |
Adobe published an introduction to the WWS logic here:
|
|
Packit |
46375d |
http://blogs.adobe.com/typblography/typotechnica2007/Font%20names.pdf
|
|
Packit |
46375d |
|
|
Packit |
46375d |
Fontconfig generics ([genericname]) currently include:
|
|
Packit |
46375d |
— sans-serif
|
|
Packit |
46375d |
— serif
|
|
Packit |
46375d |
— monospace
|
|
Packit |
46375d |
— fantasy
|
|
Packit |
46375d |
– cursive
|
|
Packit |
46375d |
|
|
Packit |
46375d |
Processing the resulting file through xmllint with the "format" flag is usually
|
|
Packit |
46375d |
a good idea.
|
|
Packit |
46375d |
$ xmllint --format -o [XX]-[fontname].conf [yourfile]
|
|
Packit |
46375d |
The output file will be named:
|
|
Packit |
46375d |
[XX]-[fontname].conf
|
|
Packit |
46375d |
where [XX] should be a two-digit number corresponding to the font priority in
|
|
Packit |
46375d |
fontconfig.
|
|
Packit |
46375d |
|
|
Packit |
46375d |
© 2009 Nicolas Mailhot <nim at fedoraproject dot org>
|