Le mercredi 21 janvier 2009 à 18:24 -0500, Michal Nowak a écrit :
As part of forcing my font packages to comply with F11 font
rules I created fontconfig configuration file.
(note that the fontconfig part is optional, though a well-written
font-config ruleset is much better than none at all)
I am far from being expert on fontconfig, be patient with me,
I see I'll have to explain the fontconfig model here. In traditional
font systems, apps request a font name and style, and it is either
available, and things works, or it's not, and things fail (for apps
still using the legacy core X11 font system fail = crash). This is
usually mitigated by the possibility to declare aliases, so you can fake
one font with another (but if the app requests something else than your
alias, or your alias points to a missing font, or this font does not
have the glyphs needed to render your text, still failure).
In the fontconfig model, if an app demands a font that does not exist,
or that is missing a glyph, fontconfig will automatically substitute
another font or complete the font from glyphs form other fonts (unless
there is no font *at all* with the necessary glyph on system).
So the purpose of our fontconfig files is not to make fontconfig perform
substitutions, it is to help fontconfig select the right font when doing
so (bear in mind that all other fonts on system that include the same
glyph will be competing with your font during this stage).
An app can ask for an actual font name or a "fake" font name such as
sans, serif, monospace, cursive, fantasy (the 5 W3C CSS aliases).
If it's a real font name and the font is present on-system all is yummy.
If it's a real font name, and the font is not present on-system, and
there is no specific rule telling fontconfig "try this other font when
asked for the first one" fontconfig will just go through the fonts
declared as part of the fake 'sans' family till it finds one that is
both available and contains the needed glyphs.
If it's a css name, fontconfig will walk though its associated priority
So, to help fontconfig you need:
1. to declare to it what fonts you can substitute for (usually when your
font and those other fonts share the same origin). You don't need to do
it for unrelated fonts that only share the same unicode coverage,
fontconfig will figure this out by itself (thus, unless your font and
paktype or kcacs share the same design, you should not declare
substitution rules for them just because they're all arabic fonts)
2. insert your font in the CSS family it belongs to, after better fonts
and before worse fonts
3. tell fontconfig it should complete your font from glyphs taken from
this family in priority.
Which is all pretty simple to understand.
The special case that sucks big time is when an unicode block is used by
different locales, and they disagree on the best way to draw it. In that
case you need to push your font first but *only* for the locales it's
Thus, you need to
1. declare unikurd in the right css family at the right priority
2. tell fontconfig it should complete unikurd from this css family in
3. and since arabic is one of the unicode blocks which is drawn
differently in some part of the world, add a "I'm best for foo kurd
locale" override to it
Thanksfuly Behdad has a vested interest in making sure you won't mess
Persian too much so he'll likely help and review your fontconfig file.