1
1
mirror of https://github.com/Kozea/WeasyPrint.git synced 2024-10-05 16:37:47 +03:00

Check that Harfbuzz is at least version 4.1.0 to subset fonts

Fix #2185.
This commit is contained in:
Guillaume Ayoub 2024-06-17 16:37:35 +02:00
parent e8540e7d6c
commit 8273f652b1
2 changed files with 5 additions and 2 deletions

View File

@ -180,7 +180,8 @@ class Font:
if not cmap:
return
if harfbuzz_subset:
if harfbuzz_subset and harfbuzz.hb_version_atleast(4, 1, 0):
# 4.1.0 is required for hb_set_add_sorted_array.
self._harfbuzz_subset(cmap, hinting)
else:
self._fonttools_subset(cmap, hinting)

View File

@ -12,6 +12,7 @@ ffi.cdef('''
typedef ... hb_font_t;
typedef ... hb_face_t;
typedef ... hb_blob_t;
typedef int hb_bool_t;
typedef uint32_t hb_tag_t;
typedef uint32_t hb_codepoint_t;
hb_tag_t hb_tag_from_string (const char *str, int len);
@ -30,7 +31,8 @@ ffi.cdef('''
hb_tag_t *table_tags);
unsigned int hb_face_get_glyph_count (const hb_face_t *face);
hb_blob_t * hb_face_reference_table (const hb_face_t *face, hb_tag_t tag);
hb_bool_t hb_version_atleast (
unsigned int major, unsigned int minor, unsigned int micro);
// HarfBuzz Subset