diff options
author | Johannes Schickel | 2014-06-09 18:10:28 +0200 |
---|---|---|
committer | Johannes Schickel | 2014-09-03 22:55:48 +0200 |
commit | 248ea3c1aba84fb8ae2f7021deebae64b967b9c6 (patch) | |
tree | 99d30d14c88ae07e6196e901ad7b8dd21908090b | |
parent | d55cd8f3b44de42d9be09280634584b6424945f9 (diff) | |
download | scummvm-rg350-248ea3c1aba84fb8ae2f7021deebae64b967b9c6.tar.gz scummvm-rg350-248ea3c1aba84fb8ae2f7021deebae64b967b9c6.tar.bz2 scummvm-rg350-248ea3c1aba84fb8ae2f7021deebae64b967b9c6.zip |
GRAPHICS: Allow negative xOffset in TTF.
This should improve the visual looks of many fonts. However, it might result
in the first line of the glyph to be drawn left of the position specified in
drawChar.
-rw-r--r-- | graphics/fonts/ttf.cpp | 14 |
1 files changed, 0 insertions, 14 deletions
diff --git a/graphics/fonts/ttf.cpp b/graphics/fonts/ttf.cpp index 4b63c6c60f..ba57613601 100644 --- a/graphics/fonts/ttf.cpp +++ b/graphics/fonts/ttf.cpp @@ -454,25 +454,11 @@ bool TTFFont::cacheGlyph(Glyph &glyph, uint32 chr) const { if (_face->glyph->format != FT_GLYPH_FORMAT_BITMAP) return false; - FT_Glyph_Metrics &metrics = _face->glyph->metrics; - glyph.xOffset = _face->glyph->bitmap_left; - int xMax = glyph.xOffset + ftCeil26_6(metrics.width); glyph.yOffset = _ascent - _face->glyph->bitmap_top; glyph.advance = ftCeil26_6(_face->glyph->advance.x); - // In case we got a negative xMin we adjust that, this might make some - // characters make a bit odd, but it's the only way we can assure no - // invalid memory writes with the current font API - if (glyph.xOffset < 0) { - xMax -= glyph.xOffset; - glyph.xOffset = 0; - - if (xMax > glyph.advance) - glyph.advance = xMax; - } - const FT_Bitmap &bitmap = _face->glyph->bitmap; glyph.image.create(bitmap.width, bitmap.rows, PixelFormat::createFormatCLUT8()); |