From 5dca7f2d2c071c5479fdffb6c2c54ee9cfbe56b3 Mon Sep 17 00:00:00 2001 From: Phillip Tennen Date: Wed, 7 Feb 2024 19:35:00 +0000 Subject: [PATCH] [libgui - Rust] TextInputView can be initialized with an explicit Font --- rust_programs/libgui/src/text_input_view.rs | 22 +++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/rust_programs/libgui/src/text_input_view.rs b/rust_programs/libgui/src/text_input_view.rs index 54eaeb85..3eed8f3d 100644 --- a/rust_programs/libgui/src/text_input_view.rs +++ b/rust_programs/libgui/src/text_input_view.rs @@ -44,6 +44,28 @@ impl TextInputView { }) } + pub fn new_with_font Rect>( + font: Font, + font_size: Size, + text_insets: RectInsets, + sizer: F, + pixel_byte_layout: PixelByteLayout, + ) -> Rc { + let view = TextView::new_with_font( + Color::white(), + font, + font_size, + text_insets, + sizer, + pixel_byte_layout, + ); + + Rc::new(Self { + view, + is_shift_held: RefCell::new(false), + key_pressed_cb: RefCell::new(None), + }) + } pub fn clear(&self) { self.view.clear()