Last active
July 15, 2023 11:04
-
-
Save jturcotte/4d7e4011135fdddd22df123d884443c6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[package] | |
name = "skia-text-align" | |
version = "0.1.0" | |
edition = "2021" | |
[[bin]] | |
name = "skia-text-align" | |
path = "main.rs" | |
[dependencies.slint] | |
version = "1.1.1" | |
default-features = false | |
# Switch to renderer-winit-femtovg to see the expected results | |
features = ["compat-1-0", "backend-winit", "renderer-winit-skia"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn main() { | |
MainWindow::new().unwrap().run().unwrap(); | |
} | |
slint::slint! { | |
export component MainWindow inherits Window { | |
background: lightgreen; | |
VerticalLayout { | |
width: 50%; | |
// Reference | |
Text { | |
font-family: "monospace"; | |
font-size: 28px; | |
text: "[---]"; | |
horizontal-alignment: center; | |
vertical-alignment: center; | |
} | |
// This works, OK | |
Text { | |
font-family: "monospace"; | |
font-size: 28px; | |
text: "---"; | |
horizontal-alignment: center; | |
vertical-alignment: center; | |
} | |
// This aligns, but it shouldn't | |
Text { | |
font-family: "monospace"; | |
font-size: 28px; | |
text: "--- "; | |
horizontal-alignment: center; | |
vertical-alignment: center; | |
} | |
// This shouldn't align either, but the text oddly aligns with the last element | |
Text { | |
font-family: "monospace"; | |
font-size: 28px; | |
text: " ---"; | |
horizontal-alignment: center; | |
vertical-alignment: center; | |
} | |
// This is the issue, this should be aligned with the reference at the top | |
Text { | |
font-family: "monospace"; | |
font-size: 28px; | |
text: " --- "; | |
horizontal-alignment: center; | |
vertical-alignment: center; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment