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