renderer: for constrained cells, offset was being doubled

This helps better preserve the centerline for constrained glyphs
This commit is contained in:
Mitchell Hashimoto
2024-01-07 15:02:56 -08:00
parent f7c558e733
commit 62e5234da4
2 changed files with 2 additions and 2 deletions

View File

@ -165,7 +165,7 @@ vertex VertexOut uber_vertex(
if (input.mode == MODE_FG_CONSTRAINED) { if (input.mode == MODE_FG_CONSTRAINED) {
if (glyph_size.x > cell_size_scaled.x) { if (glyph_size.x > cell_size_scaled.x) {
float new_y = glyph_size.y * (cell_size_scaled.x / glyph_size.x); float new_y = glyph_size.y * (cell_size_scaled.x / glyph_size.x);
glyph_offset.y += glyph_size.y - new_y; glyph_offset.y += (glyph_size.y - new_y) / 2;
glyph_size.y = new_y; glyph_size.y = new_y;
glyph_size.x = cell_size_scaled.x; glyph_size.x = cell_size_scaled.x;
} }

View File

@ -194,7 +194,7 @@ void main() {
if (mode == MODE_FG_CONSTRAINED) { if (mode == MODE_FG_CONSTRAINED) {
if (glyph_size.x > cell_size_scaled.x) { if (glyph_size.x > cell_size_scaled.x) {
float new_y = glyph_size.y * (cell_size_scaled.x / glyph_size.x); float new_y = glyph_size.y * (cell_size_scaled.x / glyph_size.x);
glyph_offset_calc.y = glyph_offset_calc.y + (glyph_size.y - new_y); glyph_offset_calc.y = glyph_offset_calc.y + ((glyph_size.y - new_y) / 2);
glyph_size_calc.y = new_y; glyph_size_calc.y = new_y;
glyph_size_calc.x = cell_size_scaled.x; glyph_size_calc.x = cell_size_scaled.x;
} }