code wiki / _hdl_build / nx_font_cyrillic8.nx

nx_font_cyrillic8.nx source

↩ module page · 51 lines · 3242 B

1// nx_font_cyrillic8.nx -- sovereign 8x8 CYRILLIC bitmap font (uppercase Russian А..Я, codepoints U+0410..U+042F), 2// same format as nx_font8x8 (8 bytes/glyph, byte=row top->bottom, bit 0 (LSB)=leftmost column). Pure glyph DATA 3// (no 3rd-party font). Look-alike letters reuse the proven nx_font8x8 Latin shapes (А=A, В=B, Е=E, К=K, М=M, 4// Н=H, О=O, Р=P, С=C, Т=T, У=Y, Х=X); the 20 distinct letters are DESIGNED here. Lowercase folds to uppercase 5// in the renderer. This is what lets the Belarus girl read her language NATIVELY (not romanized). license_tier: ORIGINAL 6import "nx_syscalls.nx" 7 8func cf(t: *u8, i: i64, b0: i64, b1: i64, b2: i64, b3: i64, b4: i64, b5: i64, b6: i64, b7: i64) -> i64 { 9 let o: i64 = i * 8 10 t[o+0]=b0 as u8; t[o+1]=b1 as u8; t[o+2]=b2 as u8; t[o+3]=b3 as u8 11 t[o+4]=b4 as u8; t[o+5]=b5 as u8; t[o+6]=b6 as u8; t[o+7]=b7 as u8 12 return 0 13} 14 15// 32 glyphs indexed by (codepoint - 0x0410): А Б В Г Д Е Ж З И Й К Л М Н О П Р С Т У Ф Х Ц Ч Ш Щ Ъ Ы Ь Э Ю Я 16func cyr8_table() -> *u8 { 17 let t: *u8 = sys_mmap(32 * 8) 18 cf(t,0, 0x0C,0x1E,0x33,0x33,0x3F,0x33,0x33,0x00) // А (=Latin A) 19 cf(t,1, 0x3F,0x01,0x01,0x1F,0x21,0x21,0x1F,0x00) // Б 20 cf(t,2, 0x3F,0x66,0x66,0x3E,0x66,0x66,0x3F,0x00) // В (=Latin B) 21 cf(t,3, 0x3F,0x01,0x01,0x01,0x01,0x01,0x01,0x00) // Г 22 cf(t,4, 0x1C,0x14,0x14,0x14,0x3E,0x22,0x22,0x00) // Д 23 cf(t,5, 0x7F,0x46,0x16,0x1E,0x16,0x46,0x7F,0x00) // Е (=Latin E) 24 cf(t,6, 0x15,0x0E,0x1F,0x04,0x1F,0x0E,0x15,0x00) // Ж 25 cf(t,7, 0x0E,0x11,0x10,0x0C,0x10,0x11,0x0E,0x00) // З 26 cf(t,8, 0x11,0x19,0x19,0x15,0x13,0x13,0x11,0x00) // И 27 cf(t,9, 0x04,0x11,0x19,0x15,0x13,0x11,0x11,0x00) // Й 28 cf(t,10, 0x67,0x66,0x36,0x1E,0x36,0x66,0x67,0x00) // К (=Latin K) 29 cf(t,11, 0x0C,0x0C,0x0A,0x0A,0x0A,0x09,0x09,0x00) // Л 30 cf(t,12, 0x63,0x77,0x7F,0x7F,0x6B,0x63,0x63,0x00) // М (=Latin M) 31 cf(t,13, 0x33,0x33,0x33,0x3F,0x33,0x33,0x33,0x00) // Н (=Latin H) 32 cf(t,14, 0x1C,0x36,0x63,0x63,0x63,0x36,0x1C,0x00) // О (=Latin O) 33 cf(t,15, 0x1F,0x11,0x11,0x11,0x11,0x11,0x11,0x00) // П 34 cf(t,16, 0x3F,0x66,0x66,0x3E,0x06,0x06,0x0F,0x00) // Р (=Latin P) 35 cf(t,17, 0x3C,0x66,0x03,0x03,0x03,0x66,0x3C,0x00) // С (=Latin C) 36 cf(t,18, 0x3F,0x2D,0x0C,0x0C,0x0C,0x0C,0x1E,0x00) // Т (=Latin T) 37 cf(t,19, 0x33,0x33,0x33,0x1E,0x0C,0x0C,0x1E,0x00) // У (=Latin Y) 38 cf(t,20, 0x04,0x15,0x15,0x15,0x0E,0x04,0x04,0x00) // Ф 39 cf(t,21, 0x63,0x63,0x36,0x1C,0x1C,0x36,0x63,0x00) // Х (=Latin X) 40 cf(t,22, 0x11,0x11,0x11,0x11,0x11,0x1F,0x10,0x00) // Ц 41 cf(t,23, 0x11,0x11,0x11,0x1F,0x10,0x10,0x10,0x00) // Ч 42 cf(t,24, 0x15,0x15,0x15,0x15,0x15,0x15,0x1F,0x00) // Ш 43 cf(t,25, 0x15,0x15,0x15,0x15,0x15,0x1F,0x10,0x00) // Щ 44 cf(t,26, 0x03,0x02,0x02,0x0E,0x12,0x12,0x0E,0x00) // Ъ 45 cf(t,27, 0x11,0x11,0x11,0x13,0x15,0x15,0x13,0x00) // Ы 46 cf(t,28, 0x01,0x01,0x01,0x07,0x09,0x09,0x07,0x00) // Ь 47 cf(t,29, 0x0E,0x11,0x10,0x1C,0x10,0x11,0x0E,0x00) // Э 48 cf(t,30, 0x09,0x15,0x15,0x17,0x15,0x15,0x09,0x00) // Ю 49 cf(t,31, 0x1E,0x11,0x11,0x1E,0x14,0x12,0x11,0x00) // Я 50 return t 51}