slint icon indicating copy to clipboard operation
slint copied to clipboard

Chinese characters cannot be used in italics

Open NLazyCat opened this issue 1 month ago • 4 comments

Bug Description

Image

Reproducible Code (if applicable)

export component GeneratedPage inherits Window {
    Rectangle {
        width: 100%;
        height: 100%;
        
        VerticalLayout {
            Text {
                text: "重点提示:HTML 是网页的基础结构语言,CSS 用于美化页面样式。";
                font-size: 16px;
                color: #3498db;
                font-italic: true;
            }
            Text {
                text: "Key Tip: HTML is the foundational structure language of web pages, while CSS is used to beautify page styles.";
                font-size: 16px;
                color: #3498db;
                font-italic: true;
            }
        }
    }
}

Environment Details

  • Slint Version: 1.14.1
  • Platform/OS: Windows 11
  • Programming Language: Rust
  • Backend/Renderer: femtovg

Product Impact

No response

NLazyCat avatar Nov 29 '25 09:11 NLazyCat

The image above is an HTML screenshot

NLazyCat avatar Nov 29 '25 09:11 NLazyCat

Image This is a screenshot of running after compilation

NLazyCat avatar Nov 29 '25 09:11 NLazyCat

Not solving your problem but just leaving a note here. Italics are generally not used in Asian character sets. For CJK text, the right way to express emphasis (or quote) is to use another style (usually serif font).

For that reason CJK fonts often don't contain italic variants, and browsers by default synthesis italic by applying skew transformations, which is likely not implemented by whatever font rendering pipeline used by slint?

References: https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/font-synthesis https://stackoverflow.com/questions/21009957/italic-font-not-work-for-chinese-japanese-korean-on-ios-7

66Leo66 avatar Dec 08 '25 08:12 66Leo66

I agree with your analysis.

For that reason CJK fonts often don't contain italic variants, and browsers by default synthesis italic by applying skew transformations, which is likely not implemented by whatever font rendering pipeline used by slint?

Yes, exactly. We should however implement synthesis.

tronical avatar Dec 08 '25 08:12 tronical