diff options
author | Max Horn | 2004-08-15 14:05:28 +0000 |
---|---|---|
committer | Max Horn | 2004-08-15 14:05:28 +0000 |
commit | bfe9c26a3d838d17c28eceac00c0e35cd5c6138e (patch) | |
tree | ed9247d6b9b3d3ebdb50b76eea352a146ad30811 /graphics/font.cpp | |
parent | 0f142572f7e4ee643a462d22654a4f9dd9b2ee7a (diff) | |
download | scummvm-rg350-bfe9c26a3d838d17c28eceac00c0e35cd5c6138e.tar.gz scummvm-rg350-bfe9c26a3d838d17c28eceac00c0e35cd5c6138e.tar.bz2 scummvm-rg350-bfe9c26a3d838d17c28eceac00c0e35cd5c6138e.zip |
Changed the way NewFonts are instantiated (will make it easier to add multiple fonts)
svn-id: r14625
Diffstat (limited to 'graphics/font.cpp')
-rw-r--r-- | graphics/font.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/graphics/font.cpp b/graphics/font.cpp index e57cb3aae1..20a604eb73 100644 --- a/graphics/font.cpp +++ b/graphics/font.cpp @@ -25,36 +25,36 @@ namespace Graphics { int NewFont::getCharWidth(byte chr) const { // If no width table is specified, return the maximum width - if (!width) - return maxwidth; + if (!desc.width) + return desc.maxwidth; // If this character is not included in the font, use the default char. - if (chr < firstchar || firstchar + size < chr) { + if (chr < desc.firstchar || desc.firstchar + desc.size < chr) { if (chr == ' ') - return maxwidth / 2; - chr = defaultchar; + return desc.maxwidth / 2; + chr = desc.defaultchar; } - return width[chr - firstchar]; + return desc.width[chr - desc.firstchar]; } void NewFont::drawChar(const Surface *dst, byte chr, int x, int y, uint32 color) const { assert(dst != 0); byte *ptr = (byte *)dst->pixels + x * dst->bytesPerPixel + y * dst->pitch; - assert(bits != 0 && maxwidth <= 16); + assert(desc.bits != 0 && desc.maxwidth <= 16); assert(dst->bytesPerPixel == 1 || dst->bytesPerPixel == 2); // If this character is not included in the font, use the default char. - if (chr < firstchar || chr >= firstchar + size) { + if (chr < desc.firstchar || chr >= desc.firstchar + desc.size) { if (chr == ' ') return; - chr = defaultchar; + chr = desc.defaultchar; } const int w = getCharWidth(chr); - chr -= firstchar; - const bitmap_t *tmp = bits + (offset ? offset[chr] : (chr * height)); + chr -= desc.firstchar; + const bitmap_t *tmp = desc.bits + (desc.offset ? desc.offset[chr] : (chr * desc.height)); - for (y = 0; y < height; y++) { + for (y = 0; y < desc.height; y++) { const bitmap_t buffer = *tmp++; bitmap_t mask = 0x8000; for (x = 0; x < w; x++) { |