aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2016-10-06 07:33:46 +0200
committerEugene Sandulenko2016-10-06 07:33:46 +0200
commit0d4d5459f27abaac7d41288583acc80b2a5ad9fb (patch)
tree298c2c0df13ea8138c49c2b5d2298a703ee00582
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
-rw-r--r--devtools/convbdf.cpp16
-rw-r--r--graphics/fonts/bdf.cpp40
-rw-r--r--graphics/fonts/bdf.h4
-rw-r--r--graphics/macgui/macwindowmanager.cpp4
4 files changed, 32 insertions, 32 deletions
diff --git a/devtools/convbdf.cpp b/devtools/convbdf.cpp
index c84907659d..b9ce5c7f5f 100644
--- a/devtools/convbdf.cpp
+++ b/devtools/convbdf.cpp
@@ -38,7 +38,7 @@ struct BdfBoundingBox {
};
struct BdfFont {
- char *faceName;
+ char *familyName;
int maxAdvance;
int height;
BdfBoundingBox defaultBox;
@@ -63,7 +63,7 @@ struct BdfFont {
delete[] bitmaps;
delete[] advances;
delete[] boxes;
- delete[] faceName;
+ delete[] familyName;
}
};
@@ -162,12 +162,12 @@ int main(int argc, char *argv[]) {
font.advances = new unsigned char[font.numCharacters];
font.boxes = new BdfBoundingBox[font.numCharacters];
} else if (hasPrefix(line, "FACE_NAME \"")) {
- font.faceName = new char[line.size()]; // We will definitely fit here
- strncpy(font.faceName, &line.c_str()[11], line.size() - 1);
- char *p = &font.faceName[strlen(font.faceName)];
- while (p != font.faceName && *p != '"')
+ font.familyName = new char[line.size()]; // We will definitely fit here
+ strncpy(font.familyName, &line.c_str()[11], line.size() - 1);
+ char *p = &font.familyName[strlen(font.familyName)];
+ while (p != font.familyName && *p != '"')
p--;
- if (p == font.faceName)
+ if (p == font.familyName)
error("Invalid FACE_NAME");
*p = '\0'; // Remove last quote
} else if (hasPrefix(line, "FONT_ASCENT ")) {
@@ -503,7 +503,7 @@ int main(int argc, char *argv[]) {
"\t%d, // Characters\n"
"\n"
"\tbitmapTable, // Bitmaps\n",
- font.faceName, font.maxAdvance, font.height, font.defaultBox.width,
+ font.familyName, font.maxAdvance, font.height, font.defaultBox.width,
font.defaultBox.height, font.defaultBox.xOffset, font.defaultBox.yOffset,
font.ascent, font.firstCharacter, font.defaultCharacter, font.numCharacters);
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();