From 2ade2cd2a6be4a3bd1bbf1958145ecc1e84d8e04 Mon Sep 17 00:00:00 2001 From: "Wolfgang (Blub) Bumiller" Date: Thu, 3 Nov 2011 13:16:55 +0100 Subject: [PATCH] Load kerning again --- ft2.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/ft2.c b/ft2.c index d8529416..b7a13d4f 100644 --- a/ft2.c +++ b/ft2.c @@ -589,6 +589,7 @@ qboolean Font_LoadFont(const char *name, dp_font_t *dpfnt) // Bogus size check needs to be done here already } else ++count; + // FIXME: KERNING: } if (!count) { @@ -633,6 +634,30 @@ qboolean Font_LoadFont(const char *name, dp_font_t *dpfnt) fsize->glyphSize = CeilPowerOf2(fsize->glyphSize); */ fsize->intSize = -1; + if (ft2->has_kerning) + { + Uchar l, r; + FT_Vector kernvec; + for (l = 0; l < 256; ++l) + { + for (r = 0; r < 256; ++r) + { + FT_ULong ul, ur; + ul = qFT_Get_Char_Index((FT_Face)ft2->face, l); + ur = qFT_Get_Char_Index((FT_Face)ft2->face, r); + if (qFT_Get_Kerning((FT_Face)ft2->face, ul, ur, FT_KERNING_DEFAULT, &kernvec)) + { + fsize->kerning.kerning[l][r][0] = 0; + fsize->kerning.kerning[l][r][1] = 0; + } + else + { + fsize->kerning.kerning[l][r][0] = Font_SnapTo((kernvec.x / 64.0) / fsize->size, 1 / fsize->size); + fsize->kerning.kerning[l][r][1] = Font_SnapTo((kernvec.y / 64.0) / fsize->size, 1 / fsize->size); + } + } + } + } } if (!count) { -- 2.39.2