aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--devtools/convbdf.cpp16
-rw-r--r--graphics/fonts/bdf.cpp36
-rw-r--r--graphics/fonts/bdf.h2
-rw-r--r--graphics/fonts/consolefont.cpp1
-rw-r--r--graphics/fonts/newfont.cpp1
-rw-r--r--graphics/fonts/newfont_big.cpp1
6 files changed, 54 insertions, 3 deletions
diff --git a/devtools/convbdf.cpp b/devtools/convbdf.cpp
index a3196a9a94..5fbcd98b25 100644
--- a/devtools/convbdf.cpp
+++ b/devtools/convbdf.cpp
@@ -39,6 +39,7 @@ struct BdfBoundingBox {
struct BdfFont {
char *familyName;
+ char *slant;
int maxAdvance;
int size;
int height;
@@ -53,7 +54,7 @@ struct BdfFont {
unsigned char *advances;
BdfBoundingBox *boxes;
- BdfFont() : bitmaps(0), advances(0), boxes(0) {
+ BdfFont() : bitmaps(0), advances(0), boxes(0), familyName(0), slant(0) {
}
~BdfFont() {
@@ -65,6 +66,7 @@ struct BdfFont {
delete[] advances;
delete[] boxes;
delete[] familyName;
+ delete[] slant;
}
};
@@ -173,6 +175,15 @@ int main(int argc, char *argv[]) {
if (p == font.familyName)
error("Invalid FAMILY_NAME");
*p = '\0'; // Remove last quote
+ } else if (hasPrefix(line, "SLANT \"")) {
+ font.familyName = new char[line.size()]; // We will definitely fit here
+ strncpy(font.familyName, &line.c_str()[7], line.size() - 1);
+ char *p = &font.slant[strlen(font.slant)];
+ while (p != font.slant && *p != '"')
+ p--;
+ if (p == font.slant)
+ error("Invalid SLANT");
+ *p = '\0'; // Remove last quote
} else if (hasPrefix(line, "FONT_ASCENT ")) {
if (sscanf(line.c_str(), "FONT_ASCENT %d", &font.ascent) != 1)
error("Invalid FONT_ASCENT");
@@ -496,6 +507,7 @@ int main(int argc, char *argv[]) {
printf("// Font structure\n"
"static const BdfFontData desc = {\n"
"\t\"%s\", // Family name\n"
+ "\t\"%s\", // Slant\n"
"\t%d, // Max advance\n"
"\t%d, // Size\n"
"\t%d, // Height\n"
@@ -507,7 +519,7 @@ int main(int argc, char *argv[]) {
"\t%d, // Characters\n"
"\n"
"\tbitmapTable, // Bitmaps\n",
- font.familyName, font.maxAdvance, font.size, font.height, font.defaultBox.width,
+ font.familyName, font.slant, font.maxAdvance, font.size, 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 a8ffe28489..1a23133858 100644
--- a/graphics/fonts/bdf.cpp
+++ b/graphics/fonts/bdf.cpp
@@ -42,6 +42,7 @@ BdfFont::~BdfFont() {
delete[] _data.advances;
delete[] _data.boxes;
delete[] _data.familyName;
+ delete[] _data.slant;
}
}
@@ -49,6 +50,10 @@ const char *BdfFont::getFamilyName() const {
return _data.familyName;
}
+const char *BdfFont::getFontSlant() const {
+ return _data.slant;
+}
+
int BdfFont::getFontHeight() const {
return _data.height;
}
@@ -294,7 +299,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 *familyName;
+ char *familyName, *slant;
int descent = -1;
@@ -307,6 +312,8 @@ BdfFont *BdfFont::loadFont(Common::SeekableReadStream &stream) {
delete[] bitmaps;
delete[] advances;
delete[] boxes;
+ delete[] familyName;
+ delete[] slant;
return 0;
}
@@ -321,6 +328,7 @@ BdfFont *BdfFont::loadFont(Common::SeekableReadStream &stream) {
delete[] advances;
delete[] boxes;
delete[] familyName;
+ delete[] slant;
return 0;
}
@@ -337,6 +345,7 @@ BdfFont *BdfFont::loadFont(Common::SeekableReadStream &stream) {
delete[] advances;
delete[] boxes;
delete[] familyName;
+ delete[] slant;
return 0;
}
} else if (line.hasPrefix("FONT_ASCENT ")) {
@@ -347,6 +356,7 @@ BdfFont *BdfFont::loadFont(Common::SeekableReadStream &stream) {
delete[] advances;
delete[] boxes;
delete[] familyName;
+ delete[] slant;
return 0;
}
} else if (line.hasPrefix("FONT_DESCENT ")) {
@@ -357,6 +367,7 @@ BdfFont *BdfFont::loadFont(Common::SeekableReadStream &stream) {
delete[] advances;
delete[] boxes;
delete[] familyName;
+ delete[] slant;
return 0;
}
} else if (line.hasPrefix("DEFAULT_CHAR ")) {
@@ -367,6 +378,7 @@ BdfFont *BdfFont::loadFont(Common::SeekableReadStream &stream) {
delete[] advances;
delete[] boxes;
delete[] familyName;
+ delete[] slant;
return 0;
}
} else if (line.hasPrefix("STARTCHAR ")) {
@@ -392,6 +404,7 @@ BdfFont *BdfFont::loadFont(Common::SeekableReadStream &stream) {
delete[] advances;
delete[] boxes;
delete[] familyName;
+ delete[] slant;
return 0;
}
@@ -413,6 +426,24 @@ BdfFont *BdfFont::loadFont(Common::SeekableReadStream &stream) {
delete[] advances;
delete[] boxes;
delete[] familyName;
+ delete[] slant;
+ return 0;
+ }
+ *p = '\0'; // Remove last quote
+ } else if (line.hasPrefix("SLANT \"")) {
+ slant = new char[line.size()]; // We will definitely fit here
+ Common::strlcpy(slant, &line.c_str()[7], line.size());
+ char *p = &slant[strlen(slant)];
+ while (p != slant && *p != '"')
+ p--;
+ if (p == slant) {
+ warning("BdfFont::loadFont: Invalid SLANT");
+ freeBitmaps(bitmaps, font.numCharacters);
+ delete[] bitmaps;
+ delete[] advances;
+ delete[] boxes;
+ delete[] familyName;
+ delete[] slant;
return 0;
}
*p = '\0'; // Remove last quote
@@ -428,6 +459,7 @@ BdfFont *BdfFont::loadFont(Common::SeekableReadStream &stream) {
delete[] advances;
delete[] boxes;
delete[] familyName;
+ delete[] slant;
return 0;
}
@@ -437,6 +469,7 @@ BdfFont *BdfFont::loadFont(Common::SeekableReadStream &stream) {
font.advances = advances;
font.boxes = boxes;
font.familyName = familyName;
+ font.slant = slant;
int firstCharacter = font.numCharacters;
int lastCharacter = -1;
@@ -470,6 +503,7 @@ BdfFont *BdfFont::loadFont(Common::SeekableReadStream &stream) {
delete[] font.advances;
delete[] font.boxes;
delete[] familyName;
+ delete[] slant;
return 0;
}
diff --git a/graphics/fonts/bdf.h b/graphics/fonts/bdf.h
index bc1ced9599..9a3b20e14c 100644
--- a/graphics/fonts/bdf.h
+++ b/graphics/fonts/bdf.h
@@ -41,6 +41,7 @@ struct BdfBoundingBox {
struct BdfFontData {
const char *familyName;
+ const char *slant;
int maxAdvance;
int height;
@@ -69,6 +70,7 @@ public:
virtual void drawChar(Surface *dst, uint32 chr, int x, int y, uint32 color) const;
const char *getFamilyName() const;
+ const char *getFontSlant() const;
int getFontSize() const;
static BdfFont *loadFont(Common::SeekableReadStream &stream);
diff --git a/graphics/fonts/consolefont.cpp b/graphics/fonts/consolefont.cpp
index 9b1f5458fc..9dcf1dc9f2 100644
--- a/graphics/fonts/consolefont.cpp
+++ b/graphics/fonts/consolefont.cpp
@@ -5851,6 +5851,7 @@ const byte *const bitmapTable[] = {
// Font structure
static const BdfFontData desc = {
"Fixed", // Family name
+ "R", // Slant
5, // Max advance
8, // Size
8, // Height
diff --git a/graphics/fonts/newfont.cpp b/graphics/fonts/newfont.cpp
index 1ee3df4941..ff06211ab3 100644
--- a/graphics/fonts/newfont.cpp
+++ b/graphics/fonts/newfont.cpp
@@ -7635,6 +7635,7 @@ const byte *const bitmapTable[] = {
// Font structure
static const BdfFontData desc = {
"Schumacher", // Family name
+ "R", // Slant
6, // Max advance
12, // Size
12, // Height
diff --git a/graphics/fonts/newfont_big.cpp b/graphics/fonts/newfont_big.cpp
index 4c30141bcc..e44e2cee50 100644
--- a/graphics/fonts/newfont_big.cpp
+++ b/graphics/fonts/newfont_big.cpp
@@ -5830,6 +5830,7 @@ static const BdfBoundingBox boxes[] = {
// Font structure
static const BdfFontData desc = {
"Helvetica", // Family name
+ "R", // Slant
13, // Max advance
12, // Size
14, // Height