Skip to content

Commit cb5284c

Browse files
committed
Round text decorations to pixel Y
1 parent 064ed9a commit cb5284c

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

crates/epaint/src/text/parley_layout.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ fn render_decoration(
2020
offset: (f32, f32),
2121
stroke: Stroke,
2222
) {
23-
let y = run.baseline() + offset.1;
23+
let mut y = run.baseline() + offset.1;
24+
stroke.round_center_to_pixel(pixels_per_point, &mut y);
2425
let x_start = run.offset() + offset.0;
2526
let x_end = x_start + run.advance();
2627

@@ -252,8 +253,6 @@ pub(super) fn layout(fonts: &mut FontsLayoutView<'_>, job: LayoutJob) -> Galley
252253
mesh.add_rect_with_uv(rect, uv, color);
253254
}
254255

255-
// TODO(valadaptive): feathering makes this really blurry sometimes, and the underline is sometimes
256-
// not a full pixel under the text. Maybe just use the rounded glyph position?
257256
if let Some(underline) = &run.style().underline {
258257
let offset = underline.offset.unwrap_or(run_metrics.underline_offset);
259258
let size = underline.size.unwrap_or(run_metrics.underline_size);

0 commit comments

Comments
 (0)