Ken Deeter
2005-Nov-21 08:50 UTC
[Fontconfig] reasonable fonts for langs other than current locale
(sorry, just joined the list, so I couldn''t reply to the original message) With regards to the problem of getting good fonts for non-locale langs. It seems to me that to some extent, in situations where this problem comes up, picking fonts based on the locale is kind of pointless, since we are looking at a situation involving multiple langs to start with (Perhaps this is the same as what Keith has said already). In fact, I would argue that when multiple langs are involved, we _should_ avoid a system that relies on the current locale. My question is, instead of trying to think hard about how to make the picking algorithm smart enough, is there a way that we could just make it really easy for a user to specify per-user preferences, at the fontconfig level. It would make it kind of like how mozilla does it, but what I think to a user is most important is a script->font mapping. If there was an easy way for users to say "For english, i want font A" "For Japanese, i want font X" "For Chinese, i want font Y" "For Arabic, i want font Z" and then have fontconfig use this information when picking fonts (and falling back on some defaults when no preference is specified). So the resulting list would be: 1) Strongly bound family names 2) A set of fonts that covers the requested langs according to user preferences. 3) The rest of the fonts generated by some heuristic method. Now I think someone is going to say, ''well you can already do this, just edit your .fonts.conf'' but I think part of the point is we can''t really expect users to understand that syntax correctly, and also understand the complicated system by which fonts are picked based on the <alias>''es. Or at least, we need a way for a user to influence the process before all the ''magic'' happens. It seems easier to explain: 1) if you choose "bitsream vera sans" in your app, you will get "bitstream vera sans" 2) if you choose "bitstream vera sans" and you need Japanese characters, you will get "bitstream vera sans" plus what you picked as your "default" configuration (in some system control panel) 3) if you choose ''bistream vera sans'' and you need Japanese characters, but you didnt set a default font in your system control panel, then fontconfig will choose something for you, but don''t expect it to be perfect. I think this covers probably at least 80% of the cases where people need to view things in multiple languages. All you would need is some settings file, with one line entries, mapping languages to canonical font names. It would be easy to parse and so simple that I don''t think any of the xml stuff would be needed. Although the fonts.conf stuff is very flexible, I''m feel it is bit of overkill for most situations. Where as the fonts.conf stuff soft of feels like a programming language in XML, the per-lang preferences is just simply data. You could put it in xml, but that might be overkill too, I dunno. Anywyas, these were just my thoughts. I can''t say I have a crystal clear idea of how fontconfig picks fonts, but considering I have played with it quite a bit, it almost seems like a problem to me ;-) It should be easier than this. I think in most cases, I just want to say, for this language give me this font, regardless of whether the font is a good candidate according to fontconfig or not. If we do it this way, we give the user the amount of control he probably wants anyways, and we make fontconfig''s task a bit easier too. Ken