From f394206b7ca5eb53772f4b5cf20e6c68beab72f1 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 6 Feb 2025 19:48:56 +0000 Subject: [PATCH] [ot-shape] Only apply trak'ing if STAT table present --- src/hb-ot-shape.cc | 6 ++++-- test/shape/data/in-house/fonts/TRAK.ttf | Bin 2456 -> 2492 bytes 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc index 59b97a799..e507d2f3e 100644 --- a/src/hb-ot-shape.cc +++ b/src/hb-ot-shape.cc @@ -46,6 +46,8 @@ #include "hb-set.hh" #include "hb-aat-layout.hh" +#include "hb-ot-stat-table.hh" + static inline bool _hb_codepoint_is_regional_indicator (hb_codepoint_t u) @@ -208,8 +210,8 @@ hb_ot_shape_planner_t::compile (hb_ot_shape_plan_t &plan, if (plan.apply_morx) plan.adjust_mark_positioning_when_zeroing = false; - /* Currently we always apply trak. */ - plan.apply_trak = plan.requested_tracking && hb_aat_layout_has_tracking (face); + /* According to Ned, trak is applied by default for "modern fonts", as detected by presence of STAT table. */ + plan.apply_trak = plan.requested_tracking && hb_aat_layout_has_tracking (face) && face->table.STAT->has_data (); #endif } diff --git a/test/shape/data/in-house/fonts/TRAK.ttf b/test/shape/data/in-house/fonts/TRAK.ttf index 07ae3afd81ecfbf1c36c3e5a173c36b6a754513d..3be9c0085421079272ddfbffc352862bbf0d0e9b 100644 GIT binary patch delta 291 zcmbOsyhpg6fsuiMftR6yftew|KUm)=Lnh-W0|R3OP&6Sp#4!XYFV4WgsQ~1QB`mqWqcL#{gGJpc?mzbk~>P3Kj zm5khy3eEyXF(7{jkS~>!pIo2F`k3V}&;S9TfLLx~MFB%KLp)G{1(2_hn_pC+Ai^*i z=l~NSKO`?PH`VBRpfUpkn+s4+Q9*uj$p+<^{|pQqAOq7&iW0LKZ5Z|d)pr2-CScD2 zJ$PrYpJ_b5%~u9y<`+P5hHDicL5^g2e2VFC(8dpn9KwuXr64hoOF@8XvH)iX0C#Ub AlmGw# delta 269 zcmdlZJVUsifsuiMfrp`iftkUAyTo`Hc$f`NfWCL=X5MKIP&4k&j9h|My90_>NVqk!sJfP9sV+>#2;0!A?)e+7^) zm6M;G$oiP&FHk>_%OIAUSW#cVP|XkzRGOO>=~ek-0y$;9nWv`m4TW0 p1yG#fTE)jzAo}`Kkz)*I|CcjwVg{PYz|O$5nU7JJW3nk{I{@LHJ$L{B