text ==== .. py:module:: text .. autoapi-nested-parse:: Draw text with the bitmap fonts generated by `make_font`. Works on any framebuf-like object that has hline(x, y, w, color), so the same code draws into framebuf.FrameBuffer on the board and into a fake on the host. Only set pixels are drawn; the background stays as it is. Attributes ---------- .. autoapisummary:: text.FALLBACK text.ELLIPSIS Functions --------- .. autoapisummary:: text.text_width text.draw_glyph text.draw_text text.wrap Module Contents --------------- .. py:data:: FALLBACK :value: '?' .. py:function:: text_width(font, s) Width of `s` in pixels. .. py:function:: draw_glyph(fb, font, key, x, y, color) Draw one glyph (a character, or an icon name) at (x, y). Unknown keys fall back to "?" if the font has one. :returns: The glyph's width in pixels. .. py:function:: draw_text(fb, font, s, x, y, color) Draw `s` with its top-left corner at (x, y); returns the end x. .. py:data:: ELLIPSIS :value: '…' .. py:function:: wrap(font, text, width, max_lines=None) Break `text` into lines of at most `width` pixels. Lines break at spaces where possible; explicit newlines are kept. With `max_lines`, the last line ends with an ellipsis if text was cut off.