From 6d54fa69a64a02da9527fd5e26791b0da8126372 Mon Sep 17 00:00:00 2001 From: divverent Date: Mon, 28 Dec 2009 14:02:15 +0000 Subject: [PATCH] fix font glyph loading coordinates - now unhinted works git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9722 d7cf8633-e32d-0410-b094-e92efae38249 --- ft2.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/ft2.c b/ft2.c index ac3b9730..edbe708a 100644 --- a/ft2.c +++ b/ft2.c @@ -1076,20 +1076,24 @@ static qboolean Font_LoadMap(ft2_font_t *font, ft2_font_map_t *mapstart, Uchar _ // double advance = (double)glyph->metrics.horiAdvance * map->sfx; double bearingX = (glyph->metrics.horiBearingX >> 6) / map->size; - double bearingY = (glyph->metrics.horiBearingY >> 6) / map->size; + //double bearingY = (glyph->metrics.horiBearingY >> 6) / map->size; double advance = (glyph->advance.x >> 6) / map->size; - double mWidth = (glyph->metrics.width >> 6) / map->size; - double mHeight = (glyph->metrics.height >> 6) / map->size; + //double mWidth = (glyph->metrics.width >> 6) / map->size; + //double mHeight = (glyph->metrics.height >> 6) / map->size; - mapglyph->vxmin = bearingX; - mapglyph->vxmax = bearingX + mWidth; - mapglyph->vymin = -bearingY; - mapglyph->vymax = mHeight - bearingY; mapglyph->txmin = ( (double)(gC * map->glyphSize) ) / ( (double)(map->glyphSize * FONT_CHARS_PER_LINE) ); mapglyph->txmax = mapglyph->txmin + (double)bmp->width / ( (double)(map->glyphSize * FONT_CHARS_PER_LINE) ); mapglyph->tymin = ( (double)(gR * map->glyphSize) ) / ( (double)(map->glyphSize * FONT_CHAR_LINES) ); mapglyph->tymax = mapglyph->tymin + (double)bmp->rows / ( (double)(map->glyphSize * FONT_CHAR_LINES) ); - //Con_Printf("dpi = %f %f (%f %d)\n", (mapglyph->vxmax - mapglyph->vxmin) / (mapglyph->txmax - mapglyph->txmin), (mapglyph->vymax - mapglyph->vymin) / (mapglyph->tymax - mapglyph->tymin), map->size, map->glyphSize); + //mapglyph->vxmin = bearingX; + //mapglyph->vxmax = bearingX + mWidth; + mapglyph->vxmin = glyph->bitmap_left / map->size; + mapglyph->vxmax = mapglyph->vxmin + bmp->width / map->size; // don't ask + //mapglyph->vymin = -bearingY; + //mapglyph->vymax = mHeight - bearingY; + mapglyph->vymin = -glyph->bitmap_top / map->size; + mapglyph->vymax = mapglyph->vymin + bmp->rows / map->size; + //Con_Printf("dpi = %f %f (%f %d) %d %d\n", bmp->width / (mapglyph->vxmax - mapglyph->vxmin), bmp->rows / (mapglyph->vymax - mapglyph->vymin), map->size, map->glyphSize, (int)fontface->size->metrics.x_ppem, (int)fontface->size->metrics.y_ppem); //mapglyph->advance_x = advance * usefont->size; mapglyph->advance_x = advance; mapglyph->advance_y = 0; -- 2.39.2