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 /test/test.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 'test/test.c')
-rw-r--r-- | test/test.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/test.c b/test/test.c index 8522840..33aa94c 100644 --- a/test/test.c +++ b/test/test.c @@ -166,6 +166,26 @@ static void blend(image_t * frame, ASS_Image *img) printf("%d images blended\n", cnt); } +char *font_provider_labels[] = { + [ASS_FONTPROVIDER_NONE] = "None", + [ASS_FONTPROVIDER_AUTODETECT] = "Autodetect", + [ASS_FONTPROVIDER_CORETEXT] = "CoreText", + [ASS_FONTPROVIDER_FONTCONFIG] = "Fontconfig", +}; + +static void print_font_providers(ASS_Library *ass_library) +{ + ASS_DefaultFontProvider *providers; + size_t providers_size = 0; + ass_get_available_font_providers(ass_library, &providers, &providers_size); + printf("test.c: Available font providers (%zu): ", providers_size); + for (int i = 0; i < providers_size; i++) { + const char *separator = i > 0 ? ", ": ""; + printf("%s'%s'", separator, font_provider_labels[providers[i]]); + } + printf(".\n"); +} + int main(int argc, char *argv[]) { const int frame_w = 1280; @@ -179,6 +199,8 @@ int main(int argc, char *argv[]) char *subfile = argv[2]; double tm = strtod(argv[3], 0); + print_font_providers(ass_library); + init(frame_w, frame_h); ASS_Track *track = ass_read_file(ass_library, subfile, NULL); if (!track) { |