#!/usr/bin/env python3 """Uppercase Russian bitmap font for the RT-4D, 6px wide (col 6 blank => 1px gap with the fixed 7px advance), body rows 3..10 (descenders to 11). Format encoded elsewhere: column-major 7 cols x 14 rows, 2 bytes/col LE, bit0=top. Each glyph here is a list of up to 9 six-char rows placed starting at row `TOP`.""" TOP = 3 # 6-wide bitmaps (cols 0..5). '#'=pixel. Bottom-aligned on baseline row 10. UPPER = { "А": ["_####_","#____#","#____#","#____#","######","#____#","#____#","#____#"], "Б": ["######","#_____","#_____","#####_","#____#","#____#","#____#","#####_"], "В": ["#####_","#____#","#____#","#####_","#____#","#____#","#____#","#####_"], "Г": ["######","#_____","#_____","#_____","#_____","#_____","#_____","#_____"], "Д": ["_####_","_#__#_","_#__#_","_#__#_","_#__#_","######","#____#","#____#"], "Е": ["######","#_____","#_____","#####_","#_____","#_____","#_____","######"], "Ё": ["#_##_#","______","######","#_____","#####_","#_____","#_____","######"], "Ж": ["#_#_#_","#_#_#_","_###__","__#___","_###__","#_#_#_","#_#_#_","#_#_#_"], "З": ["_###__","#___#_","____#_","__##__","____#_","#___#_","_###__","______"], "И": ["#____#","#___##","#__#_#","#_#__#","##___#","#____#","#____#","#____#"], "Й": ["_####_","#____#","#___##","#__#_#","#_#__#","##___#","#____#","#____#"], "К": ["#___#_","#__#__","#_#___","##____","#_#___","#__#__","#___#_","#____#"], "Л": ["_####_","_#__#_","_#__#_","_#__#_","_#__#_","#___#_","#___#_","#___#_"], "М": ["#____#","##__##","#_##_#","#_##_#","#____#","#____#","#____#","#____#"], "Н": ["#____#","#____#","#____#","######","#____#","#____#","#____#","#____#"], "О": ["_####_","#____#","#____#","#____#","#____#","#____#","#____#","_####_"], "П": ["######","#____#","#____#","#____#","#____#","#____#","#____#","#____#"], "Р": ["#####_","#____#","#____#","#####_","#_____","#_____","#_____","#_____"], "С": ["_####_","#____#","#_____","#_____","#_____","#_____","#____#","_####_"], "Т": ["######","__#___","__#___","__#___","__#___","__#___","__#___","__#___"], "У": ["#____#","#____#","#____#","_####_","___#__","___#__","__#___","_##___"], "Ф": ["__#___","_####_","#_#__#","#_#__#","#_#__#","_####_","__#___","__#___"], "Х": ["#____#","#____#","_#__#_","__##__","__##__","_#__#_","#____#","#____#"], "Ц": ["#___#_","#___#_","#___#_","#___#_","#___#_","#___#_","######","____##"], "Ч": ["#____#","#____#","#____#","_#####","_____#","_____#","_____#","_____#"], "Ш": ["#_#__#","#_#__#","#_#__#","#_#__#","#_#__#","#_#__#","#_#__#","######"], "Щ": ["#_#__#","#_#__#","#_#__#","#_#__#","#_#__#","#_#__#","######","_____#"], "Ъ": ["##____","_#____","_#____","_####_","_#___#","_#___#","_#___#","_####_"], "Ы": ["#____#","#____#","#____#","##___#","#_#__#","#_#__#","#_#__#","##___#"], "Ь": ["#_____","#_____","#_____","#####_","#____#","#____#","#____#","#####_"], "Э": ["_###__","#___#_","____#_","__###_","____#_","____#_","#___#_","_###__"], "Ю": ["#__##_","#_#__#","#_#__#","###__#","#_#__#","#_#__#","#_#__#","#__##_"], "Я": ["_#####","#____#","#____#","_#####","__#__#","_#___#","#____#","#____#"], } def rows_for(ch): body = UPPER[ch] grid = ["______"] * 14 for i, r in enumerate(body): grid[TOP + i] = r.replace("_", ".") return grid