Skip to content

Commit

Permalink
[libgui - Rust] TextInputView can be initialized with an explicit Font
Browse files Browse the repository at this point in the history
  • Loading branch information
codyd51 committed Feb 7, 2024
1 parent 630682a commit 5dca7f2
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions rust_programs/libgui/src/text_input_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,28 @@ impl TextInputView {
})
}

pub fn new_with_font<F: 'static + Fn(&View, Size) -> Rect>(
font: Font,
font_size: Size,
text_insets: RectInsets,
sizer: F,
pixel_byte_layout: PixelByteLayout,
) -> Rc<Self> {
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()
Expand Down

0 comments on commit 5dca7f2

Please sign in to comment.