[Scummvm-git-logs] scummvm master -> 745cffae809729d3ede682c00fb5bb0bb1513e02
Scorpeg
noreply at scummvm.org
Sun Oct 4 15:02:01 UTC 2026
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
745cffae80 VIDEO: Add overridable subtitle text drawing callback
Commit: 745cffae809729d3ede682c00fb5bb0bb1513e02
https://github.com/scummvm/scummvm/commit/745cffae809729d3ede682c00fb5bb0bb1513e02
Author: Scorp (scorp at mrs.mn)
Date: 2026-10-04T18:01:53+03:00
Commit Message:
VIDEO: Add overridable subtitle text drawing callback
Changed paths:
video/subtitles.cpp
video/subtitles.h
diff --git a/video/subtitles.cpp b/video/subtitles.cpp
index 1266b03b399..1a843641214 100644
--- a/video/subtitles.cpp
+++ b/video/subtitles.cpp
@@ -616,11 +616,7 @@ void Subtitles::renderSubtitle() const {
Common::U32String u32_text = convertBiDiU32String(part.text).visual;
- font->drawString(&_surface, u32_text, part.left, currentY, partWidth, _blackColor, Graphics::kTextAlignLeft);
- font->drawString(&_surface, u32_text, part.left + SHADOW * 2, currentY, partWidth, _blackColor, Graphics::kTextAlignLeft);
- font->drawString(&_surface, u32_text, part.left, currentY + SHADOW * 2, partWidth, _blackColor, Graphics::kTextAlignLeft);
- font->drawString(&_surface, u32_text, part.left + SHADOW * 2, currentY + SHADOW * 2, partWidth, _blackColor, Graphics::kTextAlignLeft);
- font->drawString(&_surface, u32_text, part.left + SHADOW, currentY + SHADOW, partWidth, _color, Graphics::kTextAlignLeft);
+ drawSubtitleText(*font, u32_text, part.left, currentY, partWidth);
}
@@ -633,4 +629,12 @@ void Subtitles::renderSubtitle() const {
_drawRect.clip(_realBBox.width(), _realBBox.height());
}
+void Subtitles::drawSubtitleText(const Graphics::Font &font, const Common::U32String &text, int x, int y, int width) const {
+ font.drawString(&_surface, text, x, y, width, _blackColor, Graphics::kTextAlignLeft);
+ font.drawString(&_surface, text, x + SHADOW * 2, y, width, _blackColor, Graphics::kTextAlignLeft);
+ font.drawString(&_surface, text, x, y + SHADOW * 2, width, _blackColor, Graphics::kTextAlignLeft);
+ font.drawString(&_surface, text, x + SHADOW * 2, y + SHADOW * 2, width, _blackColor, Graphics::kTextAlignLeft);
+ font.drawString(&_surface, text, x + SHADOW, y + SHADOW, width, _color, Graphics::kTextAlignLeft);
+}
+
} // End of namespace Video
diff --git a/video/subtitles.h b/video/subtitles.h
index c47d162c445..6e9dbf38678 100644
--- a/video/subtitles.h
+++ b/video/subtitles.h
@@ -103,6 +103,7 @@ public:
protected:
bool recalculateBoundingBox() const;
void renderSubtitle() const;
+ virtual void drawSubtitleText(const Graphics::Font &font, const Common::U32String &text, int x, int y, int width) const;
void translateBBox(int16 dx, int16 dy) const { _realBBox.translate(dx, dy); }
virtual void updateSubtitleOverlay() const;
virtual bool shouldShowSubtitle() const { return true; }
More information about the Scummvm-git-logs
mailing list