aboutsummaryrefslogtreecommitdiff
path: root/engines/gargoyle/fonts.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/gargoyle/fonts.cpp')
-rw-r--r--engines/gargoyle/fonts.cpp31
1 files changed, 19 insertions, 12 deletions
diff --git a/engines/gargoyle/fonts.cpp b/engines/gargoyle/fonts.cpp
index 41b2f655ff..45f8671157 100644
--- a/engines/gargoyle/fonts.cpp
+++ b/engines/gargoyle/fonts.cpp
@@ -103,24 +103,31 @@ Graphics::Font *Fonts::loadFont(FACES face, double size, double aspect, int styl
return Graphics::loadTTFFont(f, size, Graphics::kTTFSizeModeCharacter);
}
-int Fonts::drawString(int x, int y, int fidx, const byte *rgb, const char *s, int n, int spw) {
- // TODO
- return 0;
+int Fonts::drawString(const Common::Point &pos, int fontIdx, const byte *rgb, const Common::String &text, int spw) {
+ Graphics::Font *font = _fontTable[fontIdx];
+ const uint32 color = _surface->format.RGBToColor(rgb[0], rgb[1], rgb[2]);
+ font->drawString(_surface, text, pos.x, pos.y, _surface->w - pos.x, color);
+ return font->getBoundingBox(text, pos.x, pos.y, _surface->w - pos.x).right;
}
-int Fonts::drawStringUni(int x, int y, int fidx, const byte *rgb, const uint32 *s, int n, int spw) {
- // TODO
- return 0;
+int Fonts::drawStringUni(const Common::Point &pos, int fontIdx, const byte *rgb, const Common::U32String &text, int spw) {
+ Graphics::Font *font = _fontTable[fontIdx];
+ const uint32 color = _surface->format.RGBToColor(rgb[0], rgb[1], rgb[2]);
+ font->drawString(_surface, text, pos.x, pos.y, _surface->w - pos.x, color);
+
+ return font->getBoundingBox(text, pos.x, pos.y, _surface->w - pos.x).right;
}
-int Fonts::stringWidth(int fidx, const char *s, int n, int spw) {
- // TODO
- return 0;
+size_t Fonts::stringWidth(int fontIdx, const Common::String &text, int spw) {
+ // TODO: Handle spw
+ Graphics::Font *font = _fontTable[fontIdx];
+ return font->getStringWidth(text);
}
-int Fonts::stringWidthUni(int fidx, const uint32 *s, int n, int spw) {
- // TODO
- return 0;
+size_t Fonts::stringWidthUni(int fontIdx, const Common::U32String &text, int spw) {
+ // TODO: Handle spw
+ Graphics::Font *font = _fontTable[fontIdx];
+ return font->getStringWidth(text);
}
} // End of namespace Gargoyle