diff --git a/crates/bootstrap/src/lib.rs b/crates/bootstrap/src/lib.rs index ba853d83..8a4a2457 100644 --- a/crates/bootstrap/src/lib.rs +++ b/crates/bootstrap/src/lib.rs @@ -79,6 +79,8 @@ async fn run(body: impl ExampleBody) { .build(&event_loop) .unwrap(); + window.set_ime_allowed(true); + // yakui_app has a helper for setting up winit and wgpu. let mut app = yakui_app::Graphics::new(&window).await; @@ -124,6 +126,7 @@ async fn run(body: impl ExampleBody) { FontSettings::default(), ) .unwrap(); + fonts.add(font, Some("monospace")); // Set up some default state that we'll modify later. diff --git a/crates/yakui-winit/src/lib.rs b/crates/yakui-winit/src/lib.rs index 19b70890..8430b2ce 100644 --- a/crates/yakui-winit/src/lib.rs +++ b/crates/yakui-winit/src/lib.rs @@ -178,6 +178,16 @@ impl YakuiWinit { false } } + + WinitEvent::WindowEvent { + event: WindowEvent::Ime(winit::event::Ime::Commit(text)), + .. + } => { + for c in text.chars() { + state.handle_event(Event::TextInput(c)); + } + true + } _ => false, } }