From 5c3736645178214ff667b16c525a6cc3d4ba9d77 Mon Sep 17 00:00:00 2001 From: Peter Hinch Date: Fri, 6 Jan 2017 15:16:58 +0000 Subject: [PATCH] README: add font file interface --- README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/README.md b/README.md index 14749de..ebaa8c1 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,25 @@ Converting font files programmatically works best for larger fonts. For small fonts, like the 8*8 default used by the SSD1306 driver, it is best to use binary font files: these are hand designed for rendering at a specific size. +# Font file interface + +A font file is imported in the usual way e.g. ``import font14``. It contains +the following methods which return values defined by the arguments which were +provided to font-to-py: + +``height`` Returns height in pixels. +``max_width`` Returns maximum width of a glyph in pixels. +``hmap`` Returns ``True`` if font is horizontally mapped. Should return ``True`` +``reverse`` Returns ``True`` if bit reversal was specified. Should return ``False`` +``monospaced`` Returns ``True`` if monospaced rendering was specified. + +Glyphs are returned with the ``get_ch`` method. Its argument is a character +and it returns the following values: + + * A ``memoryview`` object containg the glyph bytes. + * The height in pixels. + * The character width in pixels. + # Licence All code is released under the MIT licence.