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

Pavel Far?? INVALID.NOREPLY at gnu.org.ua
Sun Mar 27 17:27:50 CEST 2022


Author: pavel
Date: 2022-03-27 15:27:49 +0000 (Sun, 27 Mar 2022)
New Revision: 60

Modified:
   trunk/test/type1/Scripts/SplitKerns/split_kerning_pairs.py
Log:
split also Greek kerns into its own file

Now, the scrips also writes the extra kerning pairs for Greek
into its own file. Before, the kerning pairs were in the 'rest'
file. It uses the LGR encoding for finding the letters and it
finds all the Greek extra kerning pairs. Therefore, there is
no need to use also AGR encoding.


Modified: trunk/test/type1/Scripts/SplitKerns/split_kerning_pairs.py
===================================================================
--- trunk/test/type1/Scripts/SplitKerns/split_kerning_pairs.py	2022-03-27 15:02:42 UTC (rev 59)
+++ trunk/test/type1/Scripts/SplitKerns/split_kerning_pairs.py	2022-03-27 15:27:49 UTC (rev 60)
@@ -8,11 +8,13 @@
 ENC_PATH = '../../../gentium/fonts/enc/dvips/gentium-tug/'
 T1_ENC_NAME = ENC_PATH + 'gentium-ec.enc'
 L7X_ENC_NAME = ENC_PATH + 'gentium-l7x.enc'
+LGR_ENC_NAME = ENC_PATH + 'gentium-lgr.enc'
 
 input_kern_file = sys.argv[1]
 
 T1_OUTPUT_FILE  = "kerns-t1.afm"
 L7X_OUTPUT_FILE  = "kerns-l7x.afm"
+LGR_OUTPUT_FILE  = "kerns-lgr.afm"
 REST_OUTPUT_FILE  = "kerns-rest.afm"
 
 SMALL_CAPS_EXTENSION = ".sc"
@@ -42,11 +44,20 @@
         if line.startswith('/'):
             add_one_glyph(line, l7x_glyph_names)
 
+# create set with glyphs in LRG
+lgr_glyph_names = set("")
+with open(LGR_ENC_NAME) as lgr_encoding_file:
+    for line in lgr_encoding_file:
+        if line.startswith('/'):
+            add_one_glyph(line, lgr_glyph_names)
 
+
+
 # split the kerning file to encodings T1, L7x and rest
 with open(input_kern_file) as input_file, \
         open(T1_OUTPUT_FILE, "w") as t1_output_file, \
         open(L7X_OUTPUT_FILE, "w") as l7x_output_file, \
+        open(LGR_OUTPUT_FILE, "w") as lgr_output_file, \
         open(REST_OUTPUT_FILE, "w") as rest_output_file:
 
     for line in input_file:
@@ -57,5 +68,7 @@
             t1_output_file.write(line)
         elif first_glyph in l7x_glyph_names and second_glyph in l7x_glyph_names:
             l7x_output_file.write(line)
+        elif first_glyph in lgr_glyph_names and second_glyph in lgr_glyph_names:
+            lgr_output_file.write(line)
         else:
             rest_output_file.write(line)



More information about the gentium-commits mailing list.