Closed piaoger closed 2 years ago
That is probably an issue with egui. If you try running one of their examples with CJK text, does it work?
Yes, I cannot find a way to get egui raw context yesterday :)
I fixed that problem by calling setfonts api as following:
fn configure_visuals(mut egui_ctx: ResMut<EguiContext>) {
egui_ctx.ctx_mut().set_visuals(egui::Visuals {
window_rounding: 0.0.into(),
..Default::default()
});
// support customized fonts
{
let mut fonts = egui::FontDefinitions::default();
// Install my own font (maybe supporting non-latin characters):
// .ttf and .otf supported
// Put my font first (highest priority):
fonts.font_data.insert(
"cjk_font".to_owned(),
egui::FontData::from_static(include_bytes!("../assets/fonts/adobe/SourceHanSansCN-Normal.otf")),
);
fonts
.families
.get_mut(&egui::FontFamily::Proportional)
.unwrap()
.insert(0, "cjk_font".to_owned());
egui_ctx.ctx_mut().set_fonts(fonts);
}
}
Awesome, I added a note to the readme: https://github.com/jakobhellermann/bevy-inspector-egui/#common-issues
CJK characters cannot be handled as shown in below image. Do you have any ideas to resolve it?