Klaus Schmidinger wrote:
> On 06/15/07 18:07, Anssi Hannula wrote:
>> Klaus Schmidinger wrote:
>>> On 06/10/07 17:53, Anssi Hannula wrote:
>>>> ...
>>>> Alternatively, you could use the fontconfig library [1] for managing 
>>>> fonts. This would also allow using using the system default fonts via 
>>>> aliases like 'sans-serif' etc, and using a font list instead of having 
>>>> to manually write the font filename via OSD.
>>>> You can get a quick idea from looking at the patch which added 
>>>> fontconfig support for mplayer [2], though of course you should look in 
>>>> fontconfig documentation instead of copying conventions from mplayer :)
>>>> [1] http://fontconfig.org/
>>>> [2] 
>>>> http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/2003-November/022218.html
>>> When I do
>>>      const char *font_name = "sans-serif";
>>>      FcInit();
>>>      FcPattern *fc_pattern = FcNameParse((FcChar8 *)font_name);
>> While fontconfig is usually configured to ignore bitmap fonts anyway, I 
>> think you should enforce that by putting this call here:
>> FcPatternAddBool(fc_pattern, FC_SCALABLE, FcTrue);
> Thanks.

Actually, I was wrong here. This won't guarantee anything, as the 
preference priorities of parameters is predefined, and the family name 
and, apparently, various other parameters (which are actually left at 
their defaults) are given a priority over the font being scalable. I was 
hit with this when trying to select FC_FAMILY "Utopia", and it kept 
returning the non-scalable version, even though a scalable version with 
the same name is available.

Solution is given here:

So it is doable, but you have to use FcFontSort() ( 
), which returns a similar FcFontSet as the FcFontList() which is used 
for the font listing, but this time the fonts are ordered according to 
the closeness of match, allowing you to pick the first font with 
FC_SCALABLE being true.


I don't know if you have noticed / thought of these already, but few tips:
- For the fixed-size font list, you can use a match of FC_SPACING being 
FC_MONO so that non-monospace fonts are not listed.
- Have a "default" (or "system default") font setting in the font list, 
which causes VDR to use the default aliases instead of user-specified font

Anssi Hannula

vdr mailing list

Reply via email to