diff options
author | Stefano Pigozzi <stefano.pigozzi@gmail.com> | 2013-12-13 08:14:43 +0100 |
---|---|---|
committer | Grigori Goronzy <greg@chown.ath.cx> | 2015-07-10 10:42:40 +0200 |
commit | f6e321acb11492ac87171825a630bc4e189c5cea (patch) | |
tree | 3bcc3739ef772df3c10562d3008591f08e6a5ecd /libass/ass_fontselect.c | |
parent | bc743feb07cffe7a81e07411a484e499377deb50 (diff) | |
download | libass-f6e321acb11492ac87171825a630bc4e189c5cea.tar.bz2 libass-f6e321acb11492ac87171825a630bc4e189c5cea.tar.xz |
fontselect: expose a fontprovider listing API
This allows client code to query libass for the font providers it was compiled
with. It can be useful for clients so that they can show selection interfaces
to their users.
Diffstat (limited to 'libass/ass_fontselect.c')
-rw-r--r-- | libass/ass_fontselect.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/libass/ass_fontselect.c b/libass/ass_fontselect.c index dacff11..dc475b1 100644 --- a/libass/ass_fontselect.c +++ b/libass/ass_fontselect.c @@ -848,6 +848,21 @@ ass_fontselect_init(ASS_Library *library, return priv; } +void ass_get_available_font_providers(ASS_Library *priv, + ASS_DefaultFontProvider **providers, + size_t *size) +{ + size_t offset = 2; + *size = offset; + for (int i = 0; font_constructors[i].constructor; i++) + (*size)++; + *providers = calloc(*size, sizeof(ASS_DefaultFontProvider)); + (*providers)[0] = ASS_FONTPROVIDER_NONE; + (*providers)[1] = ASS_FONTPROVIDER_AUTODETECT; + for (int i = offset; i < *size; i++) + (*providers)[i] = font_constructors[i-offset].id; +} + /** * \brief Free font selector and release associated data * \param the font selector |