diff libass/ass_mp.c @ 25351:f46e91c64b39

Fix libass to support -nofontconfig. For history reason, fontconfig is auto-enabled when ass is enabled, we keep this behavior and document it clearly.
author ulion
date Wed, 12 Dec 2007 10:00:34 +0000
parents ffc2c7164bc0
children 2865633412d9
line wrap: on
line diff
--- a/libass/ass_mp.c	Wed Dec 12 08:50:54 2007 +0000
+++ b/libass/ass_mp.c	Wed Dec 12 10:00:34 2007 +0000
@@ -56,7 +56,7 @@
 #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 @@
 		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_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);