mirror of
https://github.com/scummvm/scummvm.git
synced 2026-06-20 05:45:29 +00:00
GLK: Don't leading & baseline for fonts go below minimum size
This commit is contained in:
committed by
Paul Gilbert
parent
3c2fd3e74f
commit
7cba554fc5
@@ -38,11 +38,14 @@ Fonts::Fonts(Graphics::ManagedSurface *surface) : _surface(surface), _fontsMissi
|
||||
if (!loadFonts())
|
||||
error("Could not load data file");
|
||||
|
||||
if (!g_conf->_leading)
|
||||
g_conf->_leading = g_conf->_propSize + 2;
|
||||
if (!g_conf->_baseLine)
|
||||
g_conf->_baseLine = g_conf->_propSize + 0.5;
|
||||
// TODO: See if there's any better way for getting the leading and baseline
|
||||
Common::Rect r1 = _fontTable[7]->getBoundingBox('o');
|
||||
Common::Rect r2 = _fontTable[7]->getBoundingBox('y');
|
||||
double baseLine = (double)r1.bottom;
|
||||
double leading = (double)r2.bottom + 2;
|
||||
|
||||
g_conf->_leading = MAX((double)g_conf->_leading, leading);
|
||||
g_conf->_baseLine = MAX((double)g_conf->_baseLine, baseLine);
|
||||
g_conf->_cellW = _fontTable[0]->getStringWidth("0");
|
||||
g_conf->_cellH = g_conf->_leading;
|
||||
}
|
||||
@@ -142,13 +145,11 @@ int Fonts::drawStringUni(const Point &pos, int fontIdx, const byte *rgb, const C
|
||||
}
|
||||
|
||||
size_t Fonts::stringWidth(int fontIdx, const Common::String &text, int spw) {
|
||||
// TODO: Handle spw
|
||||
const Graphics::Font *font = _fontTable[fontIdx];
|
||||
return font->getStringWidth(text) * GLI_SUBPIX;
|
||||
}
|
||||
|
||||
size_t Fonts::stringWidthUni(int fontIdx, const Common::U32String &text, int spw) {
|
||||
// TODO: Handle spw
|
||||
const Graphics::Font *font = _fontTable[fontIdx];
|
||||
return font->getStringWidth(text) * GLI_SUBPIX;
|
||||
}
|
||||
|
||||
@@ -98,19 +98,19 @@ public:
|
||||
* Get the width in pixels of a string
|
||||
* @param fontIdx Which font to use
|
||||
* @param text Text to get the width of
|
||||
* @param spw ???
|
||||
* @param spw Delta X
|
||||
* @returns Width of string multiplied by GLI_SUBPIX
|
||||
*/
|
||||
size_t stringWidth(int fontIdx, const Common::String &text, int spw = -1);
|
||||
size_t stringWidth(int fontIdx, const Common::String &text, int spw = 0);
|
||||
|
||||
/**
|
||||
* Get the width in pixels of a unicode string
|
||||
* @param fontIdx Which font to use
|
||||
* @param text Text to get the width of
|
||||
* @param spw ???
|
||||
* @param spw Delta X
|
||||
* @returns Width of string multiplied by GLI_SUBPIX
|
||||
*/
|
||||
size_t stringWidthUni(int fontIdx, const Common::U32String &text, int spw = -1);
|
||||
size_t stringWidthUni(int fontIdx, const Common::U32String &text, int spw = 0);
|
||||
};
|
||||
|
||||
} // End of namespace Gargoyle
|
||||
|
||||
Reference in New Issue
Block a user