Initial commit
[profile/ivi/fontpackages.git] / fontconfig-templates / remapping-font-template.txt
1 ▶ Documentation for remapping-font-template.conf
2
3 This advanced template makes it possible to remap bad font metadata to correct
4 values at the fontconfig level. It is composed of four rules:
5 — the first one (the actual remapping block) detects fonts that declare
6   [problemfontname],[problemfontstyle] and remaps them to
7   [correctedfontname],[correctedfontstyle]. You can remap other attributes, use
8   fc-query to see what a font file declares and fc-scan to check how you
9   corrected it.
10 — the second one is similar to our substitution rule, and is used to alias
11   [problemfontname] to [correctedfontstyle]. This is necessary to avoid
12   breaking documents that reference the broken font naming hidden by the
13   previous rule. (it does not take the style into account because
14   unfortunately fontconfig can not handle it right now)
15 — the third one tells fontconfig it can use the font named [correctedfontname]
16   when an application asks for the generic family [genericname].
17 — the fourth one tells fontconfig it can complete the font named
18   [correctedfontname] with glyphs taken from fonts registered under
19   [genericname].
20
21 If the problem font includes more than one style, you will have to repeat the
22 two first blocks for each [problemfontname],[problemfontstyle] couple needing
23 fixing. The two last rules are similar to what we do in all our other
24 patterns.
25
26 This kind of remapping is necessary because there were few conventions for font
27 naming for a long time, and some font creators put random garbage in there
28 (also some fonts were converted from older legacy formats while keeping
29 the metadata limitations of those formats, and some authors even released fonts
30 with plain typos in their metadata). Now that the two main companies behind the
31 OpenType spec, Adobe and Microsoft, specified strict conventions (to help
32 applications make sense of available fonts), all those font files need to be
33 fixed.
34
35 Such problems should always be reported upstream first.
36
37 Unfortunately, upstream can take a long time to act, and meanwhile the problem
38 metadata will appear in font lists and confuse applications. Since fixing font
39 files downstream is unpalatable when they are not released as fontforge SFD
40 files (otherwise, just patch the sfds and re-generate), using fontconfig to
41 hide the breakage is very convenient.
42
43 If you have different needs, take a look at the other templates.
44
45 Please replace [problemfontname], [problemfontstyle], [correctedfontname],
46 [correctedfontstyle], [genericname], with the
47 appropriate values in the following blocks of instructions.
48
49 A [correctedfontname] example would be:
50 DejaVu Sans
51 It's the name under which the font appears in GUI font drop-downs.
52
53 [correctedfontname] and [correctedfontstyle] values should aim to conform
54 strictly to the rules defined by Microsoft in its WWS fonts white-paper:
55 http://blogs.msdn.com/text/attachment/2249036.ashx
56
57 Adobe published an introduction to the WWS logic here:
58 http://blogs.adobe.com/typblography/typotechnica2007/Font%20names.pdf
59
60 Fontconfig generics ([genericname]) currently include:
61 — sans-serif
62 — serif
63 — monospace
64 — fantasy
65 – cursive
66
67 Processing the resulting file through xmllint with the "format" flag is usually
68 a good idea.
69 $ xmllint --format -o [XX]-[fontname].conf [yourfile]
70 The output file will be named:
71 [XX]-[fontname].conf
72 where [XX] should be a two-digit number corresponding to the font priority in
73 fontconfig.
74
75 © 2009 Nicolas Mailhot <nim at fedoraproject dot org>