From c07aa9f0c068200d80f6635c221dd7480e53766a Mon Sep 17 00:00:00 2001 From: Agathe Porte Date: Sun, 23 Feb 2020 10:30:59 +0100 Subject: custom chars support --- src/lib.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/lib.rs') diff --git a/src/lib.rs b/src/lib.rs index b573b1a..6b1d6e1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,5 @@ mod codes; +pub mod custom_char; mod of_node; use std::fs::{File, OpenOptions}; @@ -288,6 +289,17 @@ where write_simple_code!(self, SpecialCode::LargeFont) } + /// Custom character create + pub fn custom_char(&mut self, code: u8, value: [u8; 8]) -> std::io::Result<()> { + let mut res = 0u64; + let mut i = 0; + for b in value.iter().rev() { + res |= (*b as u64) << i; + i += 8; + } + write_simple_code!(self, SpecialCode::Generator(code, res)) + } + pub fn gotoxy(&mut self, x: u32, y: u32) -> std::io::Result<()> { write_simple_code!(self, SpecialCode::GotoXY(Some(x), Some(y))) } -- cgit v1.2.3