diff --git a/mainline.py b/mainline.py index 9eca86d..8bd8fc0 100755 --- a/mainline.py +++ b/mainline.py @@ -147,7 +147,8 @@ KATA = "ハミヒーウシナモニサワツオリアホテマケメエカキム _FONT_PATH = "/Users/genejohnson/Documents/CS Bishop Drawn/CSBishopDrawn-Italic.otf" _FONT_OBJ = None _FONT_SZ = 60 -_RENDER_H = 16 # terminal rows per rendered text line +_RENDER_H = 8 # terminal rows per rendered text line +_SSAA = 4 # super-sampling factor: render at _SSAA× then downsample # Non-Latin scripts → macOS system fonts _SCRIPT_FONTS = { @@ -579,8 +580,11 @@ def _render_line(text, font=None): draw = ImageDraw.Draw(img) draw.text((-bbox[0] + pad, -bbox[1] + pad), text, fill=255, font=font) pix_h = _RENDER_H * 2 - scale = pix_h / max(img_h, 1) - new_w = max(1, int(img_w * scale)) + hi_h = pix_h * _SSAA + scale = hi_h / max(img_h, 1) + new_w_hi = max(1, int(img_w * scale)) + img = img.resize((new_w_hi, hi_h), Image.Resampling.LANCZOS) + new_w = max(1, int(new_w_hi / _SSAA)) img = img.resize((new_w, pix_h), Image.Resampling.LANCZOS) data = img.tobytes() thr = 80