diff --git a/src/terminal/console.rs b/src/terminal/console.rs index 76420ed175540b7adef77495466661679515bd54..a1cb89b963856e93701151a48e9093b5795b6076 100644 --- a/src/terminal/console.rs +++ b/src/terminal/console.rs @@ -5,6 +5,7 @@ use std::collections::{BTreeSet, VecDeque}; use std::io::Result; use orbclient::{Color, Event, EventOption, Renderer, Window}; +use orbfont::Font; #[cfg(target_arch = "x86_64")] #[inline(always)] @@ -33,6 +34,8 @@ pub unsafe fn fast_set64(dst: *mut u64, src: u64, len: usize) { pub struct Console { pub console: ransid::Console, pub window: Window, + pub font: Font, + pub font_bold: Font, pub changed: BTreeSet<usize>, pub ctrl: bool, pub input: Vec<u8>, @@ -48,6 +51,8 @@ impl Console { Console { console: ransid::Console::new(width as usize / 8, height as usize / 16), window: window, + font: Font::find(None, None, None).unwrap(), + font_bold: Font::find(None, None, Some("Bold")).unwrap(), changed: BTreeSet::new(), ctrl: false, input: Vec::new(), @@ -197,12 +202,18 @@ impl Console { } { + let font = &self.font; + let font_bold = &self.font_bold; let window = &mut self.window; let changed = &mut self.changed; self.console.write(buf, |event| { match event { - ransid::Event::Char { x, y, c, color, .. } => { - window.char(x as i32 * 8, y as i32 * 16, c, Color { data: color.data });/*, bold, false);*/ + ransid::Event::Char { x, y, c, color, bold, .. } => { + if bold { + font_bold.render(&c.to_string(), 16.0).draw(window, x as i32 * 8, y as i32 * 16, Color { data: color.data }); + } else { + font.render(&c.to_string(), 16.0).draw(window, x as i32 * 8, y as i32 * 16, Color { data: color.data }); + } changed.insert(y); }, ransid::Event::Rect { x, y, w, h, color } => { diff --git a/src/terminal/main.rs b/src/terminal/main.rs index f4d81d4ba8699a400e234589c8df001b34915f5a..8e5f2d354cb8076c3e92d4f25fce22f15045efab 100644 --- a/src/terminal/main.rs +++ b/src/terminal/main.rs @@ -4,6 +4,7 @@ #![cfg_attr(not(target_os = "redox"), feature(process_try_wait))] extern crate orbclient; +extern crate orbfont; #[cfg(not(target_os = "redox"))] extern crate libc; @@ -203,7 +204,7 @@ fn main() { let slave_stderr = OpenOptions::new().read(false).write(true).open(&tty_path).unwrap(); let width = 800; - let height = 600; + let height = 576; env::set_var("COLUMNS", format!("{}", width / 8)); env::set_var("LINES", format!("{}", height / 16));