mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-24 04:36:10 +03:00
coretext: tweak underline position
This commit is contained in:
@ -423,12 +423,17 @@ pub const Face = struct {
|
||||
// All of these metrics are based on our layout above.
|
||||
const cell_height = layout_metrics.height;
|
||||
const cell_baseline = layout_metrics.ascent;
|
||||
const underline_position = @ceil(layout_metrics.ascent -
|
||||
@as(f32, @floatCast(ct_font.getUnderlinePosition())));
|
||||
const underline_thickness = @ceil(@as(f32, @floatCast(ct_font.getUnderlineThickness())));
|
||||
const strikethrough_position = cell_baseline * 0.6;
|
||||
const strikethrough_thickness = underline_thickness;
|
||||
|
||||
// Underline position is based on our baseline because the font advertised
|
||||
// underline position is based on a zero baseline. We add a small amount
|
||||
// to the underline position to make it look better.
|
||||
const underline_position = @ceil(cell_baseline -
|
||||
@as(f32, @floatCast(ct_font.getUnderlinePosition())) +
|
||||
1);
|
||||
|
||||
// Note: is this useful?
|
||||
// const units_per_em = ct_font.getUnitsPerEm();
|
||||
// const units_per_point = @intToFloat(f64, units_per_em) / ct_font.getSize();
|
||||
|
Reference in New Issue
Block a user