From 483bb90cf9b8deb945636e85d7a7852feb8a91b2 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sun, 28 Aug 2022 16:57:30 -0700 Subject: [PATCH] shader: only downsample glyph if its bigger than width plus padding --- shaders/cell.v.glsl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/shaders/cell.v.glsl b/shaders/cell.v.glsl index 72730fed3..3417152a2 100644 --- a/shaders/cell.v.glsl +++ b/shaders/cell.v.glsl @@ -129,9 +129,11 @@ void main() { case MODE_FG_COLOR: vec2 glyph_offset_calc = glyph_offset; - // If the glyph is larger than our cell, we need to downsample it + // If the glyph is larger than our cell, we need to downsample it. + // The "+ 3" here is to give some wiggle room for fonts that are + // BARELY over it. vec2 glyph_size_downsampled = glyph_size; - if (glyph_size.x > cell_size.x) { + if (glyph_size.x > (cell_size.x + 3)) { glyph_size_downsampled.x = cell_size_scaled.x; glyph_size_downsampled.y = glyph_size.y * (glyph_size_downsampled.x / glyph_size.x); glyph_offset_calc.y = glyph_offset.y * (glyph_size_downsampled.x / glyph_size.x);