ass_mp: allow to use a custom fontconfig configuration file

This allows to use a fontconfig fonts.conf that is customized for mpv. The
configuration file is assumed to be located at `~/.mpv/fonts.conf`. If not
found the default fcontconfig config file is used.
This commit is contained in:
Stefano Pigozzi 2012-12-09 12:45:05 +01:00
parent 5f999d94df
commit 9201cfe2bd
1 changed files with 14 additions and 9 deletions

View File

@ -255,18 +255,23 @@ void mp_ass_configure(ASS_Renderer *priv, struct MPOpts *opts,
void mp_ass_configure_fonts(ASS_Renderer *priv, struct osd_style_opts *opts)
{
char *dir, *path;
dir = get_path("fonts");
path = get_path("subfont.ttf");
if (!mp_path_exists(path)) {
free(path);
path = NULL;
char *default_font = get_path("subfont.ttf");
char *config = get_path("fonts.conf");
if (!mp_path_exists(default_font)) {
free(default_font);
default_font = NULL;
}
ass_set_fonts(priv, path, opts->font, 1, NULL, 1);
if (!mp_path_exists(config)) {
free(config);
config = NULL;
}
free(dir);
free(path);
ass_set_fonts(priv, default_font, opts->font, 1, config, 1);
free(default_font);
free(config);
}
void mp_ass_render_frame(ASS_Renderer *renderer, ASS_Track *track, double time,