devela 0.27.0

A development layer of coherence.
Documentation
// devela::media::font::art::block_4_3
//
// - https://en.wikipedia.org/wiki/ASCII#Character_set
//
// IDEA: make square and round versions.
// TODO: before 0 (15): ! " # $ % & ' ( ) * + , - . /
// TODO:  after Z  (6): [ \ ] ^ _ `

use crate::FontArt;

#[doc = crate::_tags!(font)]
/// A simple 4x3 Unicode-art font.
#[doc = crate::_doc_location!("media/font")]
///
/// ```text
/// ▄▀▀▄  ▄█  ▄▀▀▄ ▄▀▀▄ █  █ █▀▀▀ ▄▀▀▄ ▀▀▀█ ▄▀▀▄ ▄▀▀▄
/// █▄▀█ ▀ █   ▄▄▀   ▀▄ ▀▄▄█  ▀▀▄ █▄▄    █  ▄▀▀▄ ▀▄▄█
/// ▀▄▄▀ ▄▄█▄ ██▄▄ ▀▄▄▀    █ ▄▄▄▀ ▀▄▄▀  █   ▀▄▄▀  ▄▄▀
///
///            ▄▀        ▀▄  ▄▀▀▄ ▄▀▀▄
///   ▀    ▀  █    ▀▀▀▀    █   ▄▀ █ ██
///   ▀   ▄▀   ▀▄  ▀▀▀▀  ▄▀    ▄  ▀▄▄
///
/// █▀▀█ █▀▀█ █▀▀█ █▀▀▄ █▀▀▀ █▀▀▀ ▄▀▀▄ █  █  ▀█▀    █ █ ▄▀ █    █▄██
/// █▄▄█ █▀▀▄ █    █  █ █▀▀▀ █▀▀▀ █ ▄▄ █▀▀█   █  ▄  █ █▀▄  █    █  █
/// █  █ █▄▄█ █▄▄█ █▄▄▀ █▄▄▄ █    ▀▄▄█ █  █  ▄█▄ ▀▄▄▀ █  █ █▄▄█ █  █
///
/// █▄ █ █▀▀█ █▀▀█ █▀▀█ █▀▀█ █▀▀█ ▀▀█▀ █  █ █  █ █  █ █  █ █  █ █▀▀█
/// █▀▄█ █  █ █▄▄█ █  █ █▄▄▀ ▀▀▄▄   █  █  █  ██  █▄ █  ██  ▀▄▄▀ ▄▄▀▀
/// █ ▀█ █▄▄█ █    ▀▀█▄ █  █ █▄▄█   █  ▀▄▄▀  █▀  █▀██ █  █   █  █▄▄█
/// ```
pub const FONT_ART_4_3: FontArt = FontArt {
    glyphs: FONT_ART_BLOCK_4_3,
    first_glyph: '0',
    last_glyph: 'z',
    // extra_glyphs: &[],
    width: 4,
    height: 3,
    baseline: 2, // ?
    advance_x: 5,
    advance_y: 4,
};

#[rustfmt::skip]
#[doc = crate::_tags!(font)]
/// An ASCII art font size 4x3 made with half blocks.
const FONT_ART_BLOCK_4_3: &[&[&str]] = &[
   &[
    "▄▀▀▄",
    "█▄▀█",
    "▀▄▄▀"], // 0
   &[
    " ▄█ ",
    "▀ █ ",
    "▄▄█▄"], // 1
   &[
    "▄▀▀▄",
    " ▄▄▀",
    "██▄▄"], // 2
   &[
    "▄▀▀▄",
    "  ▀▄",
    "▀▄▄▀"], // 3
   &[
    "█  █",
    "▀▄▄█",
    ""], // 4
   &[
    "█▀▀▀",
    " ▀▀▄",
    "▄▄▄▀"], // 5
   &[
    "▄▀▀▄",
    "█▄▄ ",
    "▀▄▄▀"], // 6
   &[
    "▀▀▀█",
    "",
    ""], // 7
   &[
    "▄▀▀▄",
    "▄▀▀▄",
    "▀▄▄▀"], // 8
   &[
    "▄▀▀▄",
    "▀▄▄█",
    " ▄▄▀"], // 9
   &[
    "    ",
    "",
    ""], // :
   &[
    "    ",
    "",
    " ▄▀ "], // ;
   &[
    " ▄▀ ",
    "",
    " ▀▄ "], // <
   &[
    "    ",
    "▀▀▀▀",
    "▀▀▀▀"], // =
   &[
    " ▀▄ ",
    "",
    " ▄▀ "], // >
   &[
    "▄▀▀▄",
    "  ▄▀",
    ""], // ?
   &[
    "▄▀▀▄",
    "█ ██",
    "▀▄▄ "], // @
   &[
    "█▀▀█",
    "█▄▄█",
    "█  █"], // A
   &[
    "█▀▀█",
    "█▀▀▄",
    "█▄▄█"], // B
   &[
    "█▀▀█",
    "",
    "█▄▄█"], // C
   &[
    "█▀▀▄",
    "█  █",
    "█▄▄▀"], // D
   &[
    "█▀▀▀",
    "█▀▀▀",
    "█▄▄▄"], // E
   &[
    "█▀▀▀",
    "█▀▀▀",
    ""], // F
   &[
    "▄▀▀▄",
    "█ ▄▄",
    "▀▄▄█"], // G
   &[
    "█  █",
    "█▀▀█",
    "█  █"], // H
   &[
    " ▀█▀",
    "",
    " ▄█▄"], // I
   &[
    "",
    "▄  █",
    "▀▄▄▀"], // J
   &[
    "█ ▄▀",
    "█▀▄ ",
    "█  █"], // K
   &[
    "",
    "",
    "█▄▄█"], // L
   &[
    "█▄██",
    "█  █",
    "█  █"], // M
   &[
    "█▄ █",
    "█▀▄█",
    "█ ▀█"], // N
   &[
    "█▀▀█",
    "█  █",
    "█▄▄█"], // O
   &[
    "█▀▀█",
    "█▄▄█",
    ""], // P
   &[
    "█▀▀█",
    "█  █",
    "▀▀█▄"], // Q
   &[
    "█▀▀█",
    "█▄▄▀",
    "█  █"], // R
   &[
    "█▀▀█",
    "▀▀▄▄",
    "█▄▄█"], // S
   &[
    "▀▀█▀",
    "",
    ""], // T
   &[
    "█  █",
    "█  █",
    "▀▄▄▀"], // U
   &[
    "█  █",
    " ██ ",
    " █▀ "], // V
   &[
    "█  █",
    "█▄ █",
    "█▀██"], // W
   &[
    "█  █",
    " ██ ",
    "█  █"], // X
   &[
    "█  █",
    "▀▄▄▀",
    ""], // Y
   &[
    "█▀▀█",
    "▄▄▀▀",
    "█▄▄█"], // Z
];

#[test]
fn test_font() {
    use {crate::CharIter, FONT_ART_BLOCK_4_3 as FONT};

    let len = FONT.len();
    let [mut i, mut j] = [0, 0];

    while i < len {
        #[cfg(feature = "std")]
        crate::cdbg![1# FONT[i]]; // show the symbol we're testing
        while j < 3 {
            let row = FONT[i][j];
            let iter = CharIter::<&str>::new(row);
            assert_eq![iter.count(), 4];
            j += 1;
        }
        j = 0;
        i += 1;
    }
}