This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

🔨 : add big-text generation script

Julien WITTOUCK (Jun 14, 2026, 7:44 PM +0200) 7bd41df3 53667bd6

+115
+16
big-text/Cargo.lock
··· 1 + # This file is automatically @generated by Cargo. 2 + # It is not intended for manual editing. 3 + version = 4 4 + 5 + [[package]] 6 + name = "big-text" 7 + version = "0.1.0" 8 + dependencies = [ 9 + "font8x8", 10 + ] 11 + 12 + [[package]] 13 + name = "font8x8" 14 + version = "0.3.1" 15 + source = "registry+https://github.com/rust-lang/crates.io-index" 16 + checksum = "875488b8711a968268c7cf5d139578713097ca4635a76044e8fe8eedf831d07e"
+7
big-text/Cargo.toml
··· 1 + [package] 2 + name = "big-text" 3 + version = "0.1.0" 4 + edition = "2021" 5 + 6 + [dependencies] 7 + font8x8 = "0.3"
+92
big-text/src/main.rs
··· 1 + use font8x8::UnicodeFonts; 2 + use std::env; 3 + 4 + const SEXANT_SYMBOLS: [char; 64] = [ 5 + ' ', '🬀', '🬁', '🬂', '🬃', '🬄', '🬅', '🬆', '🬇', '🬈', '🬉', '🬊', '🬋', '🬌', '🬍', '🬎', 6 + '🬏', '🬐', '🬑', '🬒', '🬓', '▌', '🬔', '🬕', '🬖', '🬗', '🬘', '🬙', '🬚', '🬛', '🬜', '🬝', 7 + '🬞', '🬟', '🬠', '🬡', '🬢', '🬣', '🬤', '🬥', '🬦', '🬧', '▐', '🬨', '🬩', '🬪', '🬫', '🬬', 8 + '🬭', '🬮', '🬯', '🬰', '🬱', '🬲', '🬳', '🬴', '🬵', '🬶', '🬷', '🬸', '🬹', '🬺', '🬻', '█', 9 + ]; 10 + 11 + const QUADRANT_SYMBOLS: [char; 16] = [ 12 + ' ', '▘', '▝', '▀', '▖', '▌', '▞', '▛', '▗', '▚', '▐', '▜', '▄', '▙', '▟', '█', 13 + ]; 14 + 15 + fn get_sextant(tl: u8, tr: u8, ml: u8, mr: u8, bl: u8, br: u8) -> char { 16 + let idx = (if tl > 0 { 1 } else { 0 }) 17 + + (if tr > 0 { 2 } else { 0 }) 18 + + (if ml > 0 { 4 } else { 0 }) 19 + + (if mr > 0 { 8 } else { 0 }) 20 + + (if bl > 0 { 16 } else { 0 }) 21 + + (if br > 0 { 32 } else { 0 }); 22 + SEXANT_SYMBOLS[idx] 23 + } 24 + 25 + fn get_quadrant(tl: u8, tr: u8, bl: u8, br: u8) -> char { 26 + let idx = (if tl > 0 { 1 } else { 0 }) 27 + + (if tr > 0 { 2 } else { 0 }) 28 + + (if bl > 0 { 4 } else { 0 }) 29 + + (if br > 0 { 8 } else { 0 }); 30 + QUADRANT_SYMBOLS[idx] 31 + } 32 + 33 + fn render_text(text: &str, use_quadrant: bool) -> String { 34 + let glyphs: Vec<[u8; 8]> = text 35 + .chars() 36 + .map(|c| { 37 + font8x8::BASIC_FONTS 38 + .get(c) 39 + .or_else(|| font8x8::LATIN_FONTS.get(c)) 40 + .unwrap_or([0u8; 8]) 41 + }) 42 + .collect(); 43 + 44 + let mut out = String::new(); 45 + 46 + if use_quadrant { 47 + for y in (0..8).step_by(2) { 48 + for glyph in &glyphs { 49 + for x in (0..8).step_by(2) { 50 + let tl = glyph[y] & (1 << x); 51 + let tr = glyph[y] & (1 << (x + 1)); 52 + let bl = if y + 1 < 8 { glyph[y + 1] & (1 << x) } else { 0 }; 53 + let br = if y + 1 < 8 { glyph[y + 1] & (1 << (x + 1)) } else { 0 }; 54 + out.push(get_quadrant(tl, tr, bl, br)); 55 + } 56 + } 57 + out.push('\n'); 58 + } 59 + } else { 60 + for y in (0..8).step_by(3) { 61 + for glyph in &glyphs { 62 + for x in (0..8).step_by(2) { 63 + let tl = glyph[y] & (1 << x); 64 + let tr = glyph[y] & (1 << (x + 1)); 65 + let ml = if y + 1 < 8 { glyph[y + 1] & (1 << x) } else { 0 }; 66 + let mr = if y + 1 < 8 { glyph[y + 1] & (1 << (x + 1)) } else { 0 }; 67 + let bl = if y + 2 < 8 { glyph[y + 2] & (1 << x) } else { 0 }; 68 + let br = if y + 2 < 8 { glyph[y + 2] & (1 << (x + 1)) } else { 0 }; 69 + out.push(get_sextant(tl, tr, ml, mr, bl, br)); 70 + } 71 + } 72 + out.push('\n'); 73 + } 74 + } 75 + out 76 + } 77 + 78 + fn main() { 79 + let args: Vec<String> = env::args().collect(); 80 + if args.len() < 2 { 81 + eprintln!("Usage: {} [-q] <text>", args[0]); 82 + std::process::exit(1); 83 + } 84 + let mut text_start = 1; 85 + let mut use_quadrant = false; 86 + if args[1] == "-q" { 87 + use_quadrant = true; 88 + text_start = 2; 89 + } 90 + let text = &args[text_start..].join(" "); 91 + print!("{}", render_text(text, use_quadrant)); 92 + }