From 2718590d8ba9411be44dace8da28037b01cca5c5 Mon Sep 17 00:00:00 2001 From: insofaras Date: Wed, 13 Jul 2016 04:48:15 +0100 Subject: [PATCH] subjective improvements to the freetype code * use FT_LOAD_TARGET_LIGHT when hinting is enabled, which only moves things vertically * don't truncate the glyph advance with >> 6, use / 64.0f instead, and CEIL to align to pixels --- 4ed_rendering.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/4ed_rendering.cpp b/4ed_rendering.cpp index e966bcc0..b06f0ae5 100644 --- a/4ed_rendering.cpp +++ b/4ed_rendering.cpp @@ -588,7 +588,9 @@ font_load_freetype(Partition *part, } else{ if (use_hinting){ - ft_extra_flags = FT_LOAD_FORCE_AUTOHINT; + // NOTE(inso): FT_LOAD_TARGET_LIGHT does hinting only vertically, which looks nicer imo + // maybe it could be exposed as an option for hinting, instead of just on/off. + ft_extra_flags = FT_LOAD_FORCE_AUTOHINT | FT_LOAD_TARGET_LIGHT; } else{ ft_extra_flags = (FT_LOAD_NO_AUTOHINT | FT_LOAD_NO_HINTING); @@ -626,7 +628,7 @@ font_load_freetype(Partition *part, c->xoff2 = w + c->xoff; c->yoff2 = h + c->yoff + 1; - rf->advance_data[i] = (f32)(face->glyph->advance.x >> 6); + rf->advance_data[i] = CEIL32(face->glyph->advance.x / 64.0f); rf->glyphs[i].exists = 1;