From f3f75c56bacb690998c81d922f15a3ceb5eda8c6 Mon Sep 17 00:00:00 2001 From: Peter Hinch Date: Sun, 11 Mar 2018 11:01:46 +0000 Subject: [PATCH] Add warning about ttf extended ASCII. --- FONT_TO_PY.md | 4 ++++ font_to_py.py | 2 ++ 2 files changed, 6 insertions(+) diff --git a/FONT_TO_PY.md b/FONT_TO_PY.md index 6fdecd8..824b9d6 100644 --- a/FONT_TO_PY.md +++ b/FONT_TO_PY.md @@ -44,6 +44,10 @@ Example usage to produce a file ``myfont.py`` with height of 23 pixels: Any requirement for arguments -xr will be specified in the device driver documentation. Bit reversal is required by some display hardware. +Note that producing extended ASCII characters (ordinal value > 127) from ttf +files seems unreliable. If the expected results are not achieved, use an otf +font. This appears to be a limitation of the `freetype` library. + ### Output The specified height is a target. The algorithm gets as close to the target diff --git a/font_to_py.py b/font_to_py.py index d81b0ea..55a1006 100755 --- a/font_to_py.py +++ b/font_to_py.py @@ -517,6 +517,8 @@ if __name__ == "__main__": if args.largest > 255: quit('--largest must be < 256') + elif args.largest > 127 and os.path.splitext(args.infile)[1].upper() == '.TTF': + print('WARNING: extended ASCII characters may not be correctly converted. See docs.') if args.errchar < 0 or args.errchar > 255: quit('--errchar must be between 0 and 255')