From 74d24a53ab5f2d09417250c5cbb703534fb3a36d Mon Sep 17 00:00:00 2001 From: Qwerasd Date: Wed, 25 Sep 2024 11:41:12 -0600 Subject: [PATCH] correct diagram/description (+Y is down not up) --- src/renderer/shaders/cell.metal | 44 ++++++++++++++++----------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/renderer/shaders/cell.metal b/src/renderer/shaders/cell.metal index 734608c76..b6af33824 100644 --- a/src/renderer/shaders/cell.metal +++ b/src/renderer/shaders/cell.metal @@ -224,30 +224,30 @@ vertex CellTextVertexOut cell_text_vertex( out.color = float4(in.color) / 255.0f; // === Grid Cell === - // - // offset.x = bearings.x - // .|. - // | | - // +-------+_. - // ._| | | - // | | .###. | | - // | | #...# | +- bearings.y - // glyph_size.y -+ | ##### | | - // | | #.... | | - // ^ |_| .#### |_| _. - // | | | +- offset.y = cell_size.y - bearings.y - // . cell_pos -> +-------+ -' - // +Y. |_._| - // . | - // | glyph_size.x - // 0,0--...-> // +X + // 0,0--...-> + // | + // . offset.x = bearings.x + // +Y. .|. + // . | | + // | cell_pos -> +-------+ _. + // v ._| |_. _|- offset.y = cell_size.y - bearings.y + // | | .###. | | + // | | #...# | | + // glyph_size.y -+ | ##### | | + // | | #.... | +- bearings.y + // |_| .#### | | + // | |_| + // +-------+ + // |_._| + // | + // glyph_size.x // - // In order to get the bottom left of the glyph, we compute an offset based - // on the bearings. The Y bearing is the distance from the top of the cell - // to the bottom of the glyph, so we subtract it from the cell height to get - // the y offset. The X bearing is the distance from the left of the cell to - // the left of the glyph, so it works as the x offset directly. + // In order to get the top left of the glyph, we compute an offset based on + // the bearings. The Y bearing is the distance from the bottom of the cell + // to the top of the glyph, so we subtract it from the cell height to get + // the y offset. The X bearing is the distance from the left of the cell + // to the left of the glyph, so it works as the x offset directly. float2 size = float2(in.glyph_size); float2 offset = float2(in.bearings);