Skip to content

Commit 33a346f

Browse files
committed
Skia: Enable subpixel glyph positioning to fix uneven text spacing
Without subpixel positioning, Skia rounds each glyph position to the nearest integer pixel. Since parley provides fractional glyph positions, this rounding caused visible spacing issues at low resolutions. The old Skia Paragraph::paint() path handled subpixel positioning internally, so this was a regression introduced when switching to parley for text layout. Fixes slint-ui#10752
1 parent fdd4ec2 commit 33a346f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

internal/renderers/skia/itemrenderer.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1017,7 +1017,8 @@ impl GlyphRenderer for SkiaItemRenderer<'_> {
10171017
else {
10181018
return;
10191019
};
1020-
let font = skia_safe::Font::from_typeface(type_face, font_size.get());
1020+
let mut font = skia_safe::Font::from_typeface(type_face, font_size.get());
1021+
font.set_subpixel(true);
10211022

10221023
let (glyph_ids, glyph_positions): (Vec<_>, Vec<_>) = glyphs_it
10231024
.into_iter()

0 commit comments

Comments
 (0)