From 76cfde072296afe783ea9ab24122bb264402812d Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 20 Jan 2017 09:01:01 +0100 Subject: GRAPHICS: Further work on MacFont font scaling --- graphics/fonts/macfont.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'graphics/fonts') diff --git a/graphics/fonts/macfont.cpp b/graphics/fonts/macfont.cpp index fb3240ac76..0f057a8321 100644 --- a/graphics/fonts/macfont.cpp +++ b/graphics/fonts/macfont.cpp @@ -425,6 +425,19 @@ MacFONTFont *MacFONTFont::scaleFont(MacFONTFont *src, int newSize) { data._size = src->_data._size; data._style = src->_data._style; + // Dtermine width of the bit image table + int newBitmapWidth = 0; + for (uint i = 0; i < src->_data._glyphs.size() + 1; i++) { + MacGlyph *glyph = (i == src->_data._glyphs.size()) ? &_data._defaultChar : &_data._glyphs[i]; + + glyph->width = (int)((float)src->_data._glyphs[i].width * scale); + glyph->kerningOffset = (int)((float)src->_data._glyphs[i].kerningOffset * scale); + glyph->bitmapWidth = (int)((float)src->_data._glyphs[i].bitmapWidth * scale); + glyph->bitmapOffset = newBitmapWidth; + + newBitmapWidth += ((glyph->bitmapWidth + 7) / 8); + } + for (uint i = 0; i < src->_data._glyphs.size() + 1; i++) { MacGlyph *glyph = (i == src->_data._glyphs.size()) ? &_data._defaultChar : &_data._glyphs[i]; -- cgit v1.2.3