From d9585a81add0a41f6a59f3c7f95bcc6182732059 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Fri, 1 Nov 2013 15:44:25 +0100 Subject: fontselect: implement a coretext font provider Fontconfig is known to be very slow on OS X and Windows, this has to do with the extremely prohibitive cache times (which are getting even longer with latest versions of Fontconfig). This commits starts to address the problem by using CoreText on OS X to load the font data. The commit uses the simplest possible approach to load all of the data in memory and then use it to match. This causes a somewhat slow startup time (around ~400ms on my i7) but it is already better than waiting *minutes* for Fontconfig to cache the fonts data. A later commit will improve the speed of the match by using a hybrid approach that lazy loads in the libass database only the necessary fonts. --- libass/ass_fontselect.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'libass/ass_fontselect.c') diff --git a/libass/ass_fontselect.c b/libass/ass_fontselect.c index cf1c088..9ef0ace 100644 --- a/libass/ass_fontselect.c +++ b/libass/ass_fontselect.c @@ -37,6 +37,7 @@ #include "ass_library.h" #include "ass_fontselect.h" #include "ass_fontconfig.h" +#include "ass_coretext.h" #include "ass_font.h" #define ABS(x) ((x) < 0 ? -(x) : (x)) @@ -803,6 +804,13 @@ ass_fontselect_init(ASS_Library *library, priv->embedded_provider = ass_embedded_fonts_add_provider(library, priv, ftlibrary); +#ifdef CONFIG_CORETEXT + if (fc != 0) { + priv->default_provider = ass_coretext_add_provider(library, priv); + return priv; + } +#endif + #ifdef CONFIG_FONTCONFIG if (fc != 0) priv->default_provider = ass_fontconfig_add_provider(library, -- cgit v1.2.3