From 072c7aba92d3c92c84454a12578264f12439bb0d Mon Sep 17 00:00:00 2001 From: Michiharu Ariza Date: Thu, 15 Nov 2018 15:41:46 -0800 Subject: [PATCH] use 2-byte offset instead of 4-byte for local subrs more than enough since local subrs immediately follow its corresponding private dict, as the result 2-byte redunction for each font dict with local subrs updated api test expected subset fonts accordingly --- src/hb-subset-cff-common.hh | 4 ++-- test/api/fonts/AdobeVFPrototype.abc.otf | Bin 7460 -> 7456 bytes .../api/fonts/AdobeVFPrototype.ac.nohints.otf | Bin 6780 -> 6780 bytes test/api/fonts/AdobeVFPrototype.ac.otf | Bin 6996 -> 6996 bytes .../SourceHanSans-Regular.41,4C2E.nohints.otf | Bin 2380 -> 2376 bytes .../fonts/SourceHanSans-Regular.41,4C2E.otf | Bin 2576 -> 2572 bytes test/api/fonts/SourceSansPro-Regular.abc.otf | Bin 1812 -> 1808 bytes .../SourceSansPro-Regular.ac.nohints.otf | Bin 1592 -> 1592 bytes test/api/fonts/SourceSansPro-Regular.ac.otf | Bin 1708 -> 1704 bytes test/api/fonts/cff1_seac.C0.otf | Bin 1604 -> 1600 bytes 10 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hb-subset-cff-common.hh b/src/hb-subset-cff-common.hh index 55b33b1bb..d5f7ec108 100644 --- a/src/hb-subset-cff-common.hh +++ b/src/hb-subset-cff-common.hh @@ -258,7 +258,7 @@ struct CFFPrivateDict_OpSerializer : OpSerializer if (desubroutinize || (subrsOffset == 0)) return_trace (true); else - return_trace (FontDict::serialize_offset4_op (c, opstr.op, subrsOffset)); + return_trace (FontDict::serialize_offset2_op (c, opstr.op, subrsOffset)); } else return_trace (copy_opstr (c, opstr)); @@ -274,7 +274,7 @@ struct CFFPrivateDict_OpSerializer : OpSerializer if (desubroutinize || !has_localsubr) return 0; else - return OpCode_Size (OpCode_longintdict) + 4 + OpCode_Size (opstr.op); + return OpCode_Size (OpCode_shortint) + 2 + OpCode_Size (opstr.op); } else return opstr.str.len; diff --git a/test/api/fonts/AdobeVFPrototype.abc.otf b/test/api/fonts/AdobeVFPrototype.abc.otf index e21d87f7d469a62f170e4bc6b51e26aadfc4bcdd..cc477088ebdec87d1970e7d4acc8ce50dd7cd36c 100644 GIT binary patch delta 295 zcmZ2twZN+0KP1GTfsdhqftew}+0D(!?yFiL0|Ubw1_llRk1)p|>)iKA3=Etm3=GUR zzCix!zbi5r7EW@yW@@@_nZbqO4 QBg2u#_Ft}>c{n9R0FM7j+5i9m delta 299 zcmZ2rwZy94KP1GTfsdhqftew}+0D&J_*qyY0|Ubw1_llxk1)p|>)iKA3=EtW3=GUR zzCix!zbi5r7tqXMG(1t#mI1Ea{y!dW*v475dgu*5_jbV8`!KP1GTfrp`iftkU<+09LXU$P~ifq~%+0|Uzx|6qNiux2h}1_ss{K(T}{ z{~&kfLLiHQ^#_pPNX|_xm|^25&A`A063od+O-$i@n)(YUp8({WWdH?u1UZia<#T|1 zm5khy3NC$yP9T2*kk6BwSm9Z~z#IT%v&{h!d5O8HhMJxsK;{w#2BwID{Nj@TZ45?0 zyZ!*>70Q4Ha@L6}Ffee+0Qo9qKm%E-88m==hm9v}m>9V>vob3&G0QM;P1a#G=Vk;d RVq|1{Tw8c`a{=oeW&jAqG_?Q# delta 246 zcmX>hbVjJ&KP1GTfrp`iftkU<+09Miv)3Xg1_p*R3=AyO{Dbw4!kW2^85mgS0L2o* z{Da(?3xO;K);~akBRMy*V1|vKGy?-03y`0ak(!vo`84$xP(B67H_HGD@Cb4q1c768_1_p*R3=FK{{=xc2Va;5|3=C{BK(T}{ z{~&kfLLiHQZ4Z#(NX|_xm|^254dfpI@^dm$6H_>!rv3u*Re*f644?pyAm>pA26h7= zUnL{Aq=HMIp%cgt0rGir6DvFm7?=ZqZ1w~o!Iqbpn`)@(36x~dU|?X1D9A4^`QOH1 z#K6FL04T3e1~ibfPFw-Ve*omGlmQK7sbQFSvb^A#p$83xtK_gFo- U8G(uz8QH!t{1Vx0!ghxl0JKFl`~Uy| delta 246 zcmeAXnIKZ{9}?ovz{AkMz|7#_?B=Gh;Pv7a3=9ls7#LV1{e$(5!kW2^85r0SfMN+@ z{z2}{g+LYq+W{cKk(`@YFvG@A8puBZKJmgbfp;`es((uftf+T+09MCP>#u+fq`KT0|V24|6qNiXtgp91_tIUK(U16 z+{6L~X~y>q3@j!rS-vi{UWaO4qaFj9f0{I(& ze1Y7=iUJ0f03eg)0FYqIOU#u_^%YDp1`3=2TBuf#UtIG4B7+f7?!&|x{){dgUnns# c%P_c1=4YP3%?Q-P#47jr(9Dj_YnU^b0jujQfB*mh delta 196 zcmbQhH-)d>KP1GTfs>(uftf+T+09L1#r57k1_p*X3=GVS{=xc2(Q0KJK=uuwSVD4c zVgZ9R<9h}M77HLhA|o|1Mbsxg9w@&6$T!OX3UIZs9s|lx0PW${2Zp{4GGf zKyG410Ru|_kjZicNU-H4=1Qje3Z@tX1(uftf+T+09MCCcJ3{0|Ubx1_mavi87}d**Ct3Vq}(KV4v*H Yl*h}!zzCFNVwJmac7FEe156dn04p94l>h($ delta 69 zcmdnNvx7&*KP1GTfs>(uftf+T+09L1?=}{11_p*X3=B*X6J<^_a&CMP#mFiP6yluh X%9O{=2xKv_%AFIKqrCY5Qw1{sBm)nX diff --git a/test/api/fonts/SourceSansPro-Regular.ac.otf b/test/api/fonts/SourceSansPro-Regular.ac.otf index a22b1571bfd9b7fa01d809e2c73a07cadbc3fee6..12d6d0fd80538d32d7f582ae1d48df8c677a3d8b 100644 GIT binary patch delta 192 zcmZ3(yMnjgKP1GTfs>(uftf+T+09L1Bi~nM1_p*X3=B-|{=xc2(Q0KJ3=GUMK(U16 z+{6NgHl_`Y#^35`U0$eSuM;RDcG=O}SjNFn6HeZI_K)w%< z&y$;2QNX|)0A#X60139d#9YZ#U%?b(pg;o9LbZbY;*$Rt8H|8(9TR8xGrDYiahQ== chQVd>2BvauMxY)hR=MYK+m38DVXj~X0Q`_FfdBvi delta 196 zcmZ3%yN0*kKP1GTfs>(uftf+T+09L1`X0V$1_p*X3=B-2{=xc2(Q0KJ3=GT(K(U16 z+{6NgHl_~`K^35`U0$eSuM;RDcbbx%7jNFn6HeZI_Kz;y_ z&y$;2QNX|qVzR^l3AVh%T**{l!4zYlKnl=8wSxTOlK&SOjDT`I6KD7{x@~-Mn2}W$ dsMc-rI;L`71_nkTn~7CUilzC}W&`F5W&ogmD}Mk0 diff --git a/test/api/fonts/cff1_seac.C0.otf b/test/api/fonts/cff1_seac.C0.otf index 0b695135f154bb6837ab9438b104c6b7b7e75cb3..aed2fdd3883a9c23b8ef553c13743eb120cecec1 100644 GIT binary patch delta 192 zcmX@YbAYGbKP1GTfs>(uftf+T+09Ks=X_B=0|Ubx1_ma5|6qNi=(e&{1_ovppjbk3 zZejt03^ON?p917ZWTYmh2rBZd2C6*+#28*9`Z8{0Bh3 zKyG410Ru|_kjeZ3NU-H4=1Qje3Z@tX1%3bxQ7gzVF8P0v!3Zd)FmZ+#qszv}`xu#J b7+fYVW76bi1nOa8mHYiCd(q}QOc~4oKmIO0 delta 196 zcmX@WbA+efKP1GTfs>(uftf+T+09L%y+QIm0|Ubx1_mZW|6qNi=(e&{1_ovhpjbk3 zZejt03^ON?p8@1YWTYmh2rBZd2CBUP#28*9<`On4bXo z0=bD51q>_!Kqm7SAi