V0.33 Add baseline(), fix bug with name check.

pull/28/head
Peter Hinch 2019-10-17 07:32:27 +01:00
rodzic b854d8f078
commit 6e9e934939
2 zmienionych plików z 10 dodań i 4 usunięć

Wyświetl plik

@ -9,9 +9,13 @@ targets: the font file may be incorporated into a firmware build such that it
occupies flash memory rather than scarce RAM. Python code built into firmware
is known as frozen bytecode.
## V0.32 notes
## Recent revisions
21 Sept 2019
17 Oct 2019 V0.33 With thanks to Stephen Irons (@ironss).
1. Fix bug where input rather than output filename was checked.
2. Add `baseline()` to ouput file returning the maximum descent.
21 Sept 2019 V0.22
1. Reduced output file size for sparse fonts. These result from large gaps
between ordinal values of Unicode characters not in the standard ASCII set.

Wyświetl plik

@ -312,6 +312,7 @@ class Font(dict):
self.height = int(max_ascent + max_descent)
st = 'Height set in {} passes. Actual height {} pixels.\nMax character width {} pixels.'
print(st.format(npass + 1, self.height, max_width))
self._max_ascent = int(max_ascent)
self._max_descent = int(max_descent)
return max_width
@ -393,7 +394,7 @@ class Font(dict):
STR01 = """# Code generated by font_to_py.py.
# Font: {}{}
# Cmd: {}
version = '0.32'
version = '0.33'
"""
@ -478,6 +479,7 @@ def write_data(stream, fnt, font_path, hmap, reverse, iterate, charset):
cl = ' '.join(sys.argv)
stream.write(STR01.format(os.path.split(font_path)[1], st, cl))
write_func(stream, 'height', height)
write_func(stream, 'baseline', fnt._max_ascent)
write_func(stream, 'max_width', fnt.max_width)
write_func(stream, 'hmap', hmap)
write_func(stream, 'reverse', reverse)
@ -598,7 +600,7 @@ if __name__ == "__main__":
default = '')
args = parser.parse_args()
if not args.infile[0].isalpha():
if not args.outfile[0].isalpha():
quit('Font filenames must be valid Python variable names.')
if not os.path.isfile(args.infile):