# HG changeset patch # User ib # Date 1390754449 0 # Node ID 8b2c68d6fd89d45d8375a0341b7d6de5c0471794 # Parent 780f1cf49497ca36d17b0c4aaa0fb56123229d40 Enable specifying a font file in the GUI preferences. This has been broken since the introduction of Fontconfig. Since Fontconfig is selecting fonts by font patterns and the GUI does so by selecting a font file, it is necessary to temporarily disable fontconfig font handling if there is a directory separator character found in the name (or pattern) of the font to be used, i.e. assume the font name to be a pattern if and only if it doesn't contain a directory separator character. Thus set option 'fontconfig' depending on font_name. Set it in guiInit() for the font possibly given in a configuration file or on the command line, and set it in mplayerLoadFont() whenever it is affected by GUI preferences settings. (Although the font selection dialog only allows files to be selected, it is possible to simply enter a fontconfig font pattern in the preferences' text entry field - or to enter it directly into the GUI configuration file or to specify on the command line, both of which always is possible.) diff -r 780f1cf49497 -r 8b2c68d6fd89 gui/interface.c --- a/gui/interface.c Sun Jan 26 16:20:48 2014 +0000 +++ b/gui/interface.c Sun Jan 26 16:40:49 2014 +0000 @@ -71,6 +71,15 @@ }; static int guiInitialized; +static int orig_fontconfig; + +/** + * @brief Set option 'fontconfig' depending on #font_name. + */ +static void set_fontconfig(void) +{ + font_fontconfig = (font_name && strchr(font_name, '/') ? -1 : orig_fontconfig); +} /* MPlayer -> GUI */ @@ -208,6 +217,9 @@ if (subdata) setdup(&guiInfo.SubtitleFilename, subdata->filename); + orig_fontconfig = font_fontconfig; + set_fontconfig(); + guiInitialized = True; } @@ -1071,6 +1083,8 @@ void mplayerLoadFont(void) { #ifdef CONFIG_FREETYPE + set_fontconfig(); + load_font_ft(vo_image_width, vo_image_height, &vo_font, font_name, osd_font_scale_factor); #else if (vo_font) {