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

Pavel Far?? INVALID.NOREPLY at gnu.org.ua
Tue Mar 15 21:39:07 CET 2022


Author: pavel
Date: 2022-03-15 20:39:07 +0000 (Tue, 15 Mar 2022)
New Revision: 27

Modified:
   trunk/gentium/source/fonts/gentium-tug/type1/afmcreator.py
Log:
refactor afmcreator.py

Modified: trunk/gentium/source/fonts/gentium-tug/type1/afmcreator.py
===================================================================
--- trunk/gentium/source/fonts/gentium-tug/type1/afmcreator.py	2022-03-15 19:59:24 UTC (rev 26)
+++ trunk/gentium/source/fonts/gentium-tug/type1/afmcreator.py	2022-03-15 20:39:07 UTC (rev 27)
@@ -9,16 +9,10 @@
 
 tempname = "temp.afm"
 
-fin = open(sys.argv[1], "r")
-fout = open(tempname, "w")
-while True:
-    s = fin.readline()
-    if s == "":
-        break  # end of file
-    fout.write(s)
-    if s.find("Comment Creation Date") == 0:
-        fout.write(creatortext)  # Creator after Creation Date
-fin.close()
-fout.close()
+with open(sys.argv[1], "r") as fin, open(tempname, "w") as fout:
+    for line in fin:
+        fout.write(line)
+        if line.startswith("Comment Creation Date"):
+            fout.write(creatortext)  # Creator after Creation Date
 
 os.rename(tempname, sys.argv[1])



More information about the gentium-commits mailing list.