#include <fontconfig/fcfreetype.h>
#endif
+extern int font_fontconfig;
+
struct fc_instance_s {
#ifdef HAVE_FONTCONFIG
FcConfig* config;
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) {
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);
#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;
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
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);