make_font ========= .. py:module:: make_font .. autoapi-nested-parse:: Convert a TrueType font into a bitmap font module for the board. uv run tools/make_font.py DejaVuSans-Bold.ttf 40 src/font_large.py The generated module holds 1-bit glyphs in MONO_HLSB order (rows of (width + 7) // 8 bytes, most significant bit left), as `text` expects. Pixels at least half covered by the anti-aliased rendering are set. Attributes ---------- .. autoapisummary:: make_font.FONT_DIR make_font.CHARSET make_font.FONT_LICENSE Functions --------- .. autoapisummary:: make_font.render_glyph make_font.build_module make_font.main Module Contents --------------- .. py:data:: FONT_DIR :value: '/usr/share/fonts/truetype/dejavu' .. py:data:: CHARSET :value: 'äöüÄÖÜß°²³µμ€–·„“”‚‘’…—→' .. py:function:: render_glyph(font, char, height) Return (width, rows) where rows is the glyph bitmap in MONO_HLSB. .. py:data:: FONT_LICENSE :value: 'DejaVu Sans: Bitstream Vera license, DejaVu changes public domain (see THIRD_PARTY_NOTICES.md)' .. py:function:: build_module(font_path, size, charset=CHARSET, glyph_map=None, title=None, license_note=FONT_LICENSE) Generate the font module source. The glyphs are those of `charset`, or of `glyph_map` ({key: char}) when they are stored under names instead of their characters (icons). .. py:function:: main() Run the command line tool.