aboutsummaryrefslogtreecommitdiff
path: root/graphics
diff options
context:
space:
mode:
Diffstat (limited to 'graphics')
-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
5 files changed, 40 insertions, 1 deletions
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