Debian Codegraph @

tools/test/findBackLayers.py

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