Re: [ANNOUNCE] VDR developer version 1.5.3

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

>>      FcConfigSubstitute(0, fc_pattern, FcMatchPattern);
>>      FcDefaultSubstitute(fc_pattern);
>>      fc_pattern = FcFontMatch(0, fc_pattern, 0);
>>      FcChar8 *s;
>>      FcPatternGetString(fc_pattern, FC_FILE, 0, &s);
>>      fprintf(stderr, "font '%s'\n", s);//XXX
>>      free(fc_pattern);
> 
> Use FcPatternDestroy(fc_pattern) instead, using free() here causes an 
> error for me.
> 
>>      FcFini();
>>
>> it prints
>>
>>   font '/usr/share/fonts/truetype/arial.ttf'
>>
>> which looks good. However, when I use "courier" instead of "sans-serif", I get
>>
>>   font '/usr/share/fonts/URW/n022003l.pfb'
>>
>> which is not a truetype font and therefore can't be used with VDR's font rendering.
> 
> Hmm... AFAIK it is scalable and freetype can use it. Or is there some 
> another restriction regarding VDR font rendering?

Well, I was wrong here. I assumed that Freetype could only handle *.ttf
files, but I've explicitly tried /usr/share/fonts/URW/n022003l.pfb now
and it works just fine.

>> Is there a way to make fontconfig only return truetype fonts?
>>
>>
>> Also: is there a way to get a list of available truetype fonts from
>> fontconfig? That's what would be needed to allow the user to select
>> a desired font in VDR's Setup/OSD menu.
> 
> Gathering from 
> http://www.xemacs.org/Documentation/packages/html/fontconfig_3.html , it 
> can be done with something like this:
> 
> // what info is requested:
> FcObjectSet *os  = FcObjectSetBuild(FC_FAMILY, NULL);
> // what fonts are requested:
> FcPattern   *pat = FcPatternBuild(NULL, FC_SCALABLE, FcTypeBool, FcTrue, 
> NULL);
> FcFontSet* fontset = FcFontList(0, pat, os);
> FcObjectSetDestroy(os);
> FcPatternDestroy(pat);
>          for (int i = 0; i < fontset->nfont ; i++) {
>                  FcChar8 *t;
>                  FcPatternGetString(fontset->fonts[i], FC_FAMILY, 0, &t);
>                  fprintf(stderr, "font '%s'\n", t);
>          }
> FcFontSetDestroy(fontset);

Thanks, I'll give this a shot.

Klaus

_______________________________________________
vdr mailing list
vdr@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr

[Index of Archives]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Big List of Linux Books]     [Fedora Users]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux