aboutsummaryrefslogtreecommitdiff
path: root/graphics
diff options
context:
space:
mode:
authorEugene Sandulenko2016-10-06 07:33:46 +0200
committerEugene Sandulenko2016-10-06 07:33:46 +0200
commit0d4d5459f27abaac7d41288583acc80b2a5ad9fb (patch)
tree298c2c0df13ea8138c49c2b5d2298a703ee00582 /graphics
parent07316afaa423a95308364290554379491317909d (diff)
downloadscummvm-rg350-0d4d5459f27abaac7d41288583acc80b2a5ad9fb.tar.gz
scummvm-rg350-0d4d5459f27abaac7d41288583acc80b2a5ad9fb.tar.bz2
scummvm-rg350-0d4d5459f27abaac7d41288583acc80b2a5ad9fb.zip
GRAPHICS: Use Family name instead of font name when reading from BDF fonts
Diffstat (limited to 'graphics')
-rw-r--r--graphics/fonts/bdf.cpp40
-rw-r--r--graphics/fonts/bdf.h4
-rw-r--r--graphics/macgui/macwindowmanager.cpp4
3 files changed, 24 insertions, 24 deletions
diff --git a/graphics/fonts/bdf.cpp b/graphics/fonts/bdf.cpp
index 59a4ddb24f..c0a7b05d8b 100644
--- a/graphics/fonts/bdf.cpp
+++ b/graphics/fonts/bdf.cpp
@@ -41,12 +41,12 @@ BdfFont::~BdfFont() {
delete[] _data.bitmaps;
delete[] _data.advances;
delete[] _data.boxes;
- delete[] _data.faceName;
+ delete[] _data.familyName;
}
}
-const char *BdfFont::getFaceName() const {
- return _data.faceName;
+const char *BdfFont::getFamilyName() const {
+ return _data.familyName;
}
int BdfFont::getFontHeight() const {
@@ -290,7 +290,7 @@ BdfFont *BdfFont::loadFont(Common::SeekableReadStream &stream) {
memset(bitmaps, 0, sizeof(byte *) * font.numCharacters);
byte *advances = new byte[font.numCharacters];
BdfBoundingBox *boxes = new BdfBoundingBox[font.numCharacters];
- char *faceName;
+ char *familyName;
int descent = -1;
@@ -316,7 +316,7 @@ BdfFont *BdfFont::loadFont(Common::SeekableReadStream &stream) {
delete[] bitmaps;
delete[] advances;
delete[] boxes;
- delete[] faceName;
+ delete[] familyName;
return 0;
}
@@ -331,7 +331,7 @@ BdfFont *BdfFont::loadFont(Common::SeekableReadStream &stream) {
delete[] bitmaps;
delete[] advances;
delete[] boxes;
- delete[] faceName;
+ delete[] familyName;
return 0;
}
} else if (line.hasPrefix("FONT_DESCENT ")) {
@@ -341,7 +341,7 @@ BdfFont *BdfFont::loadFont(Common::SeekableReadStream &stream) {
delete[] bitmaps;
delete[] advances;
delete[] boxes;
- delete[] faceName;
+ delete[] familyName;
return 0;
}
} else if (line.hasPrefix("DEFAULT_CHAR ")) {
@@ -351,7 +351,7 @@ BdfFont *BdfFont::loadFont(Common::SeekableReadStream &stream) {
delete[] bitmaps;
delete[] advances;
delete[] boxes;
- delete[] faceName;
+ delete[] familyName;
return 0;
}
} else if (line.hasPrefix("STARTCHAR ")) {
@@ -376,7 +376,7 @@ BdfFont *BdfFont::loadFont(Common::SeekableReadStream &stream) {
delete[] bitmaps;
delete[] advances;
delete[] boxes;
- delete[] faceName;
+ delete[] familyName;
return 0;
}
@@ -385,19 +385,19 @@ BdfFont *BdfFont::loadFont(Common::SeekableReadStream &stream) {
advances[encoding] = advance;
boxes[encoding] = box;
}
- } else if (line.hasPrefix("FACE_NAME \"")) {
- faceName = new char[line.size()]; // We will definitely fit here
- Common::strlcpy(faceName, &line.c_str()[11], line.size());
- char *p = &faceName[strlen(faceName)];
- while (p != faceName && *p != '"')
+ } else if (line.hasPrefix("FAMILY_NAME \"")) {
+ familyName = new char[line.size()]; // We will definitely fit here
+ Common::strlcpy(familyName, &line.c_str()[11], line.size());
+ char *p = &familyName[strlen(familyName)];
+ while (p != familyName && *p != '"')
p--;
- if (p == faceName) {
- warning("BdfFont::loadFont: Invalid FACE_NAME");
+ if (p == familyName) {
+ warning("BdfFont::loadFont: Invalid FAMILY_NAME");
freeBitmaps(bitmaps, font.numCharacters);
delete[] bitmaps;
delete[] advances;
delete[] boxes;
- delete[] faceName;
+ delete[] familyName;
return 0;
}
*p = '\0'; // Remove last quote
@@ -412,7 +412,7 @@ BdfFont *BdfFont::loadFont(Common::SeekableReadStream &stream) {
delete[] bitmaps;
delete[] advances;
delete[] boxes;
- delete[] faceName;
+ delete[] familyName;
return 0;
}
@@ -421,7 +421,7 @@ BdfFont *BdfFont::loadFont(Common::SeekableReadStream &stream) {
font.bitmaps = bitmaps;
font.advances = advances;
font.boxes = boxes;
- font.faceName = faceName;
+ font.familyName = familyName;
int firstCharacter = font.numCharacters;
int lastCharacter = -1;
@@ -454,7 +454,7 @@ BdfFont *BdfFont::loadFont(Common::SeekableReadStream &stream) {
delete[] font.bitmaps;
delete[] font.advances;
delete[] font.boxes;
- delete[] faceName;
+ delete[] familyName;
return 0;
}
diff --git a/graphics/fonts/bdf.h b/graphics/fonts/bdf.h
index 4e3295ca5f..140b1f7f4e 100644
--- a/graphics/fonts/bdf.h
+++ b/graphics/fonts/bdf.h
@@ -40,7 +40,7 @@ struct BdfBoundingBox {
};
struct BdfFontData {
- const char *faceName;
+ const char *familyName;
int maxAdvance;
int height;
@@ -67,7 +67,7 @@ public:
virtual int getCharWidth(uint32 chr) const;
virtual void drawChar(Surface *dst, uint32 chr, int x, int y, uint32 color) const;
- const char *getFaceName() const;
+ const char *getFamilyName() const;
static BdfFont *loadFont(Common::SeekableReadStream &stream);
static bool cacheFontData(const BdfFont &font, const Common::String &filename);
diff --git a/graphics/macgui/macwindowmanager.cpp b/graphics/macgui/macwindowmanager.cpp
index f0f821d313..a6854663d6 100644
--- a/graphics/macgui/macwindowmanager.cpp
+++ b/graphics/macgui/macwindowmanager.cpp
@@ -348,8 +348,8 @@ void MacWindowManager::loadFonts() {
delete stream;
Common::String fontName;
- if (font->getFaceName() && *font->getFaceName()) {
- fontName = font->getFaceName();
+ if (font->getFamilyName() && *font->getFamilyName()) {
+ fontName = font->getFamilyName();
} else { // Get it from the file name
fontName = (*it)->getName();