diff --git a/docs/changelog.rst b/docs/changelog.rst index a6ffc6bdb..2f1618186 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -14,6 +14,8 @@ Changelog - Draw underlines under the text instead of over it +- Improve rendering of wavy underline at small font sizes (:iss:`853`) + 0.12.0 [2018-09-01] ------------------------------ diff --git a/kitty/fonts/render.py b/kitty/fonts/render.py index e17e4fcfe..67bfc4acd 100644 --- a/kitty/fonts/render.py +++ b/kitty/fonts/render.py @@ -116,7 +116,9 @@ def add_dline(buf, cell_width, position, thickness, cell_height): def add_curl(buf, cell_width, position, thickness, cell_height): xfactor = 2.0 * pi / cell_width - yfactor = thickness + yfactor = max(thickness, 2) + if position + yfactor >= cell_height: + position = cell_height - yfactor - 1 def clamp_y(y): return max(0, min(int(y), cell_height - 1)) @@ -125,8 +127,9 @@ def add_curl(buf, cell_width, position, thickness, cell_height): return max(0, min(int(x), cell_width - 1)) def add_intensity(x, y, distance): - buf[cell_width * y + x] = min( - 255, buf[cell_width * y + x] + int(255 * (1 - distance)) + idx = cell_width * y + x + buf[idx] = min( + 255, buf[idx] + int(255 * (1 - distance)) ) for x_exact in range(cell_width):