diff options
author | Grigori Goronzy <greg@kinoho.net> | 2015-09-07 11:32:49 +0200 |
---|---|---|
committer | Grigori Goronzy <greg@kinoho.net> | 2015-09-07 11:32:49 +0200 |
commit | 0268c64b8ec7bef9287a212759152bf7d15e64d8 (patch) | |
tree | f421fa82ffeec2c8a4fd10a3a17f6d87fd6977a6 /libass/ass_coretext.c | |
parent | fda28f6106caf7d450847444a363adc042b325b9 (diff) | |
parent | d6bb9af645526a810512eaf2c65252ac0e0e6b36 (diff) | |
download | libass-0268c64b8ec7bef9287a212759152bf7d15e64d8.tar.bz2 libass-0268c64b8ec7bef9287a212759152bf7d15e64d8.tar.xz |
Merge pull request #190 from grigorig/fonts
Substitutions and some fixes
Diffstat (limited to 'libass/ass_coretext.c')
-rw-r--r-- | libass/ass_coretext.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/libass/ass_coretext.c b/libass/ass_coretext.c index 3553324..877018d 100644 --- a/libass/ass_coretext.c +++ b/libass/ass_coretext.c @@ -25,6 +25,12 @@ #define SAFE_CFRelease(x) do { if (x) CFRelease(x); } while(0) +static const ASS_FontMapping font_substitutions[] = { + {"sans-serif", "Helvetica"}, + {"serif", "Times"}, + {"monospace", "Courier"} +}; + static char *cfstr2buf(CFStringRef string) { const int encoding = kCFStringEncodingUTF8; @@ -266,10 +272,18 @@ static char *get_fallback(void *priv, const char *family, uint32_t codepoint) return res_family; } +static void get_substitutions(void *priv, const char *name, + ASS_FontProviderMetaData *meta) +{ + const int n = sizeof(font_substitutions) / sizeof(font_substitutions[0]); + ass_map_font(font_substitutions, n, name, meta); +} + static ASS_FontProviderFuncs coretext_callbacks = { .check_glyph = check_glyph, .destroy_font = destroy_font, .match_fonts = match_fonts, + .get_substitutions = get_substitutions, .get_fallback = get_fallback, }; |