Skip to content

Custom fonts have vertical offset with unicode symbols #2700

@woelper

Description

@woelper

Egui default font with 0.21:

image

Noto sans with 0.19:
image

Noto sans with 0.21:
image

Although a bit hard to see, all symbols are offset in the y direction. I tried different fonts such as IBM plex, and they show this as well.

Describe the bug
Symbols are not vertically aligned with text if using a custom font.

To Reproduce
Steps to reproduce the behavior:

pub fn new(cc: &eframe::CreationContext<'_>) -> Self {
    let mut fonts = FontDefinitions::default();
    fonts.font_data.insert(
        "my_font".to_owned(),
        FontData::from_static(include_bytes!("../res/fonts/NotoSans-Regular.ttf")),
        // FontData::from_static(include_bytes!("../res/fonts/IBMPlexSans-Regular.ttf")),
    );
    fonts
        .families
        .get_mut(&FontFamily::Proportional)
        .unwrap()
        .insert(0, "my_font".to_owned());
    cc.egui_ctx.set_fonts(fonts);
    Default::default()
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is brokentextProblems related to text

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions