From f1ac36ba7f0950c67c3f362a8fca75013bce541a Mon Sep 17 00:00:00 2001 From: Qunxin Liu Date: Wed, 15 Nov 2023 11:38:41 -0800 Subject: [PATCH] [instancer] update hhea vertical metrics with OS/2 ones --- src/hb-ot-hmtx-table.hh | 23 ++++++++++++++++++ ....SPED=25,YEXT=520,wght=100-400,slnt=18.ttf | Bin 0 -> 2184 bytes .../subset/data/fonts/playwrite_mm.subset.ttf | Bin 0 -> 6260 bytes test/subset/data/tests/sync_vmetrics.tests | 11 +++++++++ test/subset/meson.build | 3 ++- 5 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 test/subset/data/expected/sync_vmetrics/playwrite_mm.subset.default.retain-all-codepoint.SPED=25,YEXT=520,wght=100-400,slnt=18.ttf create mode 100644 test/subset/data/fonts/playwrite_mm.subset.ttf create mode 100644 test/subset/data/tests/sync_vmetrics.tests diff --git a/src/hb-ot-hmtx-table.hh b/src/hb-ot-hmtx-table.hh index 89640b43f..f225d6b6f 100644 --- a/src/hb-ot-hmtx-table.hh +++ b/src/hb-ot-hmtx-table.hh @@ -145,6 +145,29 @@ struct hmtxvmtx table->minTrailingBearing = min_rsb; table->maxExtent = max_extent; } + + if (T::is_horizontal) + { + const auto &OS2 = *c->plan->source->table.OS2; + if (OS2.has_data () && + table->ascender == OS2.sTypoAscender && + table->descender == OS2.sTypoDescender && + table->lineGap == OS2.sTypoLineGap) + { + table->ascender = static_cast (roundf (OS2.sTypoAscender + + MVAR.get_var (HB_OT_METRICS_TAG_HORIZONTAL_ASCENDER, + c->plan->normalized_coords.arrayZ, + c->plan->normalized_coords.length))); + table->descender = static_cast (roundf (OS2.sTypoDescender + + MVAR.get_var (HB_OT_METRICS_TAG_HORIZONTAL_DESCENDER, + c->plan->normalized_coords.arrayZ, + c->plan->normalized_coords.length))); + table->lineGap = static_cast (roundf (OS2.sTypoLineGap + + MVAR.get_var (HB_OT_METRICS_TAG_HORIZONTAL_LINE_GAP, + c->plan->normalized_coords.arrayZ, + c->plan->normalized_coords.length))); + } + } } #endif diff --git a/test/subset/data/expected/sync_vmetrics/playwrite_mm.subset.default.retain-all-codepoint.SPED=25,YEXT=520,wght=100-400,slnt=18.ttf b/test/subset/data/expected/sync_vmetrics/playwrite_mm.subset.default.retain-all-codepoint.SPED=25,YEXT=520,wght=100-400,slnt=18.ttf new file mode 100644 index 0000000000000000000000000000000000000000..5311eb0eba0f0de1da6283d5ddb84cb4435ab3b7 GIT binary patch literal 2184 zcmb7FTTB#J82)EwcXoDmxi5RK-2yHUZo*QbwrPbn zX-#8%=_S<{8z0)lCibDJN&8^ahc-U6TGYmBE2Lm3-l%}w*?wns8!`2z=VZ?LzyJRK zbLI?jL==HVMd91a$}1=W6mf;%8n@T%c9r?6`+#eJP1{|2wq0DlI0-xtoVKIRSzBy! zmJ;!ofVb>+*>Vi)n__^MfnRpHo$k|Td}o2pz(m3w=im81iSTUm&~2>{~i~ z{UHV1LEtpt@b<1o56#gr;CNuU!_(hQ5;=gofz6$sj^>=t>kEj)E$~^{-PP;!e@Quz zpJH-6M0VK!fDCrhDPfm?SjeV*LK~eW);GPP0aGB31ck@=GR0$ZWfj$K#6v%c{QjUW zldC8n+H5fN>|p#z=$~PEJZCVAa3!JvlyubF;-e-|c$BP((=xB>^DEQHy3IfAe@_?{ zCb;rve5sVkGFdTsCC|uqkFS$L6|J=yv&sTBuy}0nEGD8*Z+oYYlZo3~-r(kR#Jg(B z%Q(GK84o>Hi6Ph(18Oz{t1wvwrAj}Xe!u^cf&-m^H|Mnr}KS(s2a8|L7;pFS#K zGKmVoiqkF6uH5-+HN===jW%lL?v0P#i_A?;$eElW?)Y&bDq(DPP?)*BK4MU-jT#@1 z)lg*Q`60!=6ZUWA-@P|B!7WbD^E|&aJH4>D=vT|K92ylJrb#o3k4A3Zym@P6>~2J| z|M4GJFJHcVV{AgtTyr5aLlNAPU&#)8gXd-1OAclV#Bmmyj60E=ty@g{7&b(72Qgo6VMy zz9~C1Aw*DXqhm}-rZ71cQDu%3!%ZnM;_CA1pmlX|es1RB#GR4fu3fou<@(5!Xvwo@ z+3a?^Epub)rlbUePFh^xh6t|-C*U!E9Vfs@u|%3=YXRqQxEfS)JV%(og~Rz(dze-hU?;wuoJrv z%b>78ag;`RM7hZbkc$AuXhSHk(U=76f+aOK=S4n0FN?QW3Ie3nYO!=gsksuh;fAX{ z-?rz7li#=_-;`b7J5>JNR}CNcmYBEh$sd-#DIfA~wI3?~F-*7>mR{{BZrg2_RJ?Ih zNyd)eh9Z+C!`;6#eQRozC9SH>X)8`-r{rw#+#@4(auy=LsA4(A7)6a}O+^~Xp{i(u ziD$VKI2?>0%5&d3TPssHR2&{Wy)W-TWvnR5l1`2-uF9xA)ql{LoLsWMFtgrOvq93K zeks524MSGlvFf@nK7GGsb6l=f8!DsgXR?jxVm9`hlCNlX}7JQg#<49#B52hoqIf z)B?Ij;SSJIcxY8@GRX~z9n*!qOYzKXyPy+@^si4dWg~N@Xw7a?uf1Q#1De*2{Q3ux*395gjn& zj_bo7sJ$0B4YUul8{I4-8>Uz3RSWc9K?fRP-2tu}(b+q31ADPEAMDN8o)a~l=pVKe Buyp_c literal 0 HcmV?d00001 diff --git a/test/subset/data/fonts/playwrite_mm.subset.ttf b/test/subset/data/fonts/playwrite_mm.subset.ttf new file mode 100644 index 0000000000000000000000000000000000000000..e939c859425e482a22e601d4ba1a7cf9fc85dc63 GIT binary patch literal 6260 zcmb_g32x{{Y{|E5S;z*A83{|i7aPfrSueJQ5EhPnV98)e zk<}csY}hQ2Y*@D9B?-=MITQf`h6Q#xmV%HiiqqLF1!RfA!Zuj8ERAL~Gw;~1-;8Y~ zkg9A|x~r%EtN;GH`#+vUjED;GBUAbEWlhbL4~W!lpazz&yS`=F9c%Uh-w(WedCP{z z=hM%}fjAZ+w!N=M_Jb$)Kwr`JuDfpik44X8y>bxvz1zVb zI(Tm@ky|D5c6D~N-7)hG1-&4Yl02lWAyLPv?QIhTk zUI$#;*|vWVO=JP!MZn8cLIa(tM1CfLcN6z`TySs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