aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2011-07-01 21:53:01 +0200
committerJohannes Schickel2011-07-01 21:53:01 +0200
commitfa5f8dc7031fb8d96a0faaafa817403a46634096 (patch)
tree37a80a332b7f7796e70c73e32382c283303fe05a
parent9e3366d66e472e387be1147d74ea14ecfce25b7f (diff)
downloadscummvm-rg350-fa5f8dc7031fb8d96a0faaafa817403a46634096.tar.gz
scummvm-rg350-fa5f8dc7031fb8d96a0faaafa817403a46634096.tar.bz2
scummvm-rg350-fa5f8dc7031fb8d96a0faaafa817403a46634096.zip
GRAPHICS: Rename NewFont to BdfFont.
-rw-r--r--devtools/convbdf.c4
-rw-r--r--graphics/fonts/bdf.cpp54
-rw-r--r--graphics/fonts/bdf.h26
-rw-r--r--graphics/fonts/consolefont.cpp2
-rw-r--r--graphics/fonts/newfont.cpp2
-rw-r--r--graphics/fonts/newfont_big.cpp2
-rw-r--r--gui/ThemeEngine.cpp10
7 files changed, 50 insertions, 50 deletions
diff --git a/devtools/convbdf.c b/devtools/convbdf.c
index 54848237c8..e465b77a9c 100644
--- a/devtools/convbdf.c
+++ b/devtools/convbdf.c
@@ -890,7 +890,7 @@ int gen_c_source(struct font* pf, char *path) {
fprintf(ofp,
"/* Exported structure definition. */\n"
- "static const FontDesc desc = {\n"
+ "static const BdfFontDesc desc = {\n"
"\t" "\"%s\",\n"
"\t" "%d,\n"
"\t" "%d,\n"
@@ -917,7 +917,7 @@ int gen_c_source(struct font* pf, char *path) {
pf->defaultchar);
fprintf(ofp, "\n" "#if !(defined(__GP32__))\n");
- fprintf(ofp, "extern const NewFont g_sysfont(desc);\n");
+ fprintf(ofp, "extern const BdfFont g_sysfont(desc);\n");
fprintf(ofp, "#else\n");
fprintf(ofp, "DEFINE_FONT(g_sysfont)\n");
fprintf(ofp, "#endif\n");
diff --git a/graphics/fonts/bdf.cpp b/graphics/fonts/bdf.cpp
index ae1a7ccb0b..0e396e41cb 100644
--- a/graphics/fonts/bdf.cpp
+++ b/graphics/fonts/bdf.cpp
@@ -29,23 +29,23 @@
namespace Graphics {
-void free_font(NewFontData *pf);
+void free_font(BdfFontData *pf);
-NewFont::~NewFont() {
+BdfFont::~BdfFont() {
if (_font) {
free_font(_font);
}
}
-int NewFont::getFontHeight() const {
+int BdfFont::getFontHeight() const {
return _desc.height;
}
-int NewFont::getMaxCharWidth() const {
+int BdfFont::getMaxCharWidth() const {
return _desc.maxwidth;
}
-int NewFont::getCharWidth(byte chr) const {
+int BdfFont::getCharWidth(byte chr) const {
// If no width table is specified, return the maximum width
if (!_desc.width)
return _desc.maxwidth;
@@ -78,7 +78,7 @@ void drawCharIntern(byte *ptr, uint pitch, const bitmap_t *src, int h, int minX,
}
}
-void NewFont::drawChar(Surface *dst, byte chr, const int tx, const int ty, const uint32 color) const {
+void BdfFont::drawChar(Surface *dst, byte chr, const int tx, const int ty, const uint32 color) const {
assert(dst != 0);
assert(_desc.bits != 0 && _desc.maxwidth <= 16);
@@ -135,7 +135,7 @@ void NewFont::drawChar(Surface *dst, byte chr, const int tx, const int ty, const
/* builtin C-based proportional/fixed font structure */
/* based on The Microwindows Project http://microwindows.org */
-struct NewFontData {
+struct BdfFontData {
char *name; /* font name */
int maxwidth; /* max width in pixels */
int height; /* height in pixels */
@@ -166,13 +166,13 @@ struct NewFontData {
int start_char = 0;
int limit_char = 255;
-NewFontData *bdf_read_font(Common::SeekableReadStream &fp);
-int bdf_read_header(Common::SeekableReadStream &fp, NewFontData *pf);
-int bdf_read_bitmaps(Common::SeekableReadStream &fp, NewFontData *pf);
+BdfFontData *bdf_read_font(Common::SeekableReadStream &fp);
+int bdf_read_header(Common::SeekableReadStream &fp, BdfFontData *pf);
+int bdf_read_bitmaps(Common::SeekableReadStream &fp, BdfFontData *pf);
char *bdf_getline(Common::SeekableReadStream &fp, char *buf, int len);
bitmap_t bdf_hexval(unsigned char *buf);
-void free_font(NewFontData *pf) {
+void free_font(BdfFontData *pf) {
if (!pf)
return;
free(pf->name);
@@ -185,11 +185,11 @@ void free_font(NewFontData *pf) {
}
/* build incore structure from .bdf file*/
-NewFontData *bdf_read_font(Common::SeekableReadStream &fp) {
- NewFontData *pf;
+BdfFontData *bdf_read_font(Common::SeekableReadStream &fp) {
+ BdfFontData *pf;
uint32 pos = fp.pos();
- pf = (NewFontData *)calloc(1, sizeof(NewFontData));
+ pf = (BdfFontData *)calloc(1, sizeof(BdfFontData));
if (!pf)
goto errout;
@@ -213,7 +213,7 @@ errout:
}
/* read bdf font header information, return 0 on error*/
-int bdf_read_header(Common::SeekableReadStream &fp, NewFontData *pf) {
+int bdf_read_header(Common::SeekableReadStream &fp, BdfFontData *pf) {
int encoding = 0;
int nchars = 0, maxwidth, maxheight;
int firstchar = 65535;
@@ -358,7 +358,7 @@ int bdf_read_header(Common::SeekableReadStream &fp, NewFontData *pf) {
}
/* read bdf font bitmaps, return 0 on error*/
-int bdf_read_bitmaps(Common::SeekableReadStream &fp, NewFontData *pf) {
+int bdf_read_bitmaps(Common::SeekableReadStream &fp, BdfFontData *pf) {
long ofs = 0;
int maxwidth = 0;
int i, k, encoding = 0, width = 0;
@@ -590,14 +590,14 @@ bitmap_t bdf_hexval(unsigned char *buf) {
return val;
}
-NewFont *NewFont::loadFont(Common::SeekableReadStream &stream) {
- NewFontData *data = bdf_read_font(stream);
+BdfFont *BdfFont::loadFont(Common::SeekableReadStream &stream) {
+ BdfFontData *data = bdf_read_font(stream);
if (!data || stream.err()) {
free_font(data);
return 0;
}
- FontDesc desc;
+ BdfFontDesc desc;
desc.name = data->name;
desc.maxwidth = data->maxwidth;
desc.height = data->height;
@@ -615,10 +615,10 @@ NewFont *NewFont::loadFont(Common::SeekableReadStream &stream) {
desc.defaultchar = data->defaultchar;
desc.bits_size = data->bits_size;
- return new NewFont(desc, data);
+ return new BdfFont(desc, data);
}
-bool NewFont::cacheFontData(const NewFont &font, const Common::String &filename) {
+bool BdfFont::cacheFontData(const BdfFont &font, const Common::String &filename) {
Common::DumpFile cacheFile;
if (!cacheFile.open(filename)) {
warning("Couldn't open file '%s' for writing", filename.c_str());
@@ -674,14 +674,14 @@ bool NewFont::cacheFontData(const NewFont &font, const Common::String &filename)
return !cacheFile.err();
}
-NewFont *NewFont::loadFromCache(Common::SeekableReadStream &stream) {
- NewFont *font = 0;
+BdfFont *BdfFont::loadFromCache(Common::SeekableReadStream &stream) {
+ BdfFont *font = 0;
- NewFontData *data = (NewFontData *)malloc(sizeof(NewFontData));
+ BdfFontData *data = (BdfFontData *)malloc(sizeof(BdfFontData));
if (!data)
return 0;
- memset(data, 0, sizeof(NewFontData));
+ memset(data, 0, sizeof(BdfFontData));
data->maxwidth = stream.readUint16BE();
data->height = stream.readUint16BE();
@@ -761,7 +761,7 @@ NewFont *NewFont::loadFromCache(Common::SeekableReadStream &stream) {
return 0;
}
- FontDesc desc;
+ BdfFontDesc desc;
desc.name = data->name;
desc.maxwidth = data->maxwidth;
desc.height = data->height;
@@ -779,7 +779,7 @@ NewFont *NewFont::loadFromCache(Common::SeekableReadStream &stream) {
desc.defaultchar = data->defaultchar;
desc.bits_size = data->bits_size;
- font = new NewFont(desc, data);
+ font = new BdfFont(desc, data);
if (!font) {
free(data->bits);
free(data->offset);
diff --git a/graphics/fonts/bdf.h b/graphics/fonts/bdf.h
index db2c746fd4..31c009eb27 100644
--- a/graphics/fonts/bdf.h
+++ b/graphics/fonts/bdf.h
@@ -43,7 +43,7 @@ struct BBX {
/* builtin C-based proportional/fixed font structure */
/* based on The Microwindows Project http://microwindows.org */
-struct FontDesc {
+struct BdfFontDesc {
const char *name; /* font name */
int maxwidth; /* max width in pixels */
int height; /* height in pixels */
@@ -59,16 +59,16 @@ struct FontDesc {
long bits_size; /* # words of bitmap_t bits */
};
-struct NewFontData;
+struct BdfFontData;
-class NewFont : public Font {
+class BdfFont : public Font {
protected:
- FontDesc _desc;
- NewFontData *_font;
+ BdfFontDesc _desc;
+ BdfFontData *_font;
public:
- NewFont(const FontDesc &desc, NewFontData *font = 0) : _desc(desc), _font(font) {}
- ~NewFont();
+ BdfFont(const BdfFontDesc &desc, BdfFontData *font = 0) : _desc(desc), _font(font) {}
+ ~BdfFont();
virtual int getFontHeight() const;
virtual int getMaxCharWidth() const;
@@ -76,19 +76,19 @@ public:
virtual int getCharWidth(byte chr) const;
virtual void drawChar(Surface *dst, byte chr, int x, int y, uint32 color) const;
- static NewFont *loadFont(Common::SeekableReadStream &stream);
- static bool cacheFontData(const NewFont &font, const Common::String &filename);
- static NewFont *loadFromCache(Common::SeekableReadStream &stream);
+ static BdfFont *loadFont(Common::SeekableReadStream &stream);
+ static bool cacheFontData(const BdfFont &font, const Common::String &filename);
+ static BdfFont *loadFromCache(Common::SeekableReadStream &stream);
};
#define DEFINE_FONT(n) \
- const NewFont *n = 0; \
+ const BdfFont *n = 0; \
void create_##n() { \
- n = new NewFont(desc); \
+ n = new BdfFont(desc); \
}
#define FORWARD_DECLARE_FONT(n) \
- extern const NewFont *n; \
+ extern const BdfFont *n; \
extern void create_##n()
#define INIT_FONT(n) \
diff --git a/graphics/fonts/consolefont.cpp b/graphics/fonts/consolefont.cpp
index 817cdb4e4c..5b4768327a 100644
--- a/graphics/fonts/consolefont.cpp
+++ b/graphics/fonts/consolefont.cpp
@@ -5635,7 +5635,7 @@ static const unsigned long _sysfont_offset[] = {
};
/* Exported structure definition. */
-static const FontDesc desc = {
+static const BdfFontDesc desc = {
"5x8-L1",
5,
8,
diff --git a/graphics/fonts/newfont.cpp b/graphics/fonts/newfont.cpp
index 5a686177e7..f02baba2de 100644
--- a/graphics/fonts/newfont.cpp
+++ b/graphics/fonts/newfont.cpp
@@ -7419,7 +7419,7 @@ static const unsigned long _sysfont_offset[] = {
};
/* Exported structure definition. */
-static const FontDesc desc = {
+static const BdfFontDesc desc = {
"clR6x12-L1",
6,
12,
diff --git a/graphics/fonts/newfont_big.cpp b/graphics/fonts/newfont_big.cpp
index a37eaf704d..59c54a4551 100644
--- a/graphics/fonts/newfont_big.cpp
+++ b/graphics/fonts/newfont_big.cpp
@@ -5523,7 +5523,7 @@ static const BBX _sysfont_bbx[] = {
};
/* Exported structure definition. */
-static const FontDesc desc = {
+static const BdfFontDesc desc = {
"helvB12-L1",
13,
14,
diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp
index 3f2e127902..4a2e0a7ac5 100644
--- a/gui/ThemeEngine.cpp
+++ b/gui/ThemeEngine.cpp
@@ -1395,7 +1395,7 @@ const Graphics::Font *ThemeEngine::loadFontFromArchive(const Common::String &fil
if (_themeArchive)
stream = _themeArchive->createReadStreamForMember(filename);
if (stream) {
- font = Graphics::NewFont::loadFont(*stream);
+ font = Graphics::BdfFont::loadFont(*stream);
delete stream;
}
@@ -1409,7 +1409,7 @@ const Graphics::Font *ThemeEngine::loadCachedFontFromArchive(const Common::Strin
if (_themeArchive)
stream = _themeArchive->createReadStreamForMember(filename);
if (stream) {
- font = Graphics::NewFont::loadFromCache(*stream);
+ font = Graphics::BdfFont::loadFromCache(*stream);
delete stream;
}
@@ -1423,7 +1423,7 @@ const Graphics::Font *ThemeEngine::loadFont(const Common::String &filename) {
if (!cacheFilename.empty()) {
if (fontFile.open(cacheFilename)) {
- font = Graphics::NewFont::loadFromCache(fontFile);
+ font = Graphics::BdfFont::loadFromCache(fontFile);
}
if (font)
@@ -1435,7 +1435,7 @@ const Graphics::Font *ThemeEngine::loadFont(const Common::String &filename) {
// normal open
if (fontFile.open(filename)) {
- font = Graphics::NewFont::loadFont(fontFile);
+ font = Graphics::BdfFont::loadFont(fontFile);
}
if (!font) {
@@ -1444,7 +1444,7 @@ const Graphics::Font *ThemeEngine::loadFont(const Common::String &filename) {
if (font) {
if (!cacheFilename.empty()) {
- if (!Graphics::NewFont::cacheFontData(*(const Graphics::NewFont *)font, cacheFilename)) {
+ if (!Graphics::BdfFont::cacheFontData(*(const Graphics::BdfFont *)font, cacheFilename)) {
warning("Couldn't create cache file for font '%s'", filename.c_str());
}
}