diff --git a/apps/vault/src/ux/framework.rs b/apps/vault/src/ux/framework.rs index 65fc73006..ae1c4eadb 100644 --- a/apps/vault/src/ux/framework.rs +++ b/apps/vault/src/ux/framework.rs @@ -70,13 +70,14 @@ pub struct VaultUx { } pub const DEFAULT_FONT: GlyphStyle = GlyphStyle::Regular; -pub const FONT_LIST: [&'static str; 6] = [ - "regular", "mono", "cjk", +pub const FONT_LIST: [&'static str; 7] = [ + "regular", "tall", "mono", "cjk", "bold", "large", "small" ]; pub fn name_to_style(name: &str) -> Option { match name { "regular" => Some(GlyphStyle::Regular), + "tall" => Some(GlyphStyle::Tall), "mono" => Some(GlyphStyle::Monospace), "cjk" => Some(GlyphStyle::Cjk), "bold" => Some(GlyphStyle::Bold), @@ -93,6 +94,7 @@ fn style_to_name(style: &GlyphStyle) -> String { GlyphStyle::Bold => "bold".to_string(), GlyphStyle::Large => "large".to_string(), GlyphStyle::Small => "small".to_string(), + GlyphStyle::Tall => "tall".to_string(), _ => "regular".to_string(), } } diff --git a/services/gam/src/layouts/modal.rs b/services/gam/src/layouts/modal.rs index 1c432743c..2a0b776b2 100644 --- a/services/gam/src/layouts/modal.rs +++ b/services/gam/src/layouts/modal.rs @@ -1,7 +1,7 @@ use std::collections::HashMap; use crate::api::CanvasType; -use crate::{Canvas, GlyphStyle}; +use crate::Canvas; use graphics_server::*; @@ -24,7 +24,7 @@ impl ModalLayout { pub fn init(gfx: &graphics_server::Gfx, trng: &trng::Trng, canvases: &mut HashMap) -> Result { let screensize = gfx.screen_size().expect("Couldn't get screen size"); // get the height of various text regions to compute the layout - let height: i16 = gfx.glyph_height_hint(GlyphStyle::Regular).expect("couldn't get glyph height") as i16; + let height: i16 = gfx.glyph_height_hint(gam::SYSTEM_STYLE).expect("couldn't get glyph height") as i16; const MODAL_Y_PAD: i16 = 80; const MODAL_X_PAD: i16 = 20; diff --git a/services/gam/src/lib.rs b/services/gam/src/lib.rs index cee1a732e..9c83c1bec 100644 --- a/services/gam/src/lib.rs +++ b/services/gam/src/lib.rs @@ -31,6 +31,8 @@ use ime_plugin_api::{ImefCallback, ApiToken}; #[doc = include_str!("../README.md")] +pub const SYSTEM_STYLE: GlyphStyle = GlyphStyle::Tall; + // Add names here and insert them into the EXPECTED_BOOT_CONTEXTS structure below. pub const MAIN_MENU_NAME: &'static str = "main menu"; pub const PDDB_MODAL_NAME: &'static str = "pddb modal"; diff --git a/services/gam/src/menu.rs b/services/gam/src/menu.rs index c1586da25..93d7208d0 100644 --- a/services/gam/src/menu.rs +++ b/services/gam/src/menu.rs @@ -9,7 +9,7 @@ pub use graphics_server::*; use xous_ipc::{String, Buffer}; use num_traits::*; -use graphics_server::api::{PixelColor, TextBounds, DrawStyle, GlyphStyle}; +use graphics_server::api::{PixelColor, TextBounds, DrawStyle}; #[cfg(feature = "tts")] use tts_frontend::*; @@ -60,7 +60,7 @@ impl<'a> Menu<'a> { assert!(authtoken.is_some(), "Couldn't register menu. Did you remember to add the app_name to the tokens.rs expected boot contexts list?"); log::debug!("requesting content canvas for menu"); let canvas = gam.request_content_canvas(authtoken.unwrap()).expect("couldn't get my content canvas from GAM"); - let line_height = gam.glyph_height_hint(GlyphStyle::Cjk).expect("couldn't get glyph height hint") as i16 + 2; + let line_height = gam.glyph_height_hint(crate::SYSTEM_STYLE).expect("couldn't get glyph height hint") as i16 + 2; #[cfg(feature="tts")] let tts = TtsFrontend::new(&xns).unwrap(); Menu { @@ -210,7 +210,7 @@ impl<'a> Menu<'a> { } write!(item_tv.text, "{}", item.name.as_str().unwrap()).unwrap(); item_tv.draw_border = false; - item_tv.style = GlyphStyle::Regular; + item_tv.style = crate::SYSTEM_STYLE; item_tv.margin = Point::new(0, 0); item_tv.ellipsis = true; diff --git a/services/graphics-server/Cargo.toml b/services/graphics-server/Cargo.toml index 7c30f16f6..cfb486df5 100644 --- a/services/graphics-server/Cargo.toml +++ b/services/graphics-server/Cargo.toml @@ -34,4 +34,4 @@ debugprint = [] braille = [] gfx-testing = [] ditherpunk = [] -default = [] +default = ["gfx-testing"] diff --git a/services/ime-frontend/src/main.rs b/services/ime-frontend/src/main.rs index ec247fc33..297bfdac9 100644 --- a/services/ime-frontend/src/main.rs +++ b/services/ime-frontend/src/main.rs @@ -10,7 +10,6 @@ use ime_plugin_api::{ImefCallback, ImefDescriptor, ImefOpcode}; use log::{error, info}; use graphics_server::{Gid, Line, PixelColor, Point, Rectangle, TextBounds, TextView, DrawStyle}; -use gam::GlyphStyle; use ime_plugin_api::{PredictionTriggers, PredictionPlugin, PredictionApi, ApiToken}; use num_traits::{ToPrimitive,FromPrimitive}; @@ -262,6 +261,7 @@ impl InputTracker { input_tv.draw_border = false; input_tv.border_width = 1; input_tv.clear_area = true; // need this so that the insertion point is cleared and moved + input_tv.style = gam::SYSTEM_STYLE; let mut do_redraw = false; for &k in newkeys.iter() { @@ -657,7 +657,7 @@ impl InputTracker { p_tv.border_width = 1; p_tv.clear_area = false; p_tv.ellipsis = true; - p_tv.style = GlyphStyle::Regular; + p_tv.style = gam::SYSTEM_STYLE; write!(p_tv.text, "{}", pred_str).expect("can't write the prediction string"); log::trace!("posting string with length {}", p_tv.text.as_str().unwrap().len()); self.gam.post_textview(&mut p_tv).expect("couldn't post prediction text"); diff --git a/services/shellchat/src/main.rs b/services/shellchat/src/main.rs index d54548ab7..9560e00c9 100644 --- a/services/shellchat/src/main.rs +++ b/services/shellchat/src/main.rs @@ -36,7 +36,6 @@ use core::sync::atomic::{AtomicBool, Ordering}; use gam::UxRegistration; use graphics_server::{Gid, Point, Rectangle, TextBounds, TextView, DrawStyle, PixelColor}; -use graphics_server::api::GlyphStyle; use xous::MessageEnvelope; use xous_ipc::Buffer; @@ -339,7 +338,7 @@ impl Repl{ bubble_tv.draw_border = true; bubble_tv.clear_area = true; bubble_tv.rounded_border = Some(self.bubble_radius); - bubble_tv.style = GlyphStyle::Regular; + bubble_tv.style = gam::SYSTEM_STYLE; bubble_tv.margin = self.bubble_margin; bubble_tv.ellipsis = false; bubble_tv.insertion = None; write!(bubble_tv.text, "{}", h.text.as_str()).expect("couldn't write history text to TextView");