summaryrefslogtreecommitdiffstats
path: root/libass/ass_font.c
diff options
context:
space:
mode:
authorGrigori Goronzy <greg@blackbox>2011-07-15 00:49:50 +0200
committerGrigori Goronzy <greg@blackbox>2011-07-15 15:00:14 +0200
commitdd340a43024966d284f73cce0db9aa20e78cdbdd (patch)
treec42f55785e7efa7c665caf3a8f9da736e5b4a960 /libass/ass_font.c
parentfa291a3269ee0fa76a17c976439a900b29084314 (diff)
downloadlibass-dd340a43024966d284f73cce0db9aa20e78cdbdd.tar.bz2
libass-dd340a43024966d284f73cce0db9aa20e78cdbdd.tar.xz
Cache HarfBuzz fonts
Add a new opaque data structure to store shaper-specific font data in an ASS_Font. At the moment, this is used for caching HarfBuzz fonts, to reduce allocation and font initialization overhead.
Diffstat (limited to 'libass/ass_font.c')
-rw-r--r--libass/ass_font.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libass/ass_font.c b/libass/ass_font.c
index 0f53d8a..954040e 100644
--- a/libass/ass_font.c
+++ b/libass/ass_font.c
@@ -32,6 +32,7 @@
#include "ass_font.h"
#include "ass_fontconfig.h"
#include "ass_utils.h"
+#include "ass_shaper.h"
#define VERTICAL_LOWER_BOUND 0x02f1
@@ -181,6 +182,7 @@ ASS_Font *ass_font_new(Cache *font_cache, ASS_Library *library,
font.library = library;
font.ftlibrary = ftlibrary;
+ font.shaper_priv = NULL;
font.n_faces = 0;
font.desc.family = strdup(desc->family);
font.desc.treat_family_as_pattern = desc->treat_family_as_pattern;
@@ -603,6 +605,8 @@ void ass_font_free(ASS_Font *font)
for (i = 0; i < font->n_faces; ++i)
if (font->faces[i])
FT_Done_Face(font->faces[i]);
+ if (font->shaper_priv)
+ ass_shaper_font_data_free(font->shaper_priv);
free(font->desc.family);
free(font);
}