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 | |
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')
-rw-r--r-- | libass/ass.h | 8 | ||||
-rw-r--r-- | libass/ass_fontselect.c | 15 | ||||
-rw-r--r-- | libass/libass.sym | 1 |
3 files changed, 24 insertions, 0 deletions
diff --git a/libass/ass.h b/libass/ass.h index a3feb0b..1fb2234 100644 --- a/libass/ass.h +++ b/libass/ass.h @@ -401,6 +401,14 @@ void ass_set_line_spacing(ASS_Renderer *priv, double line_spacing); void ass_set_line_position(ASS_Renderer *priv, double line_position); /** + * \brief Get the list of available font providers. + * \return list of available font providers (user owns the returned array) + */ +void ass_get_available_font_providers(ASS_Library *priv, + ASS_DefaultFontProvider **providers, + size_t *size); + +/** * \brief Set font lookup defaults. * \param default_font path to default font to use. Must be supplied if * fontconfig is disabled or unavailable. 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 diff --git a/libass/libass.sym b/libass/libass.sym index aafb7a8..8a6826a 100644 --- a/libass/libass.sym +++ b/libass/libass.sym @@ -14,6 +14,7 @@ ass_set_aspect_ratio ass_set_font_scale ass_set_hinting ass_set_line_spacing +ass_get_available_font_providers ass_set_fonts ass_render_frame ass_new_track |