Closed rulongche closed 2 months ago
Thanks for filling an issue. Looks like a font problem. What platform and renderer are you using?
Thanks for filling an issue. Looks like a font problem. What platform and renderer are you using?
I had the same problem, windows and winit renderer.
I think I can reproduce this. Here's a simpler test case:
import { Slider } from "std-widgets.slint";
export component Demo {
width: 200px;
height: 200px;
Text {
x: 50px;
y: 50px;
text: "Hello";
height: sl.value * 1px;
}
sl := Slider {
width: 100%;
y: parent.height - self.height;
value: 10;
minimum: 8;
maximum: 64;
}
}
Observe how the text of the button appears and disappears depending on the height. When a Text
element does not have sufficient height to display the text, it will not render anything.
In your case, as it happens, the height is insufficient for the font selected to display the Chinese text - I suspect the ascent/descent is just above the 24px you specify.
I recommend placing widgets into layouts and letting them resize based on their minimum size, instead of hard-coding a specific height. That way the application also works well when users have bigger font sizes configured on their system, for example, for improved readability.
Duplicate of #2029
After setting the height of the button component, the preview display is normal, but the Chinese language cannot be displayed after publication
Button { text: "复制"; height: 24px; }