From c305720f01e4530fd23f65fd58eec5a1e6d6cd11 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 29 Oct 2026 16:25:35 -0600 Subject: [PATCH] [subset] Handle seac operands returned by a subroutine (#6463) A subroutine can push all four seac operands, return, and leave the glyph's own endchar to consume them. Treat callsubr and callgsubr immediately before endchar as possible seac suffixes even when no subroutine contains endchar. Add a synthetic CFF1 regression font for the operand-only subroutine case. Assisted-by: OpenAI Codex --- src/hb-ot-cff1-table.cc | 4 ++++ test/api/fonts/cff1_seac_subr_operands.otf | Bin 0 -> 736 bytes test/api/generate-cff-subset-regression-fonts.py | 9 +++++++++ test/api/test-subset-cff1.c | 1 + 4 files changed, 14 insertions(+) create mode 100644 test/api/fonts/cff1_seac_subr_operands.otf diff --git a/src/hb-ot-cff1-table.cc b/src/hb-ot-cff1-table.cc index a8b3eef0f..437bdc091 100644 --- a/src/hb-ot-cff1-table.cc +++ b/src/hb-ot-cff1-table.cc @@ -654,6 +654,10 @@ _cff1_charstring_may_end_in_seac (const hb_ubytes_t &str, if (end >= 5 && str[end - 5] == OpCode_fixedcs) return true; + /* A subroutine can leave the seac operands on the shared stack. */ + if (last == OpCode_callsubr || last == OpCode_callgsubr) + return true; + /* Escaped operators include stack-preserving dotsection. */ return end >= 2 && str[end - 2] == OpCode_escape; } diff --git a/test/api/fonts/cff1_seac_subr_operands.otf b/test/api/fonts/cff1_seac_subr_operands.otf new file mode 100644 index 0000000000000000000000000000000000000000..badba4b5765bb8a764be5f87904da434cd6cc2ac GIT binary patch literal 736 zcmZ`$O-LI-7=1IlQ4=AtRojXpi!FGP7AYbnP|`}Emqd*8s!LpwK>pY@5Rif=mF^`s zFG8W$UOkrz9z68eLr=Y$TTqn5)Ar4{LGfpn+4u9!%=czDySkc16x%Q`@-dyZGT)P* z0GR}^pUu6VPrXZB0fG|i`HEe~i6~S5rCusJ_Qu@TZ@c6NoC`%7#*X|+{)h8bv9j3| z7i5r1$0~NS4s%%t9%Y=aenx3Es?y0VYF5C zbfCSZG1@p$hz&mAPN|iSYgoY|3A>9HtNH?ARRJ|~m}G{y;EIUmw-!7|b+&%xJqLLT zM}6lWTG}zO5cU^H(7DbcF-T=Vm{B^@couSrINs(QJ8!v8!F4>ZRI9Eyg+|$Sk%I#p zd024C3i|EALkTrhv7)^O%3R~JkNO%a@t8VUqlq`fAwH^>!Xb`=;D!aif=uus%tu@A zR`|#eFa?AV&sAJz4Aai_