diff --git a/src/font/face/coretext.zig b/src/font/face/coretext.zig index ee2460572..dacb79476 100644 --- a/src/font/face/coretext.zig +++ b/src/font/face/coretext.zig @@ -612,9 +612,8 @@ pub const Face = struct { // we subtract half of the ex height to go back up to the // correct height that should evenly split lowercase text. const pos = layout_metrics.ascent - - ex_height * 0.5 + - strikethrough_thickness * 0.5 + - 1; + ex_height * 0.5 - + strikethrough_thickness * 0.5; break :strikethrough_position @ceil(pos); }; @@ -625,7 +624,7 @@ pub const Face = struct { // The final underline position is +y from the TOP (confusing) // so we have to subtract from the cell height. const underline_position = @ceil(layout_metrics.ascent - - @as(f32, @floatCast(ct_font.getUnderlinePosition())) + 1); + @as(f32, @floatCast(ct_font.getUnderlinePosition()))); // Note: is this useful? // const units_per_em = ct_font.getUnitsPerEm(); diff --git a/src/font/face/freetype.zig b/src/font/face/freetype.zig index f764ac61d..dae46d6d6 100644 --- a/src/font/face/freetype.zig +++ b/src/font/face/freetype.zig @@ -678,8 +678,8 @@ pub const Face = struct { @intCast(face.handle.*.size.*.metrics.y_scale), ))) / 64; - // We use the declared underline position if its available - const declared = @ceil(cell_height - cell_baseline - declared_px - underline_thickness * 0.5 + 1); + // We use the declared underline position if its available. + const declared = @ceil(cell_height - cell_baseline - declared_px - underline_thickness * 0.5); if (declared > 0) break :underline_pos declared; @@ -702,13 +702,13 @@ pub const Face = struct { ))) / 64; break :st .{ - .pos = @ceil(cell_height - cell_baseline - pos + thickness + 1), + .pos = @ceil(cell_height - cell_baseline - pos), .thickness = thickness, }; } else .{ // Exactly 50% of the ex height so that our strikethrough is // centered through lowercase text. This is a common choice. - .pos = @ceil(cell_height - cell_baseline - ex_height * 0.5 + underline_thickness), + .pos = @ceil(cell_height - cell_baseline - ex_height * 0.5 - underline_thickness * 0.5), .thickness = underline_thickness, };