diff options
author | Robin Watts <Robin.Watts@artifex.com> | 2016-09-28 19:58:53 +0100 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2016-10-05 19:37:11 +0100 |
commit | c2901d60fa98874d4a36cf1ab57a03cb80fde038 (patch) | |
tree | 948bd3c69624d1bbc1f2893cc30c54720bce7a50 /source/html | |
parent | 9e88b088ea2ddcb6f85584750eb3c989af101905 (diff) | |
download | mupdf-c2901d60fa98874d4a36cf1ab57a03cb80fde038.tar.xz |
Uncouple font shaper data from harfbuzz.
The fz_font structure now doesn't know anything about
harfbuzz at all, it merely offers an abstract
'fz_shaper_data_t' entry.
Diffstat (limited to 'source/html')
-rw-r--r-- | source/html/html-layout.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/source/html/html-layout.c b/source/html/html-layout.c index 2fe6de82..2211ea4f 100644 --- a/source/html/html-layout.c +++ b/source/html/html-layout.c @@ -837,7 +837,13 @@ 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 void +destroy_hb_shaper_data(fz_context *ctx, void *handle) +{ + hb_lock(ctx); + hb_font_destroy(handle); + hb_unlock(ctx); +} static int walk_string(string_walker *walker) { @@ -899,12 +905,12 @@ static int walk_string(string_walker *walker) if (!quickshape) { - fz_hb_t *hb = fz_font_hb(walker->font); - if (hb->font == NULL) + fz_shaper_data_t *hb = fz_font_shaper_data(walker->font); + if (hb->shaper_handle == NULL) { Memento_startLeaking(); /* HarfBuzz leaks harmlessly */ - hb->destroy = (fz_hb_font_destructor_t *)hb_font_destroy; - hb->font = hb_ft_font_create(face, NULL); + hb->destroy = destroy_hb_shaper_data; + hb->shaper_handle = hb_ft_font_create(face, NULL); Memento_stopLeaking(); } @@ -912,7 +918,7 @@ static int walk_string(string_walker *walker) hb_buffer_guess_segment_properties(walker->hb_buf); Memento_stopLeaking(); - hb_shape(hb->font, walker->hb_buf, NULL, 0); + hb_shape(hb->shaper_handle, walker->hb_buf, NULL, 0); } walker->glyph_pos = hb_buffer_get_glyph_positions(walker->hb_buf, &walker->glyph_count); |