mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-19 08:25:35 +00:00
Renaming FontDesc::extraData to charWidths
svn-id: r42149
This commit is contained in:
parent
62fcf1177d
commit
d6c99ae861
@ -360,9 +360,9 @@ int Draw::stringLength(const char *str, int16 fontIndex) {
|
||||
|
||||
} else {
|
||||
|
||||
if (_fonts[fontIndex]->extraData)
|
||||
if (_fonts[fontIndex]->charWidths)
|
||||
while (*str != 0)
|
||||
len += *(_fonts[fontIndex]->extraData + (*str++ - _fonts[fontIndex]->startItem));
|
||||
len += *(_fonts[fontIndex]->charWidths + (*str++ - _fonts[fontIndex]->startItem));
|
||||
else
|
||||
len = (strlen(str) * _fonts[fontIndex]->itemWidth);
|
||||
|
||||
@ -376,10 +376,10 @@ void Draw::drawString(const char *str, int16 x, int16 y, int16 color1, int16 col
|
||||
|
||||
while (*str != '\0') {
|
||||
_vm->_video->drawLetter(*str, x, y, font, transp, color1, color2, dest);
|
||||
if (!font->extraData)
|
||||
if (!font->charWidths)
|
||||
x += font->itemWidth;
|
||||
else
|
||||
x += *(font->extraData + (*str - font->startItem));
|
||||
x += *(font->charWidths + (*str - font->startItem));
|
||||
str++;
|
||||
}
|
||||
}
|
||||
@ -415,12 +415,12 @@ void Draw::printTextCentered(int16 id, int16 left, int16 top, int16 right,
|
||||
_fontIndex = fontIndex;
|
||||
_frontColor = color;
|
||||
_textToPrint = str;
|
||||
if (_fonts[fontIndex]->extraData != 0) {
|
||||
byte *data = _fonts[fontIndex]->extraData;
|
||||
if (_fonts[fontIndex]->charWidths != 0) {
|
||||
uint8 *widths = _fonts[fontIndex]->charWidths;
|
||||
int length = strlen(str);
|
||||
|
||||
for (int i = 0; i < length; i++)
|
||||
width += *(data + (str[i] - _fonts[_fontIndex]->startItem));
|
||||
width += *(widths + (str[i] - _fonts[_fontIndex]->startItem));
|
||||
}
|
||||
else
|
||||
width = strlen(str) * _fonts[fontIndex]->itemWidth;
|
||||
|
@ -762,7 +762,7 @@ void Draw_v2::spriteOperation(int16 operation) {
|
||||
|
||||
if ((_fontIndex >= 4) || (_fontToSprite[_fontIndex].sprite == -1)) {
|
||||
|
||||
if (!_fonts[_fontIndex]->extraData) {
|
||||
if (!_fonts[_fontIndex]->charWidths) {
|
||||
if (((int8) _textToPrint[0]) == -1) {
|
||||
_vm->validateLanguage();
|
||||
|
||||
@ -785,7 +785,7 @@ void Draw_v2::spriteOperation(int16 operation) {
|
||||
_vm->_video->drawLetter(_textToPrint[i], _destSpriteX,
|
||||
_destSpriteY, _fonts[_fontIndex], _transparency,
|
||||
_frontColor, _backColor, *_spritesArray[_destSurface]);
|
||||
_destSpriteX += *(_fonts[_fontIndex]->extraData +
|
||||
_destSpriteX += *(_fonts[_fontIndex]->charWidths +
|
||||
(_textToPrint[i] - _fonts[_fontIndex]->startItem));
|
||||
}
|
||||
else
|
||||
|
@ -713,7 +713,7 @@ void Hotspots::getTextCursorPos(const Video::FontDesc &font, const char *str,
|
||||
uint32 pos, uint16 x, uint16 y, uint16 width, uint16 height,
|
||||
uint16 &cursorX, uint16 &cursorY, uint16 &cursorWidth, uint16 &cursorHeight) const {
|
||||
|
||||
if (font.extraData) {
|
||||
if (font.charWidths) {
|
||||
// Cursor to the right of the current character
|
||||
|
||||
cursorX = x;
|
||||
@ -722,7 +722,7 @@ void Hotspots::getTextCursorPos(const Video::FontDesc &font, const char *str,
|
||||
cursorHeight = height;
|
||||
|
||||
for (uint32 i = 0; i < pos; i++)
|
||||
cursorX += font.extraData[str[i] - font.startItem];
|
||||
cursorX += font.charWidths[str[i] - font.startItem];
|
||||
|
||||
} else {
|
||||
// Cursor underlining the current character
|
||||
@ -748,7 +748,7 @@ uint16 Hotspots::readString(uint16 xPos, uint16 yPos, uint16 width, uint16 heigh
|
||||
|
||||
const Video::FontDesc &font = *_vm->_draw->_fonts[fontIndex];
|
||||
|
||||
bool monoSpaced = (font.extraData == 0);
|
||||
bool monoSpaced = (font.charWidths == 0);
|
||||
|
||||
uint32 pos = strlen(str);
|
||||
uint32 editSize = monoSpaced ? (width / font.itemWidth) : 0;
|
||||
@ -925,8 +925,8 @@ uint16 Hotspots::readString(uint16 xPos, uint16 yPos, uint16 width, uint16 heigh
|
||||
if ((key >= ' ') && (key <= 0xFF)) {
|
||||
if (editSize == 0) {
|
||||
int length = _vm->_draw->stringLength(str, fontIndex) +
|
||||
font.extraData[' ' - font.startItem] +
|
||||
font.extraData[key - font.startItem];
|
||||
font.charWidths[' ' - font.startItem] +
|
||||
font.charWidths[key - font.startItem];
|
||||
|
||||
if (length > width)
|
||||
continue;
|
||||
@ -1258,7 +1258,7 @@ void Hotspots::evaluateNew(uint16 i, uint16 *ids, InputDesc *inputs,
|
||||
}
|
||||
|
||||
font = _vm->_draw->_fonts[inputs[inputCount].fontIndex];
|
||||
if (!font->extraData)
|
||||
if (!font->charWidths)
|
||||
right = left + width * font->itemWidth - 1;
|
||||
|
||||
funcEnter = 0;
|
||||
|
@ -403,10 +403,10 @@ Video::FontDesc *Util::loadFont(const char *path) {
|
||||
fontDesc->bitWidth = fontDesc->itemWidth;
|
||||
|
||||
if (data[0] & 0x80)
|
||||
fontDesc->extraData = data + 4 + fontDesc->itemSize *
|
||||
fontDesc->charWidths = data + 4 + fontDesc->itemSize *
|
||||
(fontDesc->endItem - fontDesc->startItem + 1);
|
||||
else
|
||||
fontDesc->extraData = 0;
|
||||
fontDesc->charWidths = 0;
|
||||
|
||||
return fontDesc;
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ public:
|
||||
uint8 endItem;
|
||||
int8 itemSize;
|
||||
int8 bitWidth;
|
||||
byte *extraData;
|
||||
uint8 *charWidths;
|
||||
FontDesc() : dataPtr(0), itemWidth(0), itemHeight(0), startItem(0),
|
||||
endItem(0), itemSize(0), bitWidth(0) {}
|
||||
~FontDesc() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user