[gentium-commits] [SCM] gentium updated: r89 - trunk/gentium/source/fonts/gentium-tug/type1

Pavel Far?? INVALID.NOREPLY at gnu.org.ua
Wed Apr 6 21:11:02 CEST 2022


Author: pavel
Date: 2022-04-06 19:11:02 +0000 (Wed, 06 Apr 2022)
New Revision: 89

Modified:
   trunk/gentium/source/fonts/gentium-tug/type1/kerncorrection.py
Log:
use more kerning classes

Not sure if using only kerning classes is a good idea.


Modified: trunk/gentium/source/fonts/gentium-tug/type1/kerncorrection.py
===================================================================
--- trunk/gentium/source/fonts/gentium-tug/type1/kerncorrection.py	2022-04-06 17:47:40 UTC (rev 88)
+++ trunk/gentium/source/fonts/gentium-tug/type1/kerncorrection.py	2022-04-06 19:11:02 UTC (rev 89)
@@ -32,6 +32,14 @@
 
 # TODO: refactor the script; maybe remove classes
 
+
+# TODO Decide if should be used purely class-based kerning.
+
+# The script currently combines class-based kerning and deriving kerning from list
+# of kerns. Changing it to completely class-based kerning would create more kerning
+# pairs than now. The current (mixed) sollution makes it possible to make exceptions
+# to class-based kerning.
+
 import os, sys, re
 
 import collections
@@ -136,26 +144,13 @@
     ]
 
     kern_pairs_small = [
-        ["v e", "v eacute", "v ecaron", "v ecircumflex", "v edieresis", "v edotaccent", "v egrave", "v emacron", "v eogonek"],
         ["k e", "k eacute", "k ecaron", "k ecircumflex", "k edieresis", "k edotaccent", "k egrave", "k emacron", "k eogonek", "kcommaaccent e"],
-        ["o v", "oacute v", "ocircumflex v", "odieresis v", "ograve v", "oslash v", "otilde v"],
-        ["o x", "oacute x", "ocircumflex x", "odieresis x", "ograve x", "oslash x", "otilde x"],
-        ["v a", "v aacute", "v abreve", "v acircumflex", "v adieresis", "v ae", "v agrave", "v amacron", "v aogonek", "v aring", "v atilde"],
-        ["v o", "v oacute", "v ocircumflex", "v odieresis", "v oe", "v ograve", "v ohungarumlaut", "v omacron", "v oslash", "v otilde"],
         ["r a", "r aacute", "r abreve", "r acircumflex", "r adieresis", "r ae", "r agrave", "r amacron", "r aogonek", "r aring", "r atilde", "racute a", "rcaron a", "rcommaaccent a", "rcaron aacute"],
         ["r e", "r eacute", "r ecaron", "r edieresis", "r edotaccent", "r egrave", "r emacron", "r eogonek", "racute e", "rcaron e", "rcommaaccent e", "rcaron eacute"],
         ["r c", "r cacute", "r ccaron", "r ccedilla", "r cdotaccent", "racute c", "rcaron c", "rcommaaccent c", "rcaron ccaron"],
-        ["r q", "racute q", "rcaron q", "rcommaaccent q"],
         ["y e", "y eacute", "y ecaron", "y ecircumflex", "y edieresis", "y edotaccent", "y egrave", "y emacron", "y eogonek", "yacute e", "ydieresis e", "yacute eacute"],
         ["y o", "y oacute", "y ocircumflex", "y odieresis", "y oe", "y ograve", "y ohungarumlaut", "y omacron", "y oslash", "y otilde", "yacute o", "ydieresis o", "yacute oacute"],
-        ["a v", "aacute v", "abreve v", "acircumflex v", "adieresis v", "agrave v", "amacron v", "aogonek v", "aring v", "atilde v"],
-        ["a w", "aacute w", "abreve w", "acircumflex w", "adieresis w", "agrave w", "amacron w", "aogonek w", "aring w", "atilde w"],
-        ["c h", "cacute h", "ccaron h", "ccedilla h", "cdotaccent h"],
-        ["c k", "cacute k", "ccaron k", "ccedilla k", "cdotaccent k"],
-        ["e x", "eacute x", "ecaron x", "ecircumflex x", "edieresis x", "edotaccent x", "egrave x", "emacron x", "eogonek x"],
-        ["o w", "oacute w", "ocircumflex w", "odieresis w", "ograve w", "oslash w", "otilde w"],
         ["r o", "r oacute", "r ocircumflex", "r odieresis", "r oe", "r ograve", "r ohungarumlaut", "r omacron", "r oslash", "r otilde", "racute o", "rcaron o", "rcommaaccent o", "rcaron oacute"],
-        ["x e", "x eacute", "x ecaron", "x ecircumflex", "x edieresis", "x edotaccent", "x egrave", "x emacron", "x eogonek"],
         ["y a", "y aacute", "y abreve", "y acircumflex", "y adieresis", "y ae", "y agrave", "y amacron", "y aogonek", "y aring", "y atilde", "yacute a", "ydieresis a", "yacute aacute"],
         ["r d", "r dcaron", "r dcroat", "racute d", "rcaron d", "rcommaaccent d", "rcaron dcaron"]
     ]
@@ -174,10 +169,24 @@
         ["A quoteright", "quotesinglbase V", "quotesinglbase W", "quotesinglbase Y", "quotesinglbase Yacute", "quotesinglbase T", "quotesinglbase Tcaron"]
     ]
 
-    right_punctuation_small = [
+    latin_class_kerns = [
+        # sort lines before commit!
+        "a v",
+        "a w",
+        "c h",
+        "c k",
+        "e x",
+        "o v",
+        "o w",
+        "o x",
         "r comma",
+        "r period",
+        "r q",
+        "v a",
+        "v e",
+        "v o",
+        "x e",
         "y comma",
-        "r period",
         "y period",
         # nothing to be derived from "f quoteright" and "f quotedblright"
     ]
@@ -185,7 +194,13 @@
     # similar Latin letters that come first in the kerning pair
     latin_left_classes = {
         # sort lines before commit!
+        "a": ["a", "aacute", "abreve", "acircumflex", "adieresis", "agrave", "amacron", "aogonek", "aring", "atilde"],
+        "c": ["c", "cacute", "ccaron", "ccedilla", "cdotaccent"],
+        "e": ["e", "eacute", "ecaron", "ecircumflex", "edieresis", "edotaccent", "egrave", "emacron", "eogonek"],
+        "o": ["o", "oacute", "ocircumflex", "odieresis", "ograve", "oslash", "otilde"],
         "r": ["r", "racute", "rcaron", "rcommaaccent"],
+        "v": ["v"],
+        "x": ["x"],
         "y": ["y", "yacute", "ydieresis"],
     }
 
@@ -192,8 +207,17 @@
     # similar Latin letters that come second in the kerning pair
     latin_right_classes = {
         # sort lines before commit!
+        "a": ["a", "aacute", "abreve", "acircumflex", "adieresis", "ae", "agrave", "amacron", "aogonek", "aring", "atilde"],
         "comma": ["comma"],
+        "e": ["e", "eacute", "ecaron", "ecircumflex", "edieresis", "edotaccent", "egrave", "emacron", "eogonek"],
+        "h": ["h"],
+        "k": ["k"],
+        "o": ["o", "oacute", "ocircumflex", "odieresis", "oe", "ograve", "ohungarumlaut", "omacron", "oslash", "otilde"],
         "period": ["period"],
+        "q": ["q"],
+        "v": ["v"],
+        "w": ["w"],
+        "x": ["x"],
     }
 
 
@@ -381,8 +405,8 @@
 
         return derived_kerns[1:]  # remove the base kern that is already in the font
 
-    def accented_right_punctuation(self, fromreader):
-        for basekern in self.right_punctuation_small:
+    def make_latin_class_kerns(self, fromreader):
+        for basekern in self.latin_class_kerns:
             derivedkerns = self.make_derived_latin_kerns(basekern)
             a = fromreader.getkerns("KPX " + basekern + " ")
             kernline = a[0]
@@ -453,7 +477,7 @@
 output_generator.accented_small_caps(fin)
 output_generator.accented_initial_cap(fin)
 output_generator.accented_initial_cap_small_cap(fin)
-output_generator.accented_right_punctuation(fin)
+output_generator.make_latin_class_kerns(fin)
 output_generator.accented_left_punctuation(fin)
 output_generator.czech_quotes(fin)
 output_generator.cyrillic_kerns(fin)



More information about the gentium-commits mailing list.