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.htm...
When I do
const char *font_name = "sans-serif"; FcInit(); FcPattern *fc_pattern = FcNameParse((FcChar8 *)font_name); 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); 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.
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.
Klaus