u8g2_fonts/font.rs
1/// An abstract [U8g2](https://github.com/olikraus/u8g2/wiki/fntlistall) font interface.
2///
3/// Contains all information to create a [`FontRenderer`](crate::FontRenderer).
4///
5/// Implemented by [all available fonts](crate::fonts).
6pub trait Font {
7 #[doc(hidden)]
8 const DATA: &'static [u8];
9}
10
11macro_rules! font_definitions {
12 ( $($fontname:ident),* $(,)? ) => {
13 $(
14 #[doc = concat!(r#"<img src="https://raw.githubusercontent.com/wiki/olikraus/u8g2/fntpic/"#, stringify!($fontname), r#".png">"#)]
15 pub struct $fontname;
16 impl $crate::Font for $fontname {
17 const DATA: &'static [u8] = include_bytes!(concat!(stringify!($fontname), ".u8g2font"));
18 }
19 )*
20 };
21}
22
23pub(crate) use font_definitions;