mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-23 19:16:21 +00:00
GRAPHICS: Fix BDF font referencing on font generation
This commit is contained in:
parent
b5d4c302d0
commit
ce89406b9a
@ -706,7 +706,7 @@ BdfFont *BdfFont::scaleFont(BdfFont *src, int newSize) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (src->getFontSize()) {
|
||||
if (src->getFontSize() == 0) {
|
||||
warning("Requested to scale 0 size font");
|
||||
return NULL;
|
||||
}
|
||||
@ -735,11 +735,13 @@ BdfFont *BdfFont::scaleFont(BdfFont *src, int newSize) {
|
||||
boxes[i].xOffset = src->_data.boxes[i].xOffset;
|
||||
boxes[i].yOffset = src->_data.boxes[i].yOffset;
|
||||
}
|
||||
data.boxes = boxes;
|
||||
|
||||
byte *advances = new byte[data.numCharacters];
|
||||
for (int i = 0; i < data.numCharacters; ++i) {
|
||||
advances[i] = src->_data.advances[i];
|
||||
}
|
||||
data.advances = advances;
|
||||
|
||||
byte **bitmaps = new byte *[data.numCharacters];
|
||||
|
||||
@ -758,8 +760,6 @@ BdfFont *BdfFont::scaleFont(BdfFont *src, int newSize) {
|
||||
}
|
||||
|
||||
data.bitmaps = bitmaps;
|
||||
data.advances = advances;
|
||||
data.boxes = boxes;
|
||||
|
||||
return new BdfFont(data, DisposeAfterUse::YES);
|
||||
}
|
||||
|
@ -257,15 +257,19 @@ void MacFontManager::generateFontSubstitute(MacFont &macFont) {
|
||||
}
|
||||
|
||||
// Now next smaller font, which is the biggest we have
|
||||
generateFont(macFont, MacFont(macFont.getId(), maxSize, macFont.getSlant()));
|
||||
generateFont(macFont, *_fontRegistry[getFontName(macFont.getId(), maxSize, macFont.getSlant())]);
|
||||
}
|
||||
|
||||
void MacFontManager::generateFont(MacFont toFont, MacFont fromFont) {
|
||||
void MacFontManager::generateFont(MacFont &toFont, MacFont &fromFont) {
|
||||
debugN("Found font substitute for font '%s' ", getFontName(toFont));
|
||||
debug("as '%s'", getFontName(fromFont));
|
||||
|
||||
Graphics::BdfFont *font = Graphics::BdfFont::scaleFont(fromFont.getBdfFont(), toFont.getSize());
|
||||
|
||||
if (!font) {
|
||||
warning("Failed to generate font '%s'", getFontName(toFont));
|
||||
}
|
||||
|
||||
toFont.setGenerated(true);
|
||||
toFont.setBdfFont(font);
|
||||
|
||||
|
@ -104,7 +104,7 @@ private:
|
||||
const char *getFontName(MacFont &font);
|
||||
|
||||
void generateFontSubstitute(MacFont &macFont);
|
||||
void generateFont(MacFont toFont, MacFont fromFont);
|
||||
void generateFont(MacFont &toFont, MacFont &fromFont);
|
||||
|
||||
private:
|
||||
bool _builtInFonts;
|
||||
|
Loading…
x
Reference in New Issue
Block a user