1 # this file is part of mftrace - a tool to generate scalable fonts from bitmaps
2 # This program is free software; you can redistribute it and/or modify
3 # it under the terms of the GNU General Public License version 2
4 # as published by the Free Software Foundation
6 # This program is distributed in the hope that it will be useful,
7 # but WITHOUT ANY WARRANTY; without even the implied warranty of
8 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 # GNU Library General Public License for more details.
11 # You should have received a copy of the GNU General Public License
12 # along with this program; if not, write to the Free Software
15 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 # Copyright (c) 2001--2006 by
18 # Han-Wen Nienhuys, Jan Nieuwenhuizen
25 # Read some global vars
27 def __init__ (self
, lines
):
31 afm
= Afm_font_metric ()
32 for i
in self
.lines
[:20]:
33 m
= re
.match ('([^ \t\n]*)[ \t]*(.*[^ \t\n])', i
)
38 afm
.__dict
__[key
] = value
41 class Afm_font_metric
:
45 def read_afm_file (filename
):
46 reader
= Afm_reader (open (filename
).readlines ())
47 return reader
.get_afm ()
49 if __name__
== '__main__':
50 i
= read_afm_file (sys
.argv
[1])
51 print i
, i
.FullName
, i
.FontName