Take the font height from the charset header for V3 fonts, too; determine the number of chars for V4/V5 fonts, too

svn-id: r18266
This commit is contained in:
Max Horn 2005-05-26 16:38:02 +00:00
parent 228121ae2d
commit 97f03369ec
2 changed files with 16 additions and 6 deletions

View File

@ -233,6 +233,10 @@ void CharsetRendererCommon::setCurID(byte id) {
_fontPtr += 17;
else
_fontPtr += 29;
//_bitDepth = _fontPtr[0];
_fontHeight = _fontPtr[1];
_numChars = READ_LE_UINT16(_fontPtr + 2);
}
void CharsetRendererV3::setCurID(byte id) {
@ -244,7 +248,10 @@ void CharsetRendererV3::setCurID(byte id) {
if (_fontPtr == 0)
error("CharsetRendererCommon::setCurID: charset %d not found!", id);
//_bitDepth = 1;
_numChars = _fontPtr[4];
_fontHeight = _fontPtr[5];
_fontPtr += 6;
_widthTable = _fontPtr;
_fontPtr += _numChars;
@ -252,16 +259,16 @@ void CharsetRendererV3::setCurID(byte id) {
int CharsetRendererCommon::getFontHeight() {
if (_vm->_useCJKMode)
return MAX(_vm->_2byteHeight + 1, (int)_fontPtr[1]);
return MAX(_vm->_2byteHeight + 1, _fontHeight);
else
return _fontPtr[1];
return _fontHeight;
}
int CharsetRendererV3::getFontHeight() {
if (_vm->_useCJKMode)
return MAX(_vm->_2byteHeight + 1, 8);
return MAX(_vm->_2byteHeight + 1, _fontHeight);
else
return 8;
return _fontHeight;
}
// do spacing for variable width old-style font
@ -1098,6 +1105,8 @@ static byte spanishCharsetDataV2[] = {
CharsetRendererV2::CharsetRendererV2(ScummEngine *vm, Common::Language language)
: CharsetRendererV3(vm) {
_fontHeight = 8;
switch (language) {
case Common::DE_DEU:
_fontPtr = germanCharsetDataV2;

View File

@ -114,11 +114,13 @@ public:
class CharsetRendererCommon : public CharsetRenderer {
protected:
byte *_fontPtr;
int _numChars;
int _fontHeight;
void drawBits1(const Graphics::Surface &s, byte *dst, const byte *src, int drawTop, int width, int height);
public:
CharsetRendererCommon(ScummEngine *vm) : CharsetRenderer(vm) {}
CharsetRendererCommon(ScummEngine *vm) : CharsetRenderer(vm), _numChars(0), _fontHeight(0) {}
void setCurID(byte id);
@ -157,7 +159,6 @@ public:
class CharsetRendererV3 : public CharsetRendererCommon {
protected:
int _numChars;
byte *_widthTable;
public: