Don’t mark fonts with glyf table as bitmap fonts

The bitmap font detection condition is now close to the original condition
changed in 95d2c37.

Fix #2328.
This commit is contained in:
Guillaume Ayoub
2024-12-16 10:28:28 +01:00
parent 2ada586beb
commit d8663f11c9
2 changed files with 12 additions and 1 deletions
+10 -1
View File
@@ -88,7 +88,16 @@ class Font:
for i in range(table_count[0]):
harfbuzz.hb_tag_to_string(table_tags[i], table_name)
self.tables.append(ffi.string(table_name).decode())
self.bitmap = 'EBDT' in self.tables and 'EBLC' in self.tables
self.bitmap = False
if 'EBDT' in self.tables and 'EBLC' in self.tables:
if 'glyf' in self.tables:
tag = harfbuzz.hb_tag_from_string(b'glyf', -1)
blob = harfbuzz.hb_face_reference_table(self.hb_face, tag)
if harfbuzz.hb_blob_get_length(blob) == 0:
self.bitmap = True
harfbuzz.hb_blob_destroy(blob)
else:
self.bitmap = True
self.italic_angle = 0 # TODO: this should be different
self.upem = harfbuzz.hb_face_get_upem(self.hb_face)
self.png = harfbuzz.hb_ot_color_has_png(self.hb_face)
+2
View File
@@ -22,7 +22,9 @@ ffi.cdef('''
hb_blob_t * hb_face_reference_blob (hb_face_t *face);
unsigned int hb_face_get_index (const hb_face_t *face);
unsigned int hb_face_get_upem (const hb_face_t *face);
hb_blob_t * hb_face_reference_table (const hb_face_t *face, hb_tag_t tag);
const char * hb_blob_get_data (hb_blob_t *blob, unsigned int *length);
unsigned int hb_blob_get_length (hb_blob_t *blob);
bool hb_ot_color_has_png (hb_face_t *face);
hb_blob_t * hb_ot_color_glyph_reference_png (hb_font_t *font, hb_codepoint_t glyph);
bool hb_ot_color_has_svg (hb_face_t *face);