From 366f4036453ee879d50820110275bf7ed69d6f8c Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Wed, 22 Jul 2020 21:40:36 +0300 Subject: Text: Half-pixel glyph variants The cache contains two variants of each glyph: zero and half-pixel offsets. This allows positioning glyph more accurately inside a text run. --- src/ui/documentwidget.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'src/ui/documentwidget.c') diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index 55ac6b80..eae7c00a 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c @@ -172,9 +172,21 @@ static iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e if (ev->type == SDL_KEYDOWN) { const int mods = keyMods_Sym(ev->key.keysym.mod); const int key = ev->key.keysym.sym; - if (mods == KMOD_PRIMARY && key == 'r') { - fetch_DocumentWidget_(d); - return iTrue; + switch (key) { + case 'r': + if (mods == KMOD_PRIMARY) { + fetch_DocumentWidget_(d); + return iTrue; + } + break; + case '0': { + extern int enableHalfPixelGlyphs_Text; + enableHalfPixelGlyphs_Text = !enableHalfPixelGlyphs_Text; + postRefresh_App(); + printf("halfpixel: %d\n", enableHalfPixelGlyphs_Text); + fflush(stdout); + break; + } } } else if (ev->type == SDL_MOUSEWHEEL) { -- cgit v1.2.3