GRAPHICS: Plug MacFont scaler in

This commit is contained in:
Eugene Sandulenko 2017-01-24 23:33:59 +01:00
parent 41e93fca16
commit b84ab35363
4 changed files with 12 additions and 8 deletions

View File

@ -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;

View File

@ -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;

View File

@ -129,7 +129,7 @@ void MacFontManager::loadFontsBDF() {
}
FontMan.assignFontToName(fontName, font);
macfont->setFont(font);
//macfont->setFont(font);
_fontRegistry.setVal(fontName, macfont);
debug(2, " %s", fontName.c_str());
@ -340,7 +340,7 @@ void MacFontManager::generateFont(MacFont &toFont, MacFont &fromFont) {
debugN("Found font substitute for font '%s' ", getFontName(toFont));
debug("as '%s'", getFontName(fromFont));
Font *font = fromFont.getFont(); // = Graphics::BdfFont::scaleFont(fromFont.getFont(), toFont.getSize());
MacFONTFont *font = Graphics::MacFONTFont::scaleFont(fromFont.getFont(), toFont.getSize());
if (!font) {
warning("Failed to generate font '%s'", getFontName(toFont));

View File

@ -27,6 +27,8 @@
namespace Graphics {
class MacFONTFont;
enum {
kMacFontNonStandard = -1,
kMacFontChicago = 0,
@ -79,8 +81,8 @@ public:
FontManager::FontUsage getFallback() { return _fallback; }
bool isGenerated() { return _generated; }
void setGenerated(bool gen) { _generated = gen; }
Font *getFont() { return _font; }
void setFont(Font *font) { _font = font; }
MacFONTFont *getFont() { return _font; }
void setFont(MacFONTFont *font) { _font = font; }
private:
int _id;
@ -90,7 +92,7 @@ private:
FontManager::FontUsage _fallback;
bool _generated;
Font *_font;
MacFONTFont *_font;
};
class MacFontManager {