mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-13 12:39:56 +00:00
GRAPHICS: Fix BDF font loading
When the character is out of range, just go to the next character.
This commit is contained in:
parent
995b5a8452
commit
bc343edb42
@ -397,16 +397,16 @@ BdfFont *BdfFont::loadFont(Common::SeekableReadStream &stream) {
|
|||||||
byte *bitmap = loadCharacter(stream, encoding, advance, box);
|
byte *bitmap = loadCharacter(stream, encoding, advance, box);
|
||||||
|
|
||||||
// Ignore all characters above 255.
|
// Ignore all characters above 255.
|
||||||
if (encoding < -1 || encoding >= font.numCharacters) {
|
if (encoding < 0 || encoding >= font.numCharacters) {
|
||||||
delete[] bitmap;
|
delete[] bitmap;
|
||||||
encoding = -1;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate the max advance
|
// Calculate the max advance
|
||||||
if (encoding != -1 && advance > font.maxAdvance)
|
if (advance > font.maxAdvance)
|
||||||
font.maxAdvance = advance;
|
font.maxAdvance = advance;
|
||||||
|
|
||||||
if (!bitmap && encoding != -1) {
|
if (!bitmap) {
|
||||||
warning("BdfFont::loadFont: Character %d invalid", encoding);
|
warning("BdfFont::loadFont: Character %d invalid", encoding);
|
||||||
freeBitmaps(bitmaps, font.numCharacters);
|
freeBitmaps(bitmaps, font.numCharacters);
|
||||||
delete[] bitmaps;
|
delete[] bitmaps;
|
||||||
@ -417,11 +417,9 @@ BdfFont *BdfFont::loadFont(Common::SeekableReadStream &stream) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (encoding != -1) {
|
bitmaps[encoding] = bitmap;
|
||||||
bitmaps[encoding] = bitmap;
|
advances[encoding] = advance;
|
||||||
advances[encoding] = advance;
|
boxes[encoding] = box;
|
||||||
boxes[encoding] = box;
|
|
||||||
}
|
|
||||||
} else if (line.hasPrefix("FAMILY_NAME \"")) {
|
} else if (line.hasPrefix("FAMILY_NAME \"")) {
|
||||||
if (familyName != nullptr) {
|
if (familyName != nullptr) {
|
||||||
warning("BdfFont::loadFont: Duplicated FAMILY_NAME");
|
warning("BdfFont::loadFont: Duplicated FAMILY_NAME");
|
||||||
|
Loading…
Reference in New Issue
Block a user