summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--DOCS/man/en/mplayer.18
-rw-r--r--cfg-common.h4
-rw-r--r--libass/ass_fontconfig.c14
-rw-r--r--libass/ass_mp.c8
-rw-r--r--libvo/font_load_ft.c2
-rw-r--r--mencoder.c2
-rw-r--r--mplayer.c2
7 files changed, 31 insertions, 9 deletions
diff --git a/DOCS/man/en/mplayer.1 b/DOCS/man/en/mplayer.1
index 0072f63831..673c9b8bdf 100644
--- a/DOCS/man/en/mplayer.1
+++ b/DOCS/man/en/mplayer.1
@@ -1982,6 +1982,10 @@ Turn on SSA/ASS subtitle rendering.
With this option, libass will be used for SSA/ASS
external subtitles and Matroska tracks.
You may also want to use \-embeddedfonts.
+.br
+.I NOTE:
+When fontconfig is compiled-in, \-ass turns on \-fontconfig
+unless explicitly turned off with \-nofontconfig.
.
.TP
.B \-ass\-border\-color <value>
@@ -2161,6 +2165,10 @@ With fontconfig, this option determines the fontconfig font name.
.TP
.B \-fontconfig (fontconfig only)
Enables the usage of fontconfig managed fonts.
+.br
+.I NOTE:
+\-ass automatically turns this on unless explicitly overridden
+with \-nofontconfig.
.
.TP
.B \-forcedsubsonly
diff --git a/cfg-common.h b/cfg-common.h
index 597deda27d..c9c8756edf 100644
--- a/cfg-common.h
+++ b/cfg-common.h
@@ -329,8 +329,8 @@
{"ass-hinting", &ass_hinting, CONF_TYPE_INT, CONF_RANGE, 0, 7, NULL},
#endif
#ifdef HAVE_FONTCONFIG
- {"fontconfig", &font_fontconfig, CONF_TYPE_FLAG, 0, 0, 1, NULL},
- {"nofontconfig", &font_fontconfig, CONF_TYPE_FLAG, 0, 1, 0, NULL},
+ {"fontconfig", &font_fontconfig, CONF_TYPE_FLAG, 0, -1, 1, NULL},
+ {"nofontconfig", &font_fontconfig, CONF_TYPE_FLAG, 0, 1, -1, NULL},
#else
{"fontconfig", "MPlayer was compiled without fontconfig support.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
{"nofontconfig", "MPlayer was compiled without fontconfig support.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
diff --git a/libass/ass_fontconfig.c b/libass/ass_fontconfig.c
index 63e62f0074..addcc82646 100644
--- a/libass/ass_fontconfig.c
+++ b/libass/ass_fontconfig.c
@@ -40,6 +40,8 @@
#include <fontconfig/fcfreetype.h>
#endif
+extern int font_fontconfig;
+
struct fc_instance_s {
#ifdef HAVE_FONTCONFIG
FcConfig* config;
@@ -153,6 +155,10 @@ char* fontconfig_select(fc_instance_t* priv, const char* family, unsigned bold,
uint32_t code)
{
char* res = 0;
+ if (font_fontconfig < 0) {
+ *index = priv->index_default;
+ return priv->path_default;
+ }
if (family && *family)
res = _select_font(priv, family, bold, italic, index, code);
if (!res && priv->family_default) {
@@ -320,6 +326,14 @@ fc_instance_t* fontconfig_init(ass_library_t* library, FT_Library ftlibrary, con
const char* dir = library->fonts_dir;
int i;
+ if (font_fontconfig < 0) {
+ mp_msg(MSGT_ASS, MSGL_WARN,
+ MSGTR_LIBASS_FontconfigDisabledDefaultFontWillBeUsed);
+ priv->path_default = strdup(path);
+ priv->index_default = 0;
+ return priv;
+ }
+
rc = FcInit();
assert(rc);
diff --git a/libass/ass_mp.c b/libass/ass_mp.c
index e38fee4e2f..70e8e7a464 100644
--- a/libass/ass_mp.c
+++ b/libass/ass_mp.c
@@ -56,7 +56,7 @@ int ass_hinting = ASS_HINTING_NATIVE + 4; // native hinting for unscaled osd
#ifdef HAVE_FONTCONFIG
extern int font_fontconfig;
#else
-static int font_fontconfig = 0;
+static int font_fontconfig = -1;
#endif
extern char* font_name;
extern float text_font_scale_factor;
@@ -90,7 +90,7 @@ ass_track_t* ass_default_track(ass_library_t* library) {
sid = ass_alloc_style(track);
style = track->styles + sid;
style->Name = strdup("Default");
- style->FontName = (font_fontconfig && font_name) ? strdup(font_name) : strdup("Sans");
+ style->FontName = (font_fontconfig >= 0 && font_name) ? strdup(font_name) : strdup("Sans");
fs = track->PlayResY * text_font_scale_factor / 100.;
// approximate autoscale coefficients
@@ -234,9 +234,9 @@ void ass_configure(ass_renderer_t* priv, int w, int h, int unscaled) {
void ass_configure_fonts(ass_renderer_t* priv) {
char *dir, *path, *family;
dir = get_path("fonts");
- if (!font_fontconfig && font_name) path = strdup(font_name);
+ if (font_fontconfig < 0 && font_name) path = strdup(font_name);
else path = get_path("subfont.ttf");
- if (font_fontconfig && font_name) family = strdup(font_name);
+ if (font_fontconfig >= 0 && font_name) family = strdup(font_name);
else family = 0;
ass_set_fonts(priv, path, family);
diff --git a/libvo/font_load_ft.c b/libvo/font_load_ft.c
index 7051529c1a..689ee1e208 100644
--- a/libvo/font_load_ft.c
+++ b/libvo/font_load_ft.c
@@ -1139,7 +1139,7 @@ void load_font_ft(int width, int height, font_desc_t** fontp, const char *font_n
if (vo_font) free_font_desc(vo_font);
#ifdef HAVE_FONTCONFIG
- if (font_fontconfig)
+ if (font_fontconfig > 0)
{
if (!font_name)
font_name = strdup("sans-serif");
diff --git a/mencoder.c b/mencoder.c
index 4332b89673..3d36b3961b 100644
--- a/mencoder.c
+++ b/mencoder.c
@@ -533,7 +533,7 @@ if (frameno_filename) {
init_freetype();
#endif
#ifdef HAVE_FONTCONFIG
- if(!font_fontconfig)
+ if(font_fontconfig <= 0)
{
#endif
#ifdef HAVE_BITMAP_FONT
diff --git a/mplayer.c b/mplayer.c
index 6ad430b0d5..a3e357e56e 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -2528,7 +2528,7 @@ if(!codecs_file || !parse_codec_cfg(codecs_file)){
init_freetype();
#endif
#ifdef HAVE_FONTCONFIG
- if(!font_fontconfig)
+ if(font_fontconfig <= 0)
{
#endif
#ifdef HAVE_BITMAP_FONT