[MPlayer-dev-eng] [PATCH] Fontconfig -font support for font_face selection / libass -font Fontconfig patterns

Adrian Stutz adrian at sttz.ch
Tue Jan 6 16:27:02 CET 2009


Any news on this patch? It's been a month now.

Also, this doesn't work together with libass. ASS treats -font as font name
by passing it as FC_FAMILY to Fontconfig, making font selection with
Fontconfig patterns unreliable. The above patch only fixes style selection
for the OSD font and subtitles not rendered by libass.

I've taken a look at libass to see if there could be an easy way around and
came up with the attached patch. It first tries to parse the family string
as a pattern before creating an empty one, as it does currently. I don't
know if that's a good idea since that means libass will try to parse any
font name as a Fontconfig pattern, even the font names from ass subtitles. I
tested both selecting a subtitle font style with -font and playing movies
with ass subtitles and both worked as expected, though.


On Sat, Dec 6, 2008 at 12:03 AM, Adrian Stutz <adrian at sttz.ch> wrote:

> Hello,
> When using Fontconfig and passing a pattern using -font, it's possible to
> select a font as well as a style. If the font styles are in one file
> however, the style selection gets lost because MPlayer only passes the
> filename to FreeType and selects the first face in the file.
> This patch gets the face index from Fontconfig and passes it along to
> Freetype to ensure the correct style is chosen.
> To reproduce, try to select a suitcase font style, like Palatino:
> mplayer -fontconfig -font "Palatino"
> mplayer -fontconfig -font "Palatino:Bold"
> mplayer -fontconfig -font "Palatino:style=Italic"
> all three display Palatino Bold Italic instead of Regular, Bold and Italic.
> With the patch, the correct style is selected.
> Greetings
> Adrian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libass_font_pattern.patch
Type: application/octet-stream
Size: 556 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20090106/71cb143e/attachment.obj>

More information about the MPlayer-dev-eng mailing list