Skip to content

Commit

Permalink
Check that Harfbuzz is at least version 4.1.0 to subset fonts
Browse files Browse the repository at this point in the history
Fix #2185.
  • Loading branch information
liZe committed Jun 17, 2024
1 parent e8540e7 commit 8273f65
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion weasyprint/pdf/fonts.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ def subset(self, cmap, hinting):
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)
Expand Down
4 changes: 3 additions & 1 deletion weasyprint/text/ffi.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
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);
Expand All @@ -30,7 +31,8 @@
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
Expand Down

0 comments on commit 8273f65

Please sign in to comment.