Skip to content

Chinese can be entered in the first position of text_editor, but not in other positions #4430

@xuerenlin

Description

@xuerenlin

Describe the bug

Chinese can be entered in the first position of text_editor, but not in other positions

To Reproduce
Steps to reproduce the behavior:

  1. git clone eframe_template

  2. setup custom fonts:
    fn setup_custom_fonts(ctx: &egui::Context) {
    // Start with the default fonts (we will be adding to them rather than replacing them).
    let mut fonts = egui::FontDefinitions::default();

    // Install my own font (maybe supporting non-latin characters).
    // .ttf and .otf files supported.
    fonts.font_data.insert(
    "my_font".to_owned(),
    egui::FontData::from_static(include_bytes!(
    "msyh.ttc"
    )),
    );

    // Put my font first (highest priority) for proportional text:
    fonts
    .families
    .entry(egui::FontFamily::Proportional)
    .or_default()
    .insert(0, "my_font".to_owned());

    // Put my font as last fallback for monospace:
    fonts
    .families
    .entry(egui::FontFamily::Monospace)
    .or_default()
    .push("my_font".to_owned());

    // Tell egui to use these fonts:
    ctx.set_fonts(fonts);
    }

  3. cargo run

Expected behavior

check this scrennshorts,“你好” can be entered in the first position, but can not entered after "test"

Screenshots

image

Desktop (please complete the following information):

  • OS: I check windows 11 and unbuntu,has the same behavior.
  • Browser
  • Version

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is broken

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions