From 41344af085f5ab3cb791fbc5e4923a0f2bd59604 Mon Sep 17 00:00:00 2001 From: Kentaro Hayashi Date: Sat, 21 Mar 2026 18:55:27 +0900 Subject: [PATCH] cmap: do not add duplicated cmap format 14 entries In the previous versions of python3-fonttools allows to add duplicated cmap entries. Since python-fonttools 4.62.0 or later, it does not allow such duplicated entries anymore. ValueError: cmap subtables have duplicate (platformID, platEncID, language) entries, which the OpenType spec does not allow: {(0, 5, 255)} Signed-off-by: Kentaro Hayashi --- sources/build.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sources/build.py b/sources/build.py index ea5dcc2..ec73765 100755 --- a/sources/build.py +++ b/sources/build.py @@ -122,7 +122,9 @@ for font in IMPORT.glob("*.ttf"): cmap0_3_4.cmap = finalVersion["cmap"].getcmap(3,1).cmap #copying from merged version finalVersion["cmap"].tables.append(cmap0_3_4) - finalVersion["cmap"].tables.append(sourceTTF["cmap"].getcmap(0,5)) + # format_14 (platformID=0, platEncID=5 UVS) should not be duplicated + if not any((table.platformID == 0 and table.platEncID == 5) for table in finalVersion["cmap"].tables): + finalVersion["cmap"].tables.append(sourceTTF["cmap"].getcmap(0,5)) if "P" not in fontName: finalVersion["post"].isFixedPitch = 1 -- 2.53.0