[Scummvm-git-logs] scummvm master -> 5cccda674cb7a7cf342f518d86b629c8c58699c5
neuromancer
noreply at scummvm.org
Mon Aug 18 18:43:19 UTC 2025
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:
5cccda674c PRIVATE: automatic resize of subtitles
Commit: 5cccda674cb7a7cf342f518d86b629c8c58699c5
https://github.com/scummvm/scummvm/commit/5cccda674cb7a7cf342f518d86b629c8c58699c5
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2025-08-18T20:42:33+02:00
Commit Message:
PRIVATE: automatic resize of subtitles
Changed paths:
engines/private/private.cpp
engines/private/private.h
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 89c77bf1b82..df61fda48c0 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -301,6 +301,9 @@ Common::Error PrivateEngine::run() {
}
break;
+ case Common::EVENT_SCREEN_CHANGED:
+ adjustSubtitleSize();
+ break;
case Common::EVENT_QUIT:
case Common::EVENT_RETURN_TO_LAUNCHER:
break;
@@ -420,7 +423,7 @@ Common::Error PrivateEngine::run() {
g_system->delayMillis(10);
if (_subtitles) {
if (_mixer->isSoundHandleActive(_fgSoundHandle)) {
- _subtitles->drawSubtitle(_mixer->getElapsedTime(_fgSoundHandle).msecs(), false);
+ _subtitles->drawSubtitle(_mixer->getElapsedTime(_fgSoundHandle).msecs(), false, _sfxSubtitles);
} else {
delete _subtitles;
_subtitles = nullptr;
@@ -1487,6 +1490,27 @@ bool PrivateEngine::isSoundActive() {
return _mixer->isSoundIDActive(-1);
}
+void PrivateEngine::adjustSubtitleSize() {
+ debugC(1, kPrivateDebugFunction, "%s()", __FUNCTION__);
+ if (_subtitles) {
+ int16 h = g_system->getOverlayHeight();
+ int16 w = g_system->getOverlayWidth();
+ float scale = h / 2160.f;
+ // If we are in the main menu, we need to adjust the position of the subtitles
+ if (_mode == 0) {
+ _subtitles->setBBox(Common::Rect(20, h - 200 * scale, w - 20, h - 20));
+ } else if (_mode == -1) {
+ _subtitles->setBBox(Common::Rect(20, h - 220 * scale, w - 20, h - 20));
+ } else {
+ _subtitles->setBBox(Common::Rect(20, h - 160 * scale, w - 20, h - 20));
+ }
+ int fontSize = MAX(8, int(50 * scale));
+ _subtitles->setColor(0xff, 0xff, 0x80);
+ _subtitles->setFont("NotoSerif-Regular.ttf", fontSize, "regular");
+ _subtitles->setFont("NotoSerif-Italic.ttf", fontSize, "italic");
+ }
+}
+
void PrivateEngine::loadSubtitles(const Common::Path &path) {
debugC(1, kPrivateDebugFunction, "%s(%s)", __FUNCTION__, path.toString().c_str());
Common::String subPathStr = path.toString() + ".srt";
@@ -1504,20 +1528,7 @@ void PrivateEngine::loadSubtitles(const Common::Path &path) {
_subtitles = new Video::Subtitles();
_subtitles->loadSRTFile(subPath);
g_system->showOverlay(false);
- int16 h = g_system->getOverlayHeight();
- float scale = h / 2160.f;
- // If we are in the main menu, we need to adjust the position of the subtitles
- if (_mode == 0) {
- _subtitles->setBBox(Common::Rect(20, h - 200 * scale, g_system->getOverlayWidth() - 20, h - 20));
- } else if (_mode == -1) {
- _subtitles->setBBox(Common::Rect(20, h - 220 * scale, g_system->getOverlayWidth() - 20, h - 20));
- } else {
- _subtitles->setBBox(Common::Rect(20, h - 160 * scale, g_system->getOverlayWidth() - 20, h - 20));
- }
- int fontSize = MAX(8, int(50 * scale));
- _subtitles->setColor(0xff, 0xff, 0x80);
- _subtitles->setFont("LiberationSans-Regular.ttf", fontSize, "regular");
- _subtitles->setFont("NotoSerif-Italic.ttf", fontSize, "italic");
+ adjustSubtitleSize();
} else {
delete _subtitles;
_subtitles = nullptr;
diff --git a/engines/private/private.h b/engines/private/private.h
index 7cf35e0fe98..c5051ded855 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -220,6 +220,7 @@ public:
void skipVideo();
void loadSubtitles(const Common::Path &path);
+ void adjustSubtitleSize();
Video::Subtitles *_subtitles;
bool _sfxSubtitles;
More information about the Scummvm-git-logs
mailing list