|
| 1 | +From dc35a26c5b38bad40dd44d67609b6a89ee0d7774 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Philip Taron <philip.taron@gmail.com> |
| 3 | +Date: Mon, 29 Jun 2026 13:48:41 +0000 |
| 4 | +Subject: [PATCH] Fix spurious assertion when a high ghost stem is a glyph's |
| 5 | + first stem |
| 6 | + |
| 7 | +In calcInstanceStems() the per-stem loop initializes lo = None and |
| 8 | +hi = None, then computes one or both locations per stem. For a 'high' |
| 9 | +ghost stem (a hint anchored only at the top edge) only hi is computed; |
| 10 | +lo is then unconditionally overwritten by hi on the next line, so its |
| 11 | +incoming value is dead. |
| 12 | + |
| 13 | +The 'high' branch nonetheless asserted lo is not None. When a high ghost |
| 14 | +is the glyph's first stem -- exactly the case for small diagonal accents |
| 15 | +-- lo is still None from its initialization, so the assertion fired and |
| 16 | +aborted hinting of the whole font. |
| 17 | + |
| 18 | +Drop the dead lo operand from the assertion, because hi is the only |
| 19 | +value actually read. |
| 20 | +--- |
| 21 | + python/afdko/otfautohint/hinter.py | 2 +- |
| 22 | + 1 file changed, 1 insertion(+), 1 deletion(-) |
| 23 | + |
| 24 | +diff --git a/python/afdko/otfautohint/hinter.py b/python/afdko/otfautohint/hinter.py |
| 25 | +index 354d92f2f..1cea13a88 100644 |
| 26 | +--- a/python/afdko/otfautohint/hinter.py |
| 27 | ++++ b/python/afdko/otfautohint/hinter.py |
| 28 | +@@ -2007,7 +2007,7 @@ def calcInstanceStems(self, glidx) -> None: |
| 29 | + lo = lo + 21 |
| 30 | + hi = lo - 21 |
| 31 | + elif isG == 'high': |
| 32 | +- assert lo is not None and hi is not None |
| 33 | ++ assert hi is not None |
| 34 | + lo = hi |
| 35 | + hi = lo - 20 |
| 36 | + else: |
| 37 | +-- |
| 38 | +2.49.0 |
0 commit comments