slint-ui / slint

Slint is a declarative GUI toolkit to build native user interfaces for Rust, C++, or JavaScript apps.
https://slint.dev
Other
16.94k stars 568 forks source link

Incorrect font italicizing #5056

Closed LaoLittle closed 5 months ago

LaoLittle commented 5 months ago

Hi.

I'm currently trying to display texts in different style at the same time.

The code is below:

slint::slint! {
    export component Main inherits Window {
        height: 500px;
        width: 500px;

        HorizontalLayout {
            Text {
                text: "ABCD";
                font-italic: true;
                font-size: 20px;
            }
            Text {
                text: "EFGH";
                font-italic: false;
                font-size: 20px;
            }
        }
    }
}

fn main() {
    Main::new().unwrap().run().unwrap();
}

What I expected is that the text on the left is italic while that on the right is non-italic. However, the result is:

Screenshot 2024-04-14 at 22 23 33
tronical commented 5 months ago

Thank you for the bug report. I think that this is indeed a bug in the femtovg renderer, not taking the style into account in the cached mapping to femtovg fonts.