From efcb7d3de1efbd17b01263e3cea757c9579b555a Mon Sep 17 00:00:00 2001 From: Garret Rieger Date: Fri, 11 Apr 2025 23:34:06 +0000 Subject: [PATCH 01/16] [subset] close unicodes over bidi mirror variants during subsetting. Fixes #5281. Does the closure by default, but I've introduced a new flag and option to disable this behaviour since some users may want to get the minimal set if they know they don't need the mirrored variants. --- src/hb-subset-plan.cc | 53 ++++++++++++++---- src/hb-subset.h | 7 ++- .../Roboto-Regular.default.61,62,63,3C.ttf | Bin 0 -> 2768 bytes .../Roboto-Regular.default.61,62,63,3E.ttf | Bin 0 -> 2768 bytes ...to-Regular.no_bidi_closure.61,62,63,3C.ttf | Bin 0 -> 2688 bytes ...to-Regular.no_bidi_closure.61,62,63,3E.ttf | Bin 0 -> 2688 bytes .../data/profiles/layout-test-retain-gids.txt | 1 + test/subset/data/profiles/layout-test.txt | 1 + test/subset/data/profiles/no_bidi_closure.txt | 1 + test/subset/data/tests/bidi.tests | 10 ++++ test/subset/meson.build | 1 + util/hb-subset.cc | 1 + 12 files changed, 63 insertions(+), 12 deletions(-) create mode 100644 test/subset/data/expected/bidi/Roboto-Regular.default.61,62,63,3C.ttf create mode 100644 test/subset/data/expected/bidi/Roboto-Regular.default.61,62,63,3E.ttf create mode 100644 test/subset/data/expected/bidi/Roboto-Regular.no_bidi_closure.61,62,63,3C.ttf create mode 100644 test/subset/data/expected/bidi/Roboto-Regular.no_bidi_closure.61,62,63,3E.ttf create mode 100644 test/subset/data/profiles/no_bidi_closure.txt create mode 100644 test/subset/data/tests/bidi.tests diff --git a/src/hb-subset-plan.cc b/src/hb-subset-plan.cc index 11a40fccd..a56965246 100644 --- a/src/hb-subset-plan.cc +++ b/src/hb-subset-plan.cc @@ -29,6 +29,8 @@ #include "hb-map.hh" #include "hb-multimap.hh" #include "hb-set.hh" +#include "hb-subset.h" +#include "hb-unicode.h" #include "hb-ot-cmap-table.hh" #include "hb-ot-glyf-table.hh" @@ -209,15 +211,46 @@ _fill_unicode_and_glyph_map(hb_subset_plan_t *plan, _fill_unicode_and_glyph_map(plan, unicode_iterator, unicode_to_gid_for_iterator, unicode_to_gid_for_iterator); } +/* + * Finds additional unicode codepoints which are reachable from the input unicode set. + * Currently this adds in mirrored variants (needed for bidi) of any input unicodes. + */ +static hb_set_t +_unicode_closure (const hb_set_t* unicodes, bool bidi_closure) { + // TODO: we may want to also consider pulling in reachable unicode composition and decompositions. + // see: https://github.com/harfbuzz/harfbuzz/issues/2283 + hb_set_t out = *unicodes; + if (!bidi_closure) return out; + + if (out.is_inverted()) { + // don't closure inverted sets, they are asking to specifically exclude certain codepoints. + // otherwise everything is already included. + return out; + } + + auto unicode_funcs = hb_unicode_funcs_get_default (); + for (hb_codepoint_t cp : *unicodes) { + hb_codepoint_t mirror = hb_unicode_mirroring(unicode_funcs, cp); + if (unlikely (mirror != cp)) { + out.add(mirror); + } + } + + return out; +} + static void -_populate_unicodes_to_retain (const hb_set_t *unicodes, +_populate_unicodes_to_retain (const hb_set_t *unicodes_in, const hb_set_t *glyphs, hb_subset_plan_t *plan) { + hb_set_t unicodes = _unicode_closure(unicodes_in, + !(plan->flags & HB_SUBSET_FLAGS_NO_BIDI_CLOSURE)); + OT::cmap::accelerator_t cmap (plan->source); unsigned size_threshold = plan->source->get_num_glyphs (); - if (glyphs->is_empty () && unicodes->get_population () < size_threshold) + if (glyphs->is_empty () && unicodes.get_population () < size_threshold) { const hb_map_t* unicode_to_gid = nullptr; @@ -227,9 +260,9 @@ _populate_unicodes_to_retain (const hb_set_t *unicodes, // This is approach to collection is faster, but can only be used if glyphs // are not being explicitly added to the subset and the input unicodes set is // not excessively large (eg. an inverted set). - plan->unicode_to_new_gid_list.alloc (unicodes->get_population ()); + plan->unicode_to_new_gid_list.alloc (unicodes.get_population ()); if (!unicode_to_gid) { - _fill_unicode_and_glyph_map(plan, unicodes->iter(), [&] (hb_codepoint_t cp) { + _fill_unicode_and_glyph_map(plan, unicodes.iter(), [&] (hb_codepoint_t cp) { hb_codepoint_t gid; if (!cmap.get_nominal_glyph (cp, &gid)) { return HB_MAP_VALUE_INVALID; @@ -241,7 +274,7 @@ _populate_unicodes_to_retain (const hb_set_t *unicodes, // the map. This code is mostly duplicated from above to avoid doing // conditionals on the presence of the unicode_to_gid map each // iteration. - _fill_unicode_and_glyph_map(plan, unicodes->iter(), [&] (hb_codepoint_t cp) { + _fill_unicode_and_glyph_map(plan, unicodes.iter(), [&] (hb_codepoint_t cp) { return unicode_to_gid->get (cp); }); } @@ -258,7 +291,7 @@ _populate_unicodes_to_retain (const hb_set_t *unicodes, if (!plan->accelerator) { cmap.collect_mapping (&cmap_unicodes_storage, &unicode_glyphid_map_storage); - plan->unicode_to_new_gid_list.alloc (hb_min(unicodes->get_population () + plan->unicode_to_new_gid_list.alloc (hb_min(unicodes.get_population () + glyphs->get_population (), cmap_unicodes->get_population ())); } else { @@ -267,10 +300,10 @@ _populate_unicodes_to_retain (const hb_set_t *unicodes, } if (plan->accelerator && - unicodes->get_population () < cmap_unicodes->get_population () && + unicodes.get_population () < cmap_unicodes->get_population () && glyphs->get_population () < cmap_unicodes->get_population ()) { - plan->codepoint_to_glyph->alloc (unicodes->get_population () + glyphs->get_population ()); + plan->codepoint_to_glyph->alloc (unicodes.get_population () + glyphs->get_population ()); auto &gid_to_unicodes = plan->accelerator->gid_to_unicodes; @@ -285,7 +318,7 @@ _populate_unicodes_to_retain (const hb_set_t *unicodes, }); } - _fill_unicode_and_glyph_map(plan, unicodes->iter(), [&] (hb_codepoint_t cp) { + _fill_unicode_and_glyph_map(plan, unicodes.iter(), [&] (hb_codepoint_t cp) { /* Don't double-add entry. */ if (plan->codepoint_to_glyph->has (cp)) return HB_MAP_VALUE_INVALID; @@ -306,7 +339,7 @@ _populate_unicodes_to_retain (const hb_set_t *unicodes, { _fill_unicode_and_glyph_map(plan, hb_range(first, last + 1), [&] (hb_codepoint_t cp) { hb_codepoint_t gid = (*unicode_glyphid_map)[cp]; - if (!unicodes->has (cp) && !glyphs->has (gid)) + if (!unicodes.has (cp) && !glyphs->has (gid)) return HB_MAP_VALUE_INVALID; return gid; }, diff --git a/src/hb-subset.h b/src/hb-subset.h index 51bc7e793..1ce9c6934 100644 --- a/src/hb-subset.h +++ b/src/hb-subset.h @@ -71,10 +71,12 @@ typedef struct hb_subset_plan_t hb_subset_plan_t; * in the final subset. * @HB_SUBSET_FLAGS_NO_PRUNE_UNICODE_RANGES: If set then the unicode ranges in * OS/2 will not be recalculated. - * @HB_SUBSET_FLAGS_NO_LAYOUT_CLOSURE: If set don't perform glyph closure on layout + * @HB_SUBSET_FLAGS_NO_LAYOUT_CLOSURE: If set do not perform glyph closure on layout * substitution rules (GSUB). Since: 7.2.0. * @HB_SUBSET_FLAGS_OPTIMIZE_IUP_DELTAS: If set perform IUP delta optimization on the * remaining gvar table's deltas. Since: 8.5.0 + * @HB_SUBSET_FLAGS_NO_BIDI_CLOSURE: If set do not pull mirrored versions of input +* codepoints into the subset. Since: REPLACEME * @HB_SUBSET_FLAGS_IFTB_REQUIREMENTS: If set enforce requirements on the output subset * to allow it to be used with incremental font transfer IFTB patches. Primarily, * this forces all outline data to use long (32 bit) offsets. Since: EXPERIMENTAL @@ -96,8 +98,9 @@ typedef enum { /*< flags >*/ HB_SUBSET_FLAGS_NO_PRUNE_UNICODE_RANGES = 0x00000100u, HB_SUBSET_FLAGS_NO_LAYOUT_CLOSURE = 0x00000200u, HB_SUBSET_FLAGS_OPTIMIZE_IUP_DELTAS = 0x00000400u, + HB_SUBSET_FLAGS_NO_BIDI_CLOSURE = 0x00000800u, #ifdef HB_EXPERIMENTAL_API - HB_SUBSET_FLAGS_IFTB_REQUIREMENTS = 0x00000800u, + HB_SUBSET_FLAGS_IFTB_REQUIREMENTS = 0x00001000u, #endif } hb_subset_flags_t; diff --git a/test/subset/data/expected/bidi/Roboto-Regular.default.61,62,63,3C.ttf b/test/subset/data/expected/bidi/Roboto-Regular.default.61,62,63,3C.ttf new file mode 100644 index 0000000000000000000000000000000000000000..743de85d50a3a09d93370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_&157Li9U8;xvihkw}wxun?WcNK`B6H--W)0S9*n zH~G~BV=n~eSo%1BZezkE9@y{U%&jObLq5*>JX~;dw%O_7qFZU@Vo7V4>Ix`vCB7>h zS6Y?9V3`|S(IpDabMgoCG50@wnMxb{*fC&yRC%{=VRWEtC z&fTGKvDB|VqVi)t2XFQT98Raw!WaB1U+_7cfq;kW?{P$~)K87A!OiuXJ=~bd(5>=j z2ZumBPWif3my;ih#~pF3U zp}J-Z)8(@Umd}jB_}%Mbt?=B^BKzi9b_5??1~afIek^sYMhh4%P_*s_X2NJKwn20( z9TNB6y(q+)_>0uc+0^j`e3?elx5R%)yP*)u;af>t#b&eRer}Vwaw9{Mu~AYDU3v6bqEx)AJyS2fk^hVBNlfXQdF%NfUD*?y2)8}*qI%`^RPOgx`BZQFUw--MJMj*>S5{X^Qn(gOS+$5znF4gypHF+4^QkCp4dj{NXmspxOwKJWF#i9P&Ohk zBFhATg{xk_2{+9_bmh3%np#!I@XYomWo{V#U&+}r;# nUNW8@I`z`|XQz7~yAWn&42pj6`Rt#5I&|W<3$81_!8hsu4|940 literal 0 HcmV?d00001 diff --git a/test/subset/data/expected/bidi/Roboto-Regular.default.61,62,63,3E.ttf b/test/subset/data/expected/bidi/Roboto-Regular.default.61,62,63,3E.ttf new file mode 100644 index 0000000000000000000000000000000000000000..743de85d50a3a09d93370694f97077015506eb39 GIT binary patch literal 2768 zcmZuydu)@}6+id;KEINXeD<6e?2>$r$&1)Y$ivVyqA55JnvJ+gpr0cOac$=TdANy_ z1~yjuAY?9-!I&!1cB`tYVr&}MUR#pVO_2!NOJ%HUt1)$xChd=IVp}J56=KBRIiC}f zR=t+bJ->6$Irn$Yy}kwp02UMyC~dx$R`?p|0ho%`f;N9=x9;|lEkZ$q3r5}b|-UJ?1RS;Wd{ za3o@pJQCLTG1{!rv58oE1j49ap!Mi@B>GzaonK>fus*g67zoH$NT(qW*8z%PJIpZ~ zJES4%q|v04bTrTxE7I&p7m)~>O*{!<$qemM70gJzF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)u;af>t#b&eRer}Vwaw9{Mu~AYDU3v6bqEx)AJyS2fk^hVBNlfXQdF%NfUD*?y2)8}*qI%`^RPOgx`BZQFUw--MJMj*>S5{X^Qn(gOS+$5znF4gypHF+4^QkCp4dj{NXmspxOwKJWF#i9P&Ohk zBFhATg{xk_2{+9_bmh3%np#!I@XYomWo{V#U&+}r;# nUNW8@I`z`|XQz7~yAWn&42pj6`Rt#5I&|W<3$81_!8hsu4|940 literal 0 HcmV?d00001 diff --git a/test/subset/data/expected/bidi/Roboto-Regular.no_bidi_closure.61,62,63,3C.ttf b/test/subset/data/expected/bidi/Roboto-Regular.no_bidi_closure.61,62,63,3C.ttf new file mode 100644 index 0000000000000000000000000000000000000000..3586ec85a33f48a69c41493a31846e2656217e30 GIT binary patch literal 2688 zcmZuy3v8QL6+ZX>f4>qp`E8uIwb$f#+`JmQPMyTS{`OdxPyWctY#sLNZMl=#AT|R#&7(oTVMlo9173l3({rm5)0f=72i(UQu?*GDu z;{vX~i@3G7-{ns3K3)bOyn}cs5)UWf93&A35O+jolSD&|JryFONp!b7dtu;wQ-M}w3Ic4PXdCto{Q-tiyUq|Jvf|I@IIoVQuud$+8sZ|j=1(+G7acx{kJ zs!eE##e{FG0cSPN)WHsjY1!CP4EUKoU@VF*3}twIO9 z3K@6?E)!pN2u#9rpolgomD<51odQ|K!KB^@73|w!P_ICl`Wl``LzGUi&tqpnbxzfS zWmOku@z*d+Lf2&@D0H8)aCG(dc7d1Fsv!$7tT`uu0_^LwCbi>v3VsR|mOwM?D)!d$ z5xrgOEAg|(Vp9|NiVCMO>Lz6&xDp( z?kWD{=Cn>cc)-b-Ls9%=KF)@mTySu<)#l`)L+RvVZD(K59#T?DYELw!bSk6aD3@yU zGcLqZA(z6TKRAYVAZX*>koC433x(R9Tp}9Gz}=}35*#WL;G7S+R-Ihs=ux;>7YIHS z#W%9tCs8jN>yv&@w@3uI;_GZPsx zO9&)m5dZ=}kP*xhCS^+V6EAgPdb*tPlBS^T_ty79_}0xtD#_{U^(Zfu)An`Pyxmq; zueR6JwY6?(X=!V%v)8CA?5!S8i@VZnFqtcA-JTt7cBR5pDK^L@pZ&oLZ!q@Pmy?f2 zPP{UGW%klrQeC$6;jh}yWWSeG`cC}t)$F9zjPgWZ4n$-|FQ z&5OAkl7jz6%3u==XN(pr$ur7a#G19Pe5HCUPQO;Rh(KH`Ta7?XWvjFzm0hBziRs;rnAx|6;{{>F4l&<-uhN literal 0 HcmV?d00001 diff --git a/test/subset/data/expected/bidi/Roboto-Regular.no_bidi_closure.61,62,63,3E.ttf b/test/subset/data/expected/bidi/Roboto-Regular.no_bidi_closure.61,62,63,3E.ttf new file mode 100644 index 0000000000000000000000000000000000000000..0810670efcf7040818fcc0bfe654e8c941fd35cc GIT binary patch literal 2688 zcmZuy3v8QL6+ZX>e?Q|Uzl{^O_L}^To3|aOagugf)Owqpv}811l5Td?wef7{(Z-3F zI9ZA)gpH=bOIJFI7#)Lw0F8p^wHY*72MVkc;;}JcLlglT(vS)&;-P`6ve=wsJ54w3 zT0ZxD=ic+(@0@$%00RIM8VQshpT8SSpaNiH7_I0D^bM%~{r4XOh+f3YJp%{t`Rta* z1YCa`aa-SjyEW;5tQ0_a3-NFy9!|j1FpoHZxGOT3RGOaGJd1c4@!&{eH2&y~;co$` zoyhUhXm}<8TKEw9h`}&AaeSmRD~$qZu3^s8W6}70sa}Wt%!ljpSS%cU_vo)bifdaD zcZ^{`|Dx*axW0yX$5=c$Z~l?67x5rs^Tbpn%q;9Lh<774#KZFmp#lGEpRBm!$3(mggld!k5Q%y&OikW;!FsDIts!LP$L%e z5y%}ST^}$oLo<;@X5Idqw(N&>Ek%yatp!#+wBkqdb>BA#m67Aq6JQ;kjvWK*L^wGK z*8Fzt1OQe?gOmskQ={k9(IaJD|AB4VeE7;gjm_k|$@<^9XEIb2>XonK16U@?SkX0Pa>a9@Dz5zz{8kDN9;(0VgX_0*fI}57wDi4-b zRhY$J!3YW6l#QU!eagbo)7RGnUQ(-uEWn87y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B00rT;Gd{yXERe!k|o{4@AJ9@=LI literal 0 HcmV?d00001 diff --git a/test/subset/data/profiles/layout-test-retain-gids.txt b/test/subset/data/profiles/layout-test-retain-gids.txt index 63c67eb97..4fe71eb7e 100644 --- a/test/subset/data/profiles/layout-test-retain-gids.txt +++ b/test/subset/data/profiles/layout-test-retain-gids.txt @@ -1,3 +1,4 @@ --layout-features=* --notdef-outline +--no-bidi-closure --retain-gids diff --git a/test/subset/data/profiles/layout-test.txt b/test/subset/data/profiles/layout-test.txt index d98633a00..895f69db5 100644 --- a/test/subset/data/profiles/layout-test.txt +++ b/test/subset/data/profiles/layout-test.txt @@ -1,2 +1,3 @@ --layout-features=* --notdef-outline +--no-bidi-closure diff --git a/test/subset/data/profiles/no_bidi_closure.txt b/test/subset/data/profiles/no_bidi_closure.txt new file mode 100644 index 000000000..31adb7199 --- /dev/null +++ b/test/subset/data/profiles/no_bidi_closure.txt @@ -0,0 +1 @@ +--no-bidi-closure diff --git a/test/subset/data/tests/bidi.tests b/test/subset/data/tests/bidi.tests new file mode 100644 index 000000000..fb5732871 --- /dev/null +++ b/test/subset/data/tests/bidi.tests @@ -0,0 +1,10 @@ +FONTS: +Roboto-Regular.ttf + +PROFILES: +default.txt +no_bidi_closure.txt + +SUBSETS: +abc< +abc> diff --git a/test/subset/meson.build b/test/subset/meson.build index 7037223c7..f87bab543 100644 --- a/test/subset/meson.build +++ b/test/subset/meson.build @@ -1,5 +1,6 @@ tests = [ 'basics', + 'bidi', 'cmap', 'cmap14', 'preprocess', diff --git a/util/hb-subset.cc b/util/hb-subset.cc index 431edda34..bdb71c332 100644 --- a/util/hb-subset.cc +++ b/util/hb-subset.cc @@ -985,6 +985,7 @@ subset_main_t::add_options () {"notdef-outline", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, (gpointer) &set_flag, "Keep the outline of \'.notdef\' glyph", nullptr}, {"no-prune-unicode-ranges", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, (gpointer) &set_flag, "Don't change the 'OS/2 ulUnicodeRange*' bits.", nullptr}, {"no-layout-closure", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, (gpointer) &set_flag, "Don't perform glyph closure for layout substitution (GSUB).", nullptr}, + {"no-bidi-closure", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, (gpointer) &set_flag, "Don't perform bidi closure (adding mirrored variants) for input codepoints.", nullptr}, {"glyph-names", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, (gpointer) &set_flag, "Keep PS glyph names in TT-flavored fonts. ", nullptr}, {"passthrough-tables", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, (gpointer) &set_flag, "Do not drop tables that the tool does not know how to subset.", nullptr}, {"preprocess-face", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE, &this->preprocess, From e2a865f024a3568b4633f686eb48c846964a79db Mon Sep 17 00:00:00 2001 From: robxnano <89391914+robxnano@users.noreply.github.com> Date: Sat, 5 Apr 2025 12:29:28 +0100 Subject: [PATCH 02/16] meson: Only check for _MSC_FULL_VER once Prevents the log from filling with repeated calls to check the value of the define. --- meson.build | 7 ++++++- src/meson.build | 6 +++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/meson.build b/meson.build index 41f24b2cb..1bae27730 100644 --- a/meson.build +++ b/meson.build @@ -32,11 +32,16 @@ pkgmod = import('pkgconfig') cpp = meson.get_compiler('cpp') null_dep = dependency('', required: false) + +# Includes Microsoft Clang compiler with GNU arguments, see +# https://github.com/harfbuzz/harfbuzz/pull/4394 +cpp_is_microsoft_compiler = host_machine.system() == 'windows' and cpp.get_define('_MSC_FULL_VER') != '' + # Only perform these checks if cpp_std is c++11 as setting -std directly # produces a warning from meson. if get_option('cpp_std') == 'c++11' # Enforce C++14 requirement for MSVC STL - if cpp.get_id() == 'clang' and cpp.get_define('_MSC_FULL_VER') != '' + if cpp.get_id() == 'clang' and cpp_is_microsoft_compiler add_project_arguments('-std=c++14', language: 'cpp') elif cpp.get_id() == 'clang-cl' # Clang-cl produces a warning when using -std=c++14, but not when using /std:c++14 diff --git a/src/meson.build b/src/meson.build index 9d39b8f6f..daa821d77 100644 --- a/src/meson.build +++ b/src/meson.build @@ -599,7 +599,7 @@ defs_list = [harfbuzz_def] version = '0.@0@.0'.format(hb_version_int) extra_hb_cpp_args = [] -if cpp.get_define('_MSC_FULL_VER') != '' +if cpp_is_microsoft_compiler if get_option('default_library') != 'static' extra_hb_cpp_args += '-DHB_DLL_EXPORT' endif @@ -721,7 +721,7 @@ if get_option('tests').enabled() # TODO: Microsoft LINK gives the following because extern, non dllexport # symbols can only be used when linking against a static library # error LNK2019: unresolved external symbol "unsigned __int64 const * const _hb_NullPool" - if cpp.get_define('_MSC_FULL_VER') == '' + if not cpp_is_microsoft_compiler noinst_programs = { 'main': 'main.cc', 'test-basics': 'test.cc', @@ -768,7 +768,7 @@ if get_option('tests').enabled() 'test-unicode-ranges': ['test-unicode-ranges.cc'], } foreach name, source : compiled_tests - if cpp.get_define('_MSC_FULL_VER') != '' and source.contains('hb-static.cc') + if cpp_is_microsoft_compiler and source.contains('hb-static.cc') # TODO: Microsoft compilers cannot link tests using hb-static.cc, fix them continue endif From 9def626d4abf99dc229b99dcbef7a11431bd5155 Mon Sep 17 00:00:00 2001 From: robxnano <89391914+robxnano@users.noreply.github.com> Date: Sat, 5 Apr 2025 12:37:09 +0100 Subject: [PATCH 03/16] meson: Fix warnings about features in later versions By using the fs.relative_to() function inside version_compare blocks, Meson can suppress warning messages about it being used in a project with a lower minimum version. --- src/meson.build | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/meson.build b/src/meson.build index daa821d77..e954f0cf4 100644 --- a/src/meson.build +++ b/src/meson.build @@ -840,15 +840,10 @@ have_gobject = conf.get('HAVE_GOBJECT', 0) == 1 cmake_config = configuration_data() cmake_config_dir = cmake_package_install_dir / 'harfbuzz' -have_fs_relative_to = meson.version().version_compare('>=1.3.0') - -if not have_fs_relative_to - relative_to = find_program('relative_to.py') -endif - -if have_fs_relative_to +if meson.version().version_compare('>=1.3.0') cmake_package_prefix_dir = fs.relative_to(get_option('prefix'), get_option('prefix') / cmake_config_dir) else + relative_to = find_program('relative_to.py') cmake_package_prefix_dir = run_command(relative_to, get_option('prefix'), get_option('prefix') / cmake_config_dir, check: true).stdout().strip() endif @@ -860,7 +855,7 @@ cmake_package_prefix_dir = '${CMAKE_CURRENT_LIST_DIR}/@0@'.format(cmake_package_ cmake_install_includedir = get_option('includedir') if fs.is_absolute(cmake_install_includedir) - if have_fs_relative_to + if meson.version().version_compare('>=1.3.0') cmake_install_includedir = fs.relative_to(cmake_install_includedir, get_option('prefix')) else cmake_install_includedir = run_command(relative_to, cmake_install_includedir, get_option('prefix'), check: true).stdout().strip() @@ -870,7 +865,7 @@ endif cmake_install_libdir = get_option('libdir') if fs.is_absolute(cmake_install_libdir) - if have_fs_relative_to + if meson.version().version_compare('>=1.3.0') cmake_install_libdir = fs.relative_to(cmake_install_libdir, get_option('prefix')) else cmake_install_libdir = run_command(relative_to, cmake_install_libdir, get_option('prefix'), check: true).stdout().strip() From cf7bffb690efc0d1d9926f8c92620328c4d171b1 Mon Sep 17 00:00:00 2001 From: robxnano <89391914+robxnano@users.noreply.github.com> Date: Sat, 5 Apr 2025 12:42:47 +0100 Subject: [PATCH 04/16] meson: Use full path in HBSOURCES Using the file object directly in a format string is broken and now deprecated. --- src/meson.build | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/meson.build b/src/meson.build index e954f0cf4..3d1c00d9b 100644 --- a/src/meson.build +++ b/src/meson.build @@ -1042,11 +1042,17 @@ if get_option('tests').enabled() env.set('libs', meson.current_build_dir()) # TODO: Merge this with builddir after autotools removal HBSOURCES = [] foreach f : hb_sources + if meson.version().version_compare('>=1.4.0') + f = f.full_path() + endif HBSOURCES += '@0@'.format(f) endforeach env.set('HBSOURCES', ' '.join(HBSOURCES)) HBHEADERS = [] foreach f : hb_headers + if meson.version().version_compare('>=1.4.0') + f = f.full_path() + endif HBHEADERS += '@0@'.format(f) endforeach env.set('HBHEADERS', ' '.join(HBHEADERS)) From e192a584a872b963d43b0e5ecc4349c28ff0d44c Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Tue, 15 Apr 2025 15:52:52 +0200 Subject: [PATCH 05/16] [check-symbols] Ignore another rust symbol Fixes https://github.com/harfbuzz/harfbuzz/issues/5287 --- src/check-symbols.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/check-symbols.py b/src/check-symbols.py index d0ea303e3..a577bddcc 100755 --- a/src/check-symbols.py +++ b/src/check-symbols.py @@ -17,6 +17,7 @@ IGNORED_SYMBOLS += [ 'rust_eh_personality', '_ZN3std9panicking11EMPTY_PANIC.*', # 'std::panicking::EMPTY_PANIC::.*' '_ZN3std3sys3pal4unix4args3imp15ARGV_INIT_ARRAY.*', # 'std::sys::pal::unix::args::imp::ARGV_INIT_ARRAY::.*' + '_ZN3std3sys4args4unix3imp15ARGV_INIT_ARRAY.*', # std::sys::args::unix::imp::ARGV_INIT_ARRAY::.* '_ZN17compiler_builtins4math4libm7generic4sqrt9RSQRT_TAB.*', # 'compiler_builtins::math::libm::generic::sqrt::RSQRT_TAB::.*' ] From 4da8671b502f63d25784295e7aafa441182664cf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 14 Apr 2025 10:16:54 +0000 Subject: [PATCH 06/16] Bump github/codeql-action from 3.28.14 to 3.28.15 Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.28.14 to 3.28.15. - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/fc7e4a0fa01c3cca5fd6a1fddec5c0740c977aa2...45775bd8235c68ba998cffa5171334d58593da47) --- updated-dependencies: - dependency-name: github/codeql-action dependency-version: 3.28.15 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/scorecard.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index bd7b36ec0..9a46f5b0a 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -59,6 +59,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@fc7e4a0fa01c3cca5fd6a1fddec5c0740c977aa2 # v3.28.14 + uses: github/codeql-action/upload-sarif@45775bd8235c68ba998cffa5171334d58593da47 # v3.28.15 with: sarif_file: results.sarif From 7bb3000a31631020045bbc59573285fae069bf47 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 13 Apr 2025 12:46:52 -0600 Subject: [PATCH 07/16] [font] Allow negative emboldening strength to enlighten --- src/hb-font.hh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hb-font.hh b/src/hb-font.hh index bf2d5d681..e86173804 100644 --- a/src/hb-font.hh +++ b/src/hb-font.hh @@ -781,8 +781,8 @@ struct hb_font_t bool y_neg = y_scale < 0; y_mult = (y_neg ? -((int64_t) -y_scale << 16) : ((int64_t) y_scale << 16)) / upem; - x_strength = fabsf (roundf (x_scale * x_embolden)); - y_strength = fabsf (roundf (y_scale * y_embolden)); + x_strength = roundf (fabsf (x_scale) * x_embolden); + y_strength = roundf (fabsf (y_scale) * y_embolden); slant_xy = y_scale ? slant * x_scale / y_scale : 0.f; From 21516f74d2a3afb97aeafea1c3eda1c24d593ae0 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 15 Apr 2025 09:58:25 -0600 Subject: [PATCH 08/16] [cmake] Add hb-script-list.h Fixes https://github.com/harfbuzz/harfbuzz/issues/5288 --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 203f2396c..20ad8e761 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -204,6 +204,7 @@ set (project_headers ${PROJECT_SOURCE_DIR}/src/hb-ot.h ${PROJECT_SOURCE_DIR}/src/hb-paint.h ${PROJECT_SOURCE_DIR}/src/hb-set.h + ${PROJECT_SOURCE_DIR}/src/hb-script-list.h ${PROJECT_SOURCE_DIR}/src/hb-shape-plan.h ${PROJECT_SOURCE_DIR}/src/hb-shape.h ${PROJECT_SOURCE_DIR}/src/hb-style.h From 8f413a533ca9501d1d3c4da6c50bba21e9d1fc2d Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 15 Apr 2025 10:03:16 -0600 Subject: [PATCH 09/16] [layout] Docs --- src/hb-ot-layout.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index 3c9a0fc5d..83e8a5d74 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -2632,7 +2632,8 @@ struct hb_get_glyph_alternates_dispatch_t : * @alternate_glyphs: (out caller-allocates) (array length=alternate_count): A glyphs buffer. * Alternate glyphs associated with the glyph id. * - * Fetches alternates of a glyph from a given GSUB lookup index. + * Fetches alternates of a glyph from a given GSUB lookup index. Note that for one-to-one GSUB + * glyph substitutions, this function fetches the substituted glyph. * * Return value: Total number of alternates found in the specific lookup index for the given glyph id. * From bc15ebdea18f46dbbc5ee2973a48e378e573f516 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 15 Apr 2025 12:37:11 -0600 Subject: [PATCH 10/16] [font] Fix abs of int value --- src/hb-font.hh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hb-font.hh b/src/hb-font.hh index e86173804..5e23bd040 100644 --- a/src/hb-font.hh +++ b/src/hb-font.hh @@ -781,8 +781,8 @@ struct hb_font_t bool y_neg = y_scale < 0; y_mult = (y_neg ? -((int64_t) -y_scale << 16) : ((int64_t) y_scale << 16)) / upem; - x_strength = roundf (fabsf (x_scale) * x_embolden); - y_strength = roundf (fabsf (y_scale) * y_embolden); + x_strength = roundf (abs (x_scale) * x_embolden); + y_strength = roundf (abs (y_scale) * y_embolden); slant_xy = y_scale ? slant * x_scale / y_scale : 0.f; From 32b36fa84c4beece50d8ee6ee3dc5fec1a91b55b Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 15 Apr 2025 12:14:01 -0600 Subject: [PATCH 11/16] [atexit] Fix extra semicolon Fixes https://github.com/harfbuzz/harfbuzz/issues/5290 --- src/hb.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hb.hh b/src/hb.hh index 187dbbdb7..ce8d075cd 100644 --- a/src/hb.hh +++ b/src/hb.hh @@ -465,7 +465,7 @@ static int HB_UNUSED _hb_errno = 0; # define hb_atexit atexit # else template struct hb_atexit_t { ~hb_atexit_t () { function (); } }; -# define hb_atexit(f) static hb_atexit_t _hb_atexit_##__LINE__; +# define hb_atexit(f) static hb_atexit_t _hb_atexit_##__LINE__ # endif #endif #endif From 416e6b692132cef49edfa814c451aae2f5d84de5 Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Wed, 16 Apr 2025 20:21:27 +0200 Subject: [PATCH 12/16] 11.1.0 --- NEWS | 14 ++++++++++++++ meson.build | 2 +- src/hb-subset.h | 2 +- src/hb-version.h | 6 +++--- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index 28c274b8d..796cfe561 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,17 @@ +Overview of changes leading to 11.1.0 +Wednesdat, April 16, 2025 +==================================== +- Include bidi mirroring variants of the requested codepoints when subsetting. + The new HB_SUBSET_FLAGS_NO_BIDI_CLOSURE can be used to disable this + behaviour. +- Various bug fixes. +- Various build fixes and improvements. +- Various test suite improvements. + +New API: ++HB_SUBSET_FLAGS_NO_BIDI_CLOSURE + + Overview of changes leading to 11.0.1 Friday, April 4, 2025 ==================================== diff --git a/meson.build b/meson.build index 1bae27730..bdc7108e9 100644 --- a/meson.build +++ b/meson.build @@ -1,6 +1,6 @@ project('harfbuzz', ['c', 'cpp'], meson_version: '>= 0.60.0', - version: '11.0.1', + version: '11.1.0', default_options: [ 'cpp_eh=none', # Just to support msvc, we are passing -fno-exceptions also anyway # 'cpp_rtti=false', # Do NOT enable, wraps inherit it and ICU needs RTTI diff --git a/src/hb-subset.h b/src/hb-subset.h index 1ce9c6934..374035df3 100644 --- a/src/hb-subset.h +++ b/src/hb-subset.h @@ -76,7 +76,7 @@ typedef struct hb_subset_plan_t hb_subset_plan_t; * @HB_SUBSET_FLAGS_OPTIMIZE_IUP_DELTAS: If set perform IUP delta optimization on the * remaining gvar table's deltas. Since: 8.5.0 * @HB_SUBSET_FLAGS_NO_BIDI_CLOSURE: If set do not pull mirrored versions of input -* codepoints into the subset. Since: REPLACEME + * codepoints into the subset. Since: 11.1.0 * @HB_SUBSET_FLAGS_IFTB_REQUIREMENTS: If set enforce requirements on the output subset * to allow it to be used with incremental font transfer IFTB patches. Primarily, * this forces all outline data to use long (32 bit) offsets. Since: EXPERIMENTAL diff --git a/src/hb-version.h b/src/hb-version.h index dbbc1e1a4..885434adc 100644 --- a/src/hb-version.h +++ b/src/hb-version.h @@ -47,20 +47,20 @@ HB_BEGIN_DECLS * * The minor component of the library version available at compile-time. */ -#define HB_VERSION_MINOR 0 +#define HB_VERSION_MINOR 1 /** * HB_VERSION_MICRO: * * The micro component of the library version available at compile-time. */ -#define HB_VERSION_MICRO 1 +#define HB_VERSION_MICRO 0 /** * HB_VERSION_STRING: * * A string literal containing the library version available at compile-time. */ -#define HB_VERSION_STRING "11.0.1" +#define HB_VERSION_STRING "11.1.0" /** * HB_VERSION_ATLEAST: From 2602f7292cc7632d434c756a0dc28066f102fc27 Mon Sep 17 00:00:00 2001 From: jfkthame Date: Thu, 17 Apr 2025 15:02:59 +0100 Subject: [PATCH 13/16] Avoid unannotated-fallthrough warning in COLR.hh --- src/OT/Color/COLR/COLR.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OT/Color/COLR/COLR.hh b/src/OT/Color/COLR/COLR.hh index 16cd96e32..ff7523647 100644 --- a/src/OT/Color/COLR/COLR.hh +++ b/src/OT/Color/COLR/COLR.hh @@ -1620,7 +1620,7 @@ struct ClipBox void closurev1 (hb_colrv1_closure_context_t* c) const { switch (u.format) { - case 2: u.format2.closurev1 (c); + case 2: u.format2.closurev1 (c); return; default:return; } } From 4e7b178f3c75d65c2fa499c71ecfe37d9e2d184f Mon Sep 17 00:00:00 2001 From: jfkthame Date: Thu, 17 Apr 2025 15:05:20 +0100 Subject: [PATCH 14/16] Avoid unannotated-fallthrough in hb-ot-layout-base-table.hh --- src/hb-ot-layout-base-table.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hb-ot-layout-base-table.hh b/src/hb-ot-layout-base-table.hh index d98ad6012..b0d4412fc 100644 --- a/src/hb-ot-layout-base-table.hh +++ b/src/hb-ot-layout-base-table.hh @@ -182,7 +182,7 @@ struct BaseCoord void collect_variation_indices (hb_set_t& varidx_set /* OUT */) const { switch (u.format) { - case 3: hb_barrier (); u.format3.collect_variation_indices (varidx_set); + case 3: hb_barrier (); u.format3.collect_variation_indices (varidx_set); return; default:return; } } From 01793d3eaf3b07fa67cb7c57ff035a7d094ab938 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 20 Apr 2025 00:32:44 -0600 Subject: [PATCH 15/16] [fontations] Pop font transform --- src/fontations/lib.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/fontations/lib.rs b/src/fontations/lib.rs index fc1196a1d..bfcf95f4e 100644 --- a/src/fontations/lib.rs +++ b/src/fontations/lib.rs @@ -969,6 +969,9 @@ extern "C" fn _hb_fontations_paint_glyph( hb_paint_push_font_transform(paint_funcs, paint_data, font); } let _ = color_glyph.paint(location, &mut painter); + unsafe { + hb_paint_pop_transform(paint_funcs, paint_data); + } } extern "C" fn _hb_fontations_glyph_name( From 4fc84b0e994bcfbd1bfca0fc654f58487d6e1919 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 20 Apr 2025 00:36:28 -0600 Subject: [PATCH 16/16] [ot-font] Fix order of COLR vs VARC extents COLR can reference VARC, not the other way around. --- src/hb-ot-font.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/hb-ot-font.cc b/src/hb-ot-font.cc index 17e56dbc4..d505b5b09 100644 --- a/src/hb-ot-font.cc +++ b/src/hb-ot-font.cc @@ -412,15 +412,15 @@ hb_ot_get_glyph_extents (hb_font_t *font, const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data; const hb_ot_face_t *ot_face = ot_font->ot_face; -#ifndef HB_NO_VAR_COMPOSITES - if (ot_face->VARC->get_extents (font, glyph, extents)) return true; -#endif #if !defined(HB_NO_OT_FONT_BITMAP) && !defined(HB_NO_COLOR) if (ot_face->sbix->get_extents (font, glyph, extents)) return true; if (ot_face->CBDT->get_extents (font, glyph, extents)) return true; #endif #if !defined(HB_NO_COLOR) && !defined(HB_NO_PAINT) if (ot_face->COLR->get_extents (font, glyph, extents)) return true; +#endif +#ifndef HB_NO_VAR_COMPOSITES + if (ot_face->VARC->get_extents (font, glyph, extents)) return true; #endif if (ot_face->glyf->get_extents (font, glyph, extents)) return true; #ifndef HB_NO_OT_FONT_CFF