Cell width calculation from ceil to round, fix horizontal spacing
parent
bee5875351
commit
45b8ce842e
|
|
@ -223,12 +223,12 @@ pub const FaceMetrics = struct {
|
||||||
///
|
///
|
||||||
/// For any nullable options that are not provided, estimates will be used.
|
/// For any nullable options that are not provided, estimates will be used.
|
||||||
pub fn calc(face: FaceMetrics) Metrics {
|
pub fn calc(face: FaceMetrics) Metrics {
|
||||||
// We use the ceiling of the provided cell width and height to ensure
|
// We use rounding for cell width to match the glyph advances from CoreText,
|
||||||
// that the cell is large enough for the provided size, since we cast
|
// which avoids spacing issues on non-Retina displays.
|
||||||
// it to an integer later.
|
// We keep ceiling for cell height to ensure vertical space is sufficient.
|
||||||
const face_width = face.cell_width;
|
const face_width = face.cell_width;
|
||||||
const face_height = face.lineHeight();
|
const face_height = face.lineHeight();
|
||||||
const cell_width = @ceil(face_width);
|
const cell_width = @round(face_width);
|
||||||
const cell_height = @ceil(face_height);
|
const cell_height = @ceil(face_height);
|
||||||
|
|
||||||
// We split our line gap in two parts, and put half of it on the top
|
// We split our line gap in two parts, and put half of it on the top
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue