From 03f42301881c50eadc5d5bff98a420979c0704e7 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 6 Apr 2025 13:31:17 -0600 Subject: [PATCH] [mac] Add tests for --face-loader https://github.com/harfbuzz/harfbuzz/issues/5142 --- test/shape/data/in-house/tests/macos.tests | 13 +++++++++---- util/face-options.hh | 7 ++++--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/test/shape/data/in-house/tests/macos.tests b/test/shape/data/in-house/tests/macos.tests index b5200ca87..983fcec1a 100644 --- a/test/shape/data/in-house/tests/macos.tests +++ b/test/shape/data/in-house/tests/macos.tests @@ -1,10 +1,15 @@ -@shapers=ot #,coretext +# https://github.com/harfbuzz/harfbuzz/issues/5142 +@shapers=ot,coretext +/System/Library/Fonts/SFNS.ttf;;U+0068,U+0065,U+006C,U+006C,U+006F;[h=0+1104|e=1+1049|l=2+418|l=3+418|o=4+1087] +/System/Library/Fonts/SFNS.ttf;--face-loader=coretext;U+0068,U+0065,U+006C,U+006C,U+006F;[h=0+1104|e=1+1049|l=2+418|l=3+418|o=4+1087] +/System/Library/Fonts/SFNSItalic.ttf;;U+0068,U+0065,U+006C,U+006C,U+006F;[h=0+1110|e=1+1062|l=2+424|l=3+424|o=4+1096] +/System/Library/Fonts/SFNSItalic.ttf;--face-loader=coretext;U+0068,U+0065,U+006C,U+006C,U+006F;[h=0+1110|e=1+1062|l=2+424|l=3+424|o=4+1096] + +@shapers=ot # One day get most run through CoreText too # https://github.com/harfbuzz/harfbuzz/issues/5232 /System/Library/Fonts/LucidaGrande.ttc;;U+05E8,U+05B0,U+05EA,U+05BC,U+05B4,U+05D9,U+05D5;[vavhebrew=6+655|yodhebrew=5+650|hiriqhebrew=2@81,0+0|tavdageshhebrew=2+1421|reshshevahebrew=0+1044] -# https://github.com/harfbuzz/harfbuzz/issues/5142 - # https://github.com/harfbuzz/harfbuzz/issues/4020 /System/Library/Fonts/LucidaGrande.ttc;--features=-liga[3:5];U+0066,U+0066,U+0020,U+0066,U+0066,U+0066,U+0020,U+0066,U+0066;[ff=0+1443|space=2+648|f=3+753|f=4+753|f=5+753|space=6+648|ff=7+1443] @@ -158,7 +163,7 @@ /System/Library/Fonts/Supplemental/Apple Chancery.ttf@4ec49cba0d4e68d025ada0498c4df1b2f9fd57ac;--features liga=0,sups=0,tnum=0;U+0066,U+0069,U+0072,U+0073,U+0074;[f=0+639|i=1+606|r=2+853|s=3+728|t=4+725] /System/Library/Fonts/Supplemental/Apple Chancery.ttf@4ec49cba0d4e68d025ada0498c4df1b2f9fd57ac;--features smcp=1;U+0066,U+0069,U+0072,U+0073,U+0074;[F.small=0+903|I.small=1+634|R.small=2+1113|S.small=3+911|T.small=4+1075] /System/Library/Fonts/Supplemental/Apple Chancery.ttf@4ec49cba0d4e68d025ada0498c4df1b2f9fd57ac;--features liga=0,dlig=1;U+0066,U+0069,U+0072,U+0073,U+0074;[f=0+639|i=1+606|r=2+853|s_t=3+1438] -/System/Library/Fonts/Supplemental/Skia.ttf@caee56fc4085009c1a29a863500908050ea6248f;;U+0041,U+0056;[A=0+1345|V=1@-12,0+1346] +/System/Library/Fonts/Supplemental/Skia.ttf@caee56fc4085009c1a29a863500908050ea6248f;--ned;U+0041,U+0056;[A|V@1333,0] /System/Library/Fonts/Supplemental/Devanagari Sangam MN.ttc@214b7ffa672bc936745df5a72644f2b705b24b4b;;U+092D,U+0941;[dn_bha=0+1339|dn_u_matra.mrk=0@-296,11+0] # 11.1 diff --git a/util/face-options.hh b/util/face-options.hh index c4284b50a..ed1e75825 100644 --- a/util/face-options.hh +++ b/util/face-options.hh @@ -94,15 +94,16 @@ face_options_t::post_parse (GError **error) } if ((!cache.font_path || 0 != strcmp (cache.font_path, font_path)) || - (cache.face_loader != face_loader && 0 != strcmp (cache.face_loader, face_loader)) || + (cache.face_loader != face_loader && + (cache.face_loader && face_loader && 0 != strcmp (cache.face_loader, face_loader))) || cache.face_index != face_index) { hb_face_destroy (cache.face); cache.face = hb_face_create_from_file_or_fail_using (font_path, face_index, face_loader); cache.face_index = face_index; - free ((char *) cache.font_path); - free ((char *) cache.face_loader); + g_free ((char *) cache.font_path); + g_free ((char *) cache.face_loader); cache.font_path = g_strdup (font_path); cache.face_loader = face_loader ? g_strdup (face_loader) : nullptr;