From b84ab35363ac2fd40031b7f313fe49ebfc09d967 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 24 Jan 2017 23:33:59 +0100 Subject: GRAPHICS: Plug MacFont scaler in --- graphics/fonts/macfont.cpp | 6 ++++-- graphics/fonts/macfont.h | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'graphics/fonts') diff --git a/graphics/fonts/macfont.cpp b/graphics/fonts/macfont.cpp index b8b808f9ea..d15f0d1704 100644 --- a/graphics/fonts/macfont.cpp +++ b/graphics/fonts/macfont.cpp @@ -427,6 +427,8 @@ MacFONTFont *MacFONTFont::scaleFont(MacFONTFont *src, int newSize) { data._size = src->_data._size; data._style = src->_data._style; + data._glyphs.resize(src->_data._glyphs.size()); + // Dtermine width of the bit image table int newBitmapWidth = 0; for (uint i = 0; i < src->_data._glyphs.size() + 1; i++) { @@ -443,7 +445,7 @@ MacFONTFont *MacFONTFont::scaleFont(MacFONTFont *src, int newSize) { data._rowWords = newBitmapWidth; - uint16 bitImageSize = data._rowWords * _data._fRectHeight; + uint16 bitImageSize = data._rowWords * data._fRectHeight; data._bitImage = new byte[bitImageSize]; int srcPitch = src->_data._rowWords; @@ -454,7 +456,7 @@ MacFONTFont *MacFONTFont::scaleFont(MacFONTFont *src, int newSize) { MacGlyph *glyph = (i == src->_data._glyphs.size()) ? &data._defaultChar : &data._glyphs[i]; byte *ptr = &data._bitImage[glyph->bitmapOffset]; - for (int y = 0; y < _data._fRectHeight; y++) { + for (int y = 0; y < data._fRectHeight; y++) { const byte *srcd = (const byte *)&src->_data._bitImage[((int)((float)y / scale)) * srcPitch + srcglyph->bitmapOffset]; byte *dst = ptr; byte b = 0; diff --git a/graphics/fonts/macfont.h b/graphics/fonts/macfont.h index ab285ed905..5baa6438bb 100644 --- a/graphics/fonts/macfont.h +++ b/graphics/fonts/macfont.h @@ -156,7 +156,7 @@ public: int getFontSize() const { return _data._size; } - MacFONTFont *scaleFont(MacFONTFont *src, int newSize); + static MacFONTFont *scaleFont(MacFONTFont *src, int newSize); private: MacFONTdata _data; -- cgit v1.2.3