3
3
# MIT License.
4
4
5
5
# Copyright (c) 2016 William Skellenger
6
- #
7
- # Permission is hereby granted, free of charge, to any person obtaining a
8
- # copy of this software and associated documentation files (the "Software"),
9
- # to deal in the Software without restriction, including without limitation
10
- # the rights to use, copy, modify, merge, publish, distribute, sublicense,
11
- # and/or sell copies of the Software, and to permit persons to whom the
6
+ #
7
+ # Permission is hereby granted, free of charge, to any person obtaining a
8
+ # copy of this software and associated documentation files (the "Software"),
9
+ # to deal in the Software without restriction, including without limitation
10
+ # the rights to use, copy, modify, merge, publish, distribute, sublicense,
11
+ # and/or sell copies of the Software, and to permit persons to whom the
12
12
# Software is furnished to do so, subject to the following conditions:
13
- #
14
- # The above copyright notice and this permission notice shall be included
13
+ #
14
+ # The above copyright notice and this permission notice shall be included
15
15
# in all copies or substantial portions of the Software.
16
- #
17
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18
- # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
- # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
16
+ #
17
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18
+ # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
23
23
# IN THE SOFTWARE.
24
24
25
25
# This small script is designed to mostly take a BDF file and convert it to a
32
32
#
33
33
# Usage: bdf2adafruit.py <somefont.bdf> > out.txt
34
34
#
35
- # Once you have out.txt you can cut/paste the contents into a new font
35
+ # Once you have out.txt you can cut/paste the contents into a new font
36
36
# header file as part of the Adafruit GFX library.
37
37
38
38
import sys
@@ -54,7 +54,7 @@ class Glyph:
54
54
height = 0
55
55
advance = 0
56
56
xoffs = 0
57
- yoffs = 0
57
+ yoffs = 0
58
58
def __init__ (self , comment ):
59
59
self .comment = comment
60
60
self .rows = []
@@ -107,7 +107,7 @@ def __init__(self, comment):
107
107
#g.rows.append(int(line, 16)) #append pixel rows into glyph's list of rows
108
108
bitmapData .append (int (line , 16 ))
109
109
110
- print
110
+ print
111
111
112
112
i = 0
113
113
for char in chars :
@@ -128,8 +128,8 @@ def __init__(self, comment):
128
128
print ("\t /* 0x%02X %s */" % (char .encoding , char .comment ))
129
129
130
130
for char in chars :
131
- # offset, bit-width, bit-height, advance cursor, x offset, y offset
131
+ # offset, bit-width, bit-height, advance cursor, x offset, y offset
132
132
print ("\t { %d, %d, %d, %d, %d, %d }, /* 0x%02X %s */" % (
133
- char .offset , char .width , char .height ,
134
- char .advance , char .xoffs , char .yoffs ,
133
+ char .offset , char .width , char .height ,
134
+ char .advance , char .xoffs , char .yoffs ,
135
135
char .encoding , char .comment ))
0 commit comments