Debian Codegraph @

texmf-dist/doc/fonts/gnu-freefont/tools/test/findBackLayers.py

raw
1 #!/usr/bin/env ../utility/fontforge-interp.sh
2 __license__ = """
3 This file is part of Gnu FreeFont.
4
5 Gnu FreeFont is free software: you can redistribute it and/or modify it under
6 the terms of the GNU General Public License as published by the Free Software
7 Foundation, either version 3 of the License, or (at your option) any later
8 version.
9
10 Gnu FreeFont is distributed in the hope that it will be useful, but WITHOUT
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License along with
15 Gnu FreeFont. If not, see <http://www.gnu.org/licenses/>.
16 """
17 __author__ = "Stevan White"
18 __email__ = "[email protected]"
19 __copyright__ = "Copyright 2009, 2010, Stevan White"
20 __date__ = "$Date: 2011-11-03 01:51:05 +0100 (Thu, 03 Nov 2011) $"
21 __version__ = "$Revision: 1864 $"
22
23 __doc__ = """
24 Check for glyphs with back layers.
25
26 Haven't see this actually work...
27 """
28
29 import fontforge
30 from sys import exit
31
32 problem = False
33
34 def checkBackLayers( fontPath ):
35 print "Checking " + fontPath
36 font = fontforge.open( fontPath )
37
38 g = font.selection.all()
39 g = font.selection.byGlyphs
40
41 nonzero = 0
42
43 for e in g:
44 if e.layer_cnt != 2:
45 print e
46
47 checkBackLayers( '../sfd/FreeSerif.sfd' )
48 checkBackLayers( '../sfd/FreeSerifItalic.sfd' )
49 checkBackLayers( '../sfd/FreeSerifBold.sfd' )
50 checkBackLayers( '../sfd/FreeSerifBoldItalic.sfd' )
51 checkBackLayers( '../sfd/FreeSans.sfd' )
52 checkBackLayers( '../sfd/FreeSansOblique.sfd' )
53 checkBackLayers( '../sfd/FreeSansBold.sfd' )
54 checkBackLayers( '../sfd/FreeSansBoldOblique.sfd' )
55 checkBackLayers( '../sfd/FreeMono.sfd' )
56 checkBackLayers( '../sfd/FreeMonoOblique.sfd' )
57 checkBackLayers( '../sfd/FreeMonoBold.sfd' )
58 checkBackLayers( '../sfd/FreeMonoBoldOblique.sfd' )
59
60 if problem:
61 exit( 0 )
62 else:
63 exit( 1 )