[gs-cvs] rev 8070 - trunk/gs/toolbin

giles at ghostscript.com giles at ghostscript.com
Wed Jun 20 12:46:52 PDT 2007


Author: giles
Date: 2007-06-20 12:46:52 -0700 (Wed, 20 Jun 2007)
New Revision: 8070

Modified:
   trunk/gs/toolbin/afmutil.py
Log:
Hack in some support for comparing WX fields with --diff. Incomplete.


Modified: trunk/gs/toolbin/afmutil.py
===================================================================
--- trunk/gs/toolbin/afmutil.py	2007-06-19 16:59:20 UTC (rev 8069)
+++ trunk/gs/toolbin/afmutil.py	2007-06-20 19:46:52 UTC (rev 8070)
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 
-# Copyright (C) 2002 Artifex Software, Inc.
+# Copyright (C) 2002-2007 Artifex Software, Inc.
 #
 # This software is provided AS-IS with no warranty, either express or
 # implied.
@@ -102,12 +102,26 @@
     two = fontmetric(b)
     two.parse()
     print "differences between '"+a+"' and '"+b+"':"
-    print "  [not yet implemented. try --dump on each file and then running 'diff']"
-    
+    #print "  [not yet implemented. try --dump on each file and then running 'diff']"
+    # break abstraction
+    glyphs = one.metrics.keys()
+    glyphs.sort()
+    count = 0
+    for glyph in glyphs:
+      awx = one.metrics[glyph]['WX']
+      try:
+        bwx = two.metrics[glyph]['WX']
+      except KeyError:
+        continue
+      if awx != bwx:
+        count += 1
+        print " ", glyph, awx, bwx
+    print count, "advance width differences"
+
 import sys, getopt
 
 def usage():
-    print "Usage: " + sys.argv[0] + "[options] <files>"
+    print "Usage: " + sys.argv[0] + " [options] <file1.afm> [<file2.afm>]"
     print "reads adobe font metric files an preforms various tasks"
     print " options:"
     print "   --dump prints the parsed data for manual comparison"



More information about the gs-cvs mailing list