[gentium-commits] [SCM] gentium updated: r81 - in trunk/test/type1/Scripts: . SplitKerns

Pavel Far?? INVALID.NOREPLY at gnu.org.ua
Mon Apr 4 16:45:43 CEST 2022


Author: pavel
Date: 2022-04-04 14:45:43 +0000 (Mon, 04 Apr 2022)
New Revision: 81

Modified:
   trunk/test/type1/Scripts/Makefile
   trunk/test/type1/Scripts/SplitKerns/split_kerning_pairs.py
Log:
split the extra kerns also to other Cyrillic encodings

First look into X2, then, T2A, T2B and T2C. The reason:
X2 doesn't contain all Cyrillic letters that are in the
T2{A,B,C} encodings.


Modified: trunk/test/type1/Scripts/Makefile
===================================================================
--- trunk/test/type1/Scripts/Makefile	2022-04-04 14:18:30 UTC (rev 80)
+++ trunk/test/type1/Scripts/Makefile	2022-04-04 14:45:43 UTC (rev 81)
@@ -69,8 +69,14 @@
 	mv GentiumPlus-Italic-kerns-l7x.afm ../Kerns/Kerns-L7x
 	mv GentiumPlus-Regular-kerns-t1.afm ../Kerns/Kerns-T1
 	mv GentiumPlus-Italic-kerns-t1.afm ../Kerns/Kerns-T1
+	mv GentiumPlus-Regular-kerns-x2.afm ../Kerns/Kerns-X2
+	mv GentiumPlus-Italic-kerns-x2.afm ../Kerns/Kerns-X2
 	mv GentiumPlus-Regular-kerns-t2a.afm ../Kerns/Kerns-T2A
 	mv GentiumPlus-Italic-kerns-t2a.afm ../Kerns/Kerns-T2A
+	mv GentiumPlus-Regular-kerns-t2b.afm ../Kerns/Kerns-T2B
+	mv GentiumPlus-Italic-kerns-t2b.afm ../Kerns/Kerns-T2B
+	mv GentiumPlus-Regular-kerns-t2c.afm ../Kerns/Kerns-T2C
+	mv GentiumPlus-Italic-kerns-t2c.afm ../Kerns/Kerns-T2C
 	mv GentiumPlus-Regular-kerns-rest.afm ../Kerns/Kerns-rest
 	mv GentiumPlus-Italic-kerns-rest.afm ../Kerns/Kerns-rest
 

Modified: trunk/test/type1/Scripts/SplitKerns/split_kerning_pairs.py
===================================================================
--- trunk/test/type1/Scripts/SplitKerns/split_kerning_pairs.py	2022-04-04 14:18:30 UTC (rev 80)
+++ trunk/test/type1/Scripts/SplitKerns/split_kerning_pairs.py	2022-04-04 14:45:43 UTC (rev 81)
@@ -1,6 +1,6 @@
 #! /usr/bin/env python3
 
-# Splits kerning pairs into T1, L7x and rest
+# Splits kerning pairs into several encodings and rest
 # Needs one argument--the afm file to split
 
 import sys
@@ -9,7 +9,10 @@
 T1_ENC_NAME = ENC_PATH + 'gentium-ec.enc'
 L7X_ENC_NAME = ENC_PATH + 'gentium-l7x.enc'
 LGR_ENC_NAME = ENC_PATH + 'gentium-lgr.enc'
+X2_ENC_NAME = ENC_PATH + 'gentium-x2.enc'
 T2A_ENC_NAME = ENC_PATH + 'gentium-t2a.enc'
+T2B_ENC_NAME = ENC_PATH + 'gentium-t2b.enc'
+T2C_ENC_NAME = ENC_PATH + 'gentium-t2c.enc'
 
 input_kern_file = sys.argv[1]
 
@@ -16,7 +19,10 @@
 T1_OUTPUT_FILE  = "kerns-t1.afm"
 L7X_OUTPUT_FILE  = "kerns-l7x.afm"
 LGR_OUTPUT_FILE  = "kerns-lgr.afm"
+X2_OUTPUT_FILE  = "kerns-x2.afm"
 T2A_OUTPUT_FILE  = "kerns-t2a.afm"
+T2B_OUTPUT_FILE  = "kerns-t2b.afm"
+T2C_OUTPUT_FILE  = "kerns-t2c.afm"
 REST_OUTPUT_FILE  = "kerns-rest.afm"
 
 SMALL_CAPS_EXTENSION = ".sc"
@@ -71,6 +77,13 @@
         if line.startswith('/'):
             add_one_glyph(line, lgr_glyph_names)
 
+# create set with glyphs in X2
+x2_glyph_names = set("")
+with open(X2_ENC_NAME) as x2_encoding_file:
+    for line in x2_encoding_file:
+        if line.startswith('/'):
+            add_one_glyph(line, x2_glyph_names)
+
 # create set with glyphs in T2A
 t2a_glyph_names = set("")
 with open(T2A_ENC_NAME) as t2a_encoding_file:
@@ -78,13 +91,29 @@
         if line.startswith('/'):
             add_one_glyph(line, t2a_glyph_names)
 
+# create set with glyphs in T2B
+t2b_glyph_names = set("")
+with open(T2B_ENC_NAME) as t2b_encoding_file:
+    for line in t2b_encoding_file:
+        if line.startswith('/'):
+            add_one_glyph(line, t2b_glyph_names)
 
-# split the kerning file to encodings T1, L7x and rest
+# create set with glyphs in T2C
+t2c_glyph_names = set("")
+with open(T2C_ENC_NAME) as t2c_encoding_file:
+    for line in t2c_encoding_file:
+        if line.startswith('/'):
+            add_one_glyph(line, t2c_glyph_names)
+
+# split the kerning file to different encodings 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(X2_OUTPUT_FILE, "w") as x2_output_file, \
         open(T2A_OUTPUT_FILE, "w") as t2a_output_file, \
+        open(T2B_OUTPUT_FILE, "w") as t2b_output_file, \
+        open(T2C_OUTPUT_FILE, "w") as t2c_output_file, \
         open(REST_OUTPUT_FILE, "w") as rest_output_file:
 
     for line in input_file:
@@ -97,7 +126,13 @@
             l7x_output_file.write(line)
         elif first_glyph in lgr_glyph_names and second_glyph in lgr_glyph_names:
             lgr_output_file.write(line)
+        elif first_glyph in x2_glyph_names and second_glyph in x2_glyph_names:
+            x2_output_file.write(line)
         elif first_glyph in t2a_glyph_names and second_glyph in t2a_glyph_names:
             t2a_output_file.write(line)
+        elif first_glyph in t2b_glyph_names and second_glyph in t2b_glyph_names:
+            t2b_output_file.write(line)
+        elif first_glyph in t2c_glyph_names and second_glyph in t2c_glyph_names:
+            t2c_output_file.write(line)
         else:
             rest_output_file.write(line)



More information about the gentium-commits mailing list.