"""Offline preview: render text the way the mask will, printed as ASCII art. No BLE / no hardware needed -- handy for checking how a string will look and for confirming the renderer works on this machine:: python examples/preview_text.py "HELLO" """ import sys import bitmap def main(): text = sys.argv[1] if len(sys.argv) > 1 else "HELLO" columns = bitmap.text_to_columns(text) width = len(columns) bmp = bitmap.encode_bitmap(columns) print(f"text={text!r} width={width}px bitmap={len(bmp)}B payload={len(bmp) + width * 3}B\n") for row in range(16): line = "".join("#" if columns[x][row] else " " for x in range(width)) print(line) if __name__ == "__main__": main()