diff --git a/libs/ux-api/src/widgets/modal.rs b/libs/ux-api/src/widgets/modal.rs index d363ea852..ae7878198 100644 --- a/libs/ux-api/src/widgets/modal.rs +++ b/libs/ux-api/src/widgets/modal.rs @@ -293,10 +293,7 @@ fn layout(modal: &mut Modal, top_text: Option<&str>, bot_text: Option<&str>, sty top_tv.invert = true; // specify a clip rect that's the biggest possible allowed. If we don't do this, the current // canvas bounds are used, and the operation will fail if the text has to get bigger. - top_tv.clip_rect = Some(Rectangle::new( - Point::new(0, 0), - Point::new(current_bounds.x, LINES - 2 * modal.line_height), - )); + top_tv.clip_rect = Some(Rectangle::new(Point::new(0, 0), current_bounds)); write!(top_tv.text, "{}", top_str).unwrap(); log::trace!("posting top tv: {:?}", top_tv); @@ -340,10 +337,7 @@ fn layout(modal: &mut Modal, top_text: Option<&str>, bot_text: Option<&str>, sty bot_tv.invert = true; // specify a clip rect that's the biggest possible allowed. If we don't do this, the current canvas // bounds are used, and the operation will fail if the text has to get bigger. - bot_tv.clip_rect = Some(Rectangle::new( - Point::new(0, 0), - Point::new(current_bounds.x, LINES - 2 * modal.line_height), - )); + bot_tv.clip_rect = Some(Rectangle::new(Point::new(0, 0), current_bounds)); write!(bot_tv.text, "{}", bot_str).unwrap(); log::trace!("posting bot tv: {:?}", bot_tv); diff --git a/libs/ux-api/src/wordwrap.rs b/libs/ux-api/src/wordwrap.rs index a73947889..02ec84597 100644 --- a/libs/ux-api/src/wordwrap.rs +++ b/libs/ux-api/src/wordwrap.rs @@ -244,15 +244,15 @@ pub struct Typesetter { impl Typesetter { pub fn setup(s: &str, extent: &Point, base_style: &GlyphStyle, insertion_point: Option) -> Self { let bb = ClipRect::new(0, 0, extent.x, extent.y); - let mut space = style_glyph(' ', base_style); + let mut space = style_glyph(locales::LANG, ' ', base_style); space.kern = 0; - let mut ellipsis = style_glyph('…', base_style); + let mut ellipsis = style_glyph(locales::LANG, '…', base_style); ellipsis.kern = 0; #[cfg(not(feature = "bao1x"))] - let mut large_space = style_glyph(' ', &GlyphStyle::Cjk); + let mut large_space = style_glyph(locales::LANG, ' ', &GlyphStyle::Cjk); #[cfg(feature = "bao1x")] - let mut large_space = style_glyph(' ', &GlyphStyle::Tall); + let mut large_space = style_glyph(locales::LANG, ' ', &GlyphStyle::Tall); if cfg!(feature = "bao1x") { large_space.wide = glyph_to_height_hint(GlyphStyle::Tall) as u8; @@ -396,8 +396,11 @@ impl Typesetter { // line for it. // 5. The evolving word fits a line but doesn't fit this line, and there is no more space at // all. - let mut gs = - if ch != '\t' { style_glyph(ch, &self.base_style) } else { self.large_space.clone() }; + let mut gs = if ch != '\t' { + style_glyph(locales::LANG, ch, &self.base_style) + } else { + self.large_space.clone() + }; if self.is_insert_point() { gs.insert = true; } @@ -637,25 +640,3 @@ fn tsw_debug(tsw: &TypesetWord) { } log::info!("{} @ {},{}+{}={}", &s, tsw.origin.x, tsw.origin.y, tsw.height, tsw.origin.y + tsw.height); } - -/// Find glyph for char using latin regular, emoji, ja, zh, and kr font data -pub fn style_glyph(ch: char, base_style: &GlyphStyle) -> GlyphSprite { - match locales::LANG { - "zh" => { - style_wrapper!(zh_rules, base_style, ch) - } - "jp" => { - style_wrapper!(jp_rules, base_style, ch) - } - "kr" => { - style_wrapper!(kr_rules, base_style, ch) - } - "en-tts" => { - style_wrapper!(en_audio_rules, base_style, ch) - } - // default to English rules - _ => { - style_wrapper!(english_rules, base_style, ch) - } - } -}