correct diagram/description (+Y is down not up)

This commit is contained in:
Qwerasd
2024-09-25 11:41:12 -06:00
parent ac68686036
commit 74d24a53ab

View File

@ -224,30 +224,30 @@ vertex CellTextVertexOut cell_text_vertex(
out.color = float4(in.color) / 255.0f; out.color = float4(in.color) / 255.0f;
// === Grid Cell === // === 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 // +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 // In order to get the top left of the glyph, we compute an offset based on
// on the bearings. The Y bearing is the distance from the top of the cell // the bearings. The Y bearing is the distance from the bottom of the cell
// to the bottom of the glyph, so we subtract it from the cell height to get // 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 y offset. The X bearing is the distance from the left of the cell
// the left of the glyph, so it works as the x offset directly. // to the left of the glyph, so it works as the x offset directly.
float2 size = float2(in.glyph_size); float2 size = float2(in.glyph_size);
float2 offset = float2(in.bearings); float2 offset = float2(in.bearings);