From 61cb26c84a9c542c537c172b14b9c4ebed5b763a Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Mon, 30 May 2016 19:07:32 +0100 Subject: Avoid fz_font pulling harfbuzz in. We store an hb_font in every font, and currently have fz_drop_font know to call harfbuzz to destroy it. This causes harfbuzz to be included even in builds that never use it. We improve this situation by storing both an hb_font, and a function pointer to destroy it within fz_font. This costs us an extra pointer per fz_font, but solves the problem. --- source/html/html-layout.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source/html') diff --git a/source/html/html-layout.c b/source/html/html-layout.c index ae3f9f21..93f1905b 100644 --- a/source/html/html-layout.c +++ b/source/html/html-layout.c @@ -827,6 +827,8 @@ static void init_string_walker(fz_context *ctx, string_walker *walker, hb_buffer walker->next_font = NULL; } +typedef void (fz_hb_font_destructor_t)(void *); + static int walk_string(string_walker *walker) { fz_context *ctx = walker->ctx; @@ -885,6 +887,7 @@ static int walk_string(string_walker *walker) if (walker->font->hb_font == NULL) { Memento_startLeaking(); /* HarfBuzz leaks harmlessly */ + walker->font->hb_destroy = (fz_hb_font_destructor_t *)hb_font_destroy; walker->font->hb_font = hb_ft_font_create(face, NULL); Memento_stopLeaking(); } -- cgit v1.2.3