1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
//! # 8x8 monochrome bitmap fonts for rendering
//!
//! This crate contains a Rust implementation of a public domain 8-bit by 8-bit font.
//!
//! # Usage
//!
//! To use this crate, add to your `Cargo.toml`:
//!
//! ```Cargo
//! [dependencies]
//! font8x8 = "0.1"
//! ```
//!
//! Then, in your code:
//!
//! ```rust,norun
//! extern crate font8x8;
//!
//! use font8x8;
//! ```
//!
//! # Example
//!
//! ## Working directly with constants
//! Let's say we want to print out the first character belonging to the
//! greek subset. In this case, it corresponds to the unicode `U+0390` described as `iota with
//! tonos and diaeresis`, and we will retrieve it from the `GREEK` constant provided by our library.
//!
//! Specifically, we will be working with `GREEK[0]`, which is an array of bytes with capacity for
//! eight separate bytes (`[u8; 8]`).
//!
//! Here's a program that will print the character to your terminal, by parsing each byte of the
//! array, inspecting it bit by bit, and printing an empty space `" "` for `0`, and `"█"` for `1`.
//!
//! ```rust,norun
//! extern crate font8x8;
//!
//! use font8x8::GREEK;
//!
//! fn main() {
//!     for x in &GREEK[0] {
//!         for bit in 0..8 {
//!             match *x & 1 << bit {
//!                 0 => print!(" "),
//!                 _ => print!("█"),
//!             }
//!         }
//!         println!()
//!     }
//! }
//! ```
//!
//! The generated output should mostly resemble this (it will depend on your terminal's font settings):
//! ```text
//!  █ ██ █  
//!          
//!    ██    
//!    ██    
//!    ██    
//!    ██ █  
//!     ██   
//! ```
//!
//! and, it's meant to look like this: `ΐ`.
//!
//! # On the miscellanous characters included
//! These characters are provided as-is, and some don't have a proper unicode point.
//! They are provided in the `MISC` and `SGA` contants. For a description, please
//! read the constant documentation.
//!
//! # Credits
//! Initially extracted from an `asm` file, fetched from a now broken link:
//! `http://dimensionalrift.homelinux.net/combuster/mos3/?p=viewsource&file=/modules/gfx/font8_8.asm`
//!
//! It was then ported to a C header file, also in the Public Domain,
//! [https://github.com/dhepper/font8x8](https://github.com/dhepper/font8x8).
//!
//! This crate is an extension of that work.
mod basic;
mod block;
#[path = "box.rs"]
mod box_chars;
mod control;
mod latin;
mod greek;
mod hiragana;
mod misc;
mod sga;

pub use self::basic::BASIC;
#[cfg(feature = "unicode")]
pub use self::basic::BASIC_UNICODE;

pub use self::control::CONTROL;
#[cfg(feature = "unicode")]
pub use self::control::CONTROL_UNICODE;

pub use self::latin::LATIN;
#[cfg(feature = "unicode")]
pub use self::latin::LATIN_UNICODE;

pub use self::greek::GREEK;
#[cfg(feature = "unicode")]
pub use self::greek::GREEK_UNICODE;

pub use self::block::BLOCK;
#[cfg(feature = "unicode")]
pub use self::block::BLOCK_UNICODE;

pub use self::box_chars::BOX;
#[cfg(feature = "unicode")]
pub use self::box_chars::BOX_UNICODE;

pub use self::hiragana::HIRAGANA;
#[cfg(feature = "unicode")]
pub use self::hiragana::HIRAGANA_UNICODE;

pub use self::misc::MISC;
#[cfg(feature = "unicode")]
pub use self::misc::MISC_UNICODE;

pub use self::sga::SGA;
#[cfg(feature = "unicode")]
pub use self::sga::SGA_UNICODE;

/// Indicates all zeros, meaning nothing to render.
pub const NOTHING_TO_DISPLAY: [u8; 8] = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00];