[gentium-commits] [SCM] gentium updated: r70 - trunk/test/type1/Scripts/SplitKerns

Pavel Far?? INVALID.NOREPLY at gnu.org.ua
Tue Mar 29 21:21:08 CEST 2022


Author: pavel
Date: 2022-03-29 19:21:08 +0000 (Tue, 29 Mar 2022)
New Revision: 70

Modified:
   trunk/test/type1/Scripts/SplitKerns/split_kerning_pairs.py
Log:
fix removing comment from *.enc when splitting kerns

This new version deletes everything after the first whitespace and the
result (except for the first character '/') considers as the name of the
character. This allows different styles of comments in the encoding files.
The comments can be separated from the character name by any whitespace
now. This makes it possible to use different styles of comments and makes
it more future-proof.


Modified: trunk/test/type1/Scripts/SplitKerns/split_kerning_pairs.py
===================================================================
--- trunk/test/type1/Scripts/SplitKerns/split_kerning_pairs.py	2022-03-29 18:24:56 UTC (rev 69)
+++ trunk/test/type1/Scripts/SplitKerns/split_kerning_pairs.py	2022-03-29 19:21:08 UTC (rev 70)
@@ -25,9 +25,19 @@
         return
     if glyph_line.startswith('/gentium-'):  # skip the encoding name
         return
-    from_character = 1  # remove the first character '/'
-    to_character = glyph_line.find(" %")  # till the end or before comment if present
-    glyph_name = glyph_line[from_character:to_character]
+
+    # remove the first character '/'
+    temporary_name = glyph_line[1:]
+
+    # remove optional comment
+    #
+    # Finding the substring " %" is fragile. It is better to split the input
+    # line into whitespace separated parts and take the first part. That
+    # means that everything from the first whitespace is ignored. That will
+    # correctly remove comment that follows multiple spaces or tabulator.
+    # That makes it possible to write comments in different formats.
+    glyph_name = temporary_name.split()[0]
+
     glyph_list.add(glyph_name)
 
 # create set with glyphs in T1



More information about the gentium-commits mailing list.