[Scummvm-git-logs] scummvm master -> fece6ea40fa539a9900fad91aee65406a7d956b5

criezy criezy at scummvm.org
Wed Apr 7 23:46:45 UTC 2021


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
57710b9648 AGS: Respect the game ANTIALIASFONTS options for TTS rendering
fece6ea40f AGS: Add option to force using antialiasing for text rendering


Commit: 57710b9648b0e556e85ea1c07c77e46c60706548
    https://github.com/scummvm/scummvm/commit/57710b9648b0e556e85ea1c07c77e46c60706548
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2021-04-08T00:45:46+01:00

Commit Message:
AGS: Respect the game ANTIALIASFONTS options for TTS rendering

Changed paths:
    engines/ags/lib/alfont/alfont.cpp


diff --git a/engines/ags/lib/alfont/alfont.cpp b/engines/ags/lib/alfont/alfont.cpp
index ecbeccdf37..19dfe53c0e 100644
--- a/engines/ags/lib/alfont/alfont.cpp
+++ b/engines/ags/lib/alfont/alfont.cpp
@@ -21,6 +21,9 @@
  */
 
 #include "ags/lib/alfont/alfont.h"
+#include "ags/ags.h"
+#include "ags/globals.h"
+#include "ags/shared/ac/gamesetupstruct.h"
 #include "common/file.h"
 #include "graphics/fonts/ttf.h"
 
@@ -30,7 +33,10 @@ Graphics::Font *ALFONT_FONT::getFont() {
 #ifdef USE_FREETYPE2
 	if (!_fonts.contains(_size)) {
 		// Instantiate the raw TTF data into a font of the given size
-		_fonts[_size] = Graphics::loadTTFFont(_ttfData, _size);
+		Graphics::TTFRenderMode renderMode = Graphics::kTTFRenderModeMonochrome;
+		if (_GP(game).options[OPT_ANTIALIASFONTS] != 0)
+			renderMode = Graphics::kTTFRenderModeLight;
+		_fonts[_size] = Graphics::loadTTFFont(_ttfData, _size, Graphics::kTTFSizeModeCharacter, 0, renderMode);
 		assert(_fonts[_size]);
 	}
 


Commit: fece6ea40fa539a9900fad91aee65406a7d956b5
    https://github.com/scummvm/scummvm/commit/fece6ea40fa539a9900fad91aee65406a7d956b5
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2021-04-08T00:45:46+01:00

Commit Message:
AGS: Add option to force using antialiasing for text rendering

Changed paths:
    engines/ags/ags.cpp
    engines/ags/ags.h
    engines/ags/detection.cpp
    engines/ags/engine/ac/display.cpp
    engines/ags/lib/alfont/alfont.cpp


diff --git a/engines/ags/ags.cpp b/engines/ags/ags.cpp
index 09f94dec68..3b20163f19 100644
--- a/engines/ags/ags.cpp
+++ b/engines/ags/ags.cpp
@@ -31,6 +31,7 @@
 #include "common/debug-channels.h"
 #include "common/events.h"
 #include "common/file.h"
+#include "common/util.h"
 #include "engines/util.h"
 
 #include "ags/shared/core/platform.h"
@@ -70,7 +71,7 @@ AGSEngine *g_vm;
 AGSEngine::AGSEngine(OSystem *syst, const AGSGameDescription *gameDesc) : Engine(syst),
 		_gameDescription(gameDesc), _randomSource("AGS"), _events(nullptr), _music(nullptr),
 		_rawScreen(nullptr), _screen(nullptr), _gfxDriver(nullptr),
-		_globals(nullptr) {
+		_globals(nullptr), _forceTextAA(false) {
 	g_vm = this;
 	DebugMan.addDebugChannel(kDebugGraphics, "Graphics", "Graphics debug level");
 	DebugMan.addDebugChannel(kDebugPath, "Path", "Pathfinding debug level");
@@ -80,6 +81,10 @@ AGSEngine::AGSEngine(OSystem *syst, const AGSGameDescription *gameDesc) : Engine
 	_events = new EventsManager();
 	_music = new Music(_mixer);
 	_globals = new ::AGS3::Globals();
+
+	Common::String forceAA;
+	if (ConfMan.getActiveDomain()->tryGetVal("force_text_aa", forceAA))
+		Common::parseBool(forceAA, _forceTextAA);
 }
 
 AGSEngine::~AGSEngine() {
diff --git a/engines/ags/ags.h b/engines/ags/ags.h
index 146304d3bf..8ddf4931e5 100644
--- a/engines/ags/ags.h
+++ b/engines/ags/ags.h
@@ -72,6 +72,7 @@ public:
 	::AGS3::AGS::Engine::Mutex _soundCacheMutex;
 	::AGS3::AGS::Engine::Mutex _mp3Mutex;
 	::AGS3::Globals *_globals;
+	bool _forceTextAA;
 protected:
 	// Engine APIs
 	Common::Error run() override;
diff --git a/engines/ags/detection.cpp b/engines/ags/detection.cpp
index c33b4c2023..8bade67155 100644
--- a/engines/ags/detection.cpp
+++ b/engines/ags/detection.cpp
@@ -26,6 +26,7 @@
 #include "common/md5.h"
 #include "common/str-array.h"
 #include "common/translation.h"
+#include "common/util.h"
 #include "ags/detection.h"
 #include "ags/detection_tables.h"
 
@@ -78,11 +79,14 @@ private:
 
 	GUI::PopUpWidget *_langPopUp;
 	Common::StringArray _traFileNames;
+
+	GUI::CheckboxWidget *_forceTextAACheckbox;
 };
 
 AGSOptionsWidget::AGSOptionsWidget(GuiObject *boss, const Common::String &name, const Common::String &domain) :
 		OptionsContainerWidget(boss, name, "AGSGameOptionsDialog", false, domain) {
-			
+
+	// Language
 	GUI::StaticTextWidget *textWidget = new GUI::StaticTextWidget(widgetsBoss(), _dialogLayout + ".translation_desc", _("Game language:"), _("Language to use for multilingual games"));
 	textWidget->setAlign(Graphics::kTextAlignRight);
 			
@@ -101,6 +105,9 @@ AGSOptionsWidget::AGSOptionsWidget(GuiObject *boss, const Common::String &name,
 		_traFileNames.push_back(traFileName);
 		_langPopUp->appendEntry(traFileName, i++);
 	}
+
+	// Force font antialiasing
+	_forceTextAACheckbox = new GUI::CheckboxWidget(widgetsBoss(), _dialogLayout + ".textAA", _("Force antialiased text"), _("Use antialiasing to draw text even if the game does not ask for it"));
 }
 
 void AGSOptionsWidget::defineLayout(GUI::ThemeEval &layouts, const Common::String &layoutName, const Common::String &overlayedLayout) const {
@@ -111,6 +118,8 @@ void AGSOptionsWidget::defineLayout(GUI::ThemeEval &layouts, const Common::Strin
 	layouts.addWidget("translation_desc", "OptionsLabel");
 	layouts.addWidget("translation", "PopUp").closeLayout();
 
+	layouts.addWidget("textAA", "Checkbox");
+
 	layouts.closeLayout().closeDialog();
 }
 
@@ -131,6 +140,14 @@ void AGSOptionsWidget::load() {
 		}
 	}
 	_langPopUp->setSelectedTag(curLangIndex);
+
+	Common::String forceTextAA;
+	gameConfig->tryGetVal("force_text_aa", forceTextAA);
+	if (!forceTextAA.empty()) {
+		bool val;
+		if (parseBool(forceTextAA, val))
+			_forceTextAACheckbox->setState(val);
+	}
 }
 
 bool AGSOptionsWidget::save() {
@@ -140,6 +157,8 @@ bool AGSOptionsWidget::save() {
 	else
 		ConfMan.removeKey("translation", _domain);
 
+	ConfMan.setBool("force_text_aa", _forceTextAACheckbox->getState(), _domain);
+
 	return true;
 }
 
diff --git a/engines/ags/engine/ac/display.cpp b/engines/ags/engine/ac/display.cpp
index d12350af0d..a1ff2d1e1d 100644
--- a/engines/ags/engine/ac/display.cpp
+++ b/engines/ags/engine/ac/display.cpp
@@ -416,7 +416,7 @@ int GetTextDisplayTime(const char *text, int canberel) {
 }
 
 bool ShouldAntiAliasText() {
-	return (_GP(game).options[OPT_ANTIALIASFONTS] != 0);
+	return (_GP(game).options[OPT_ANTIALIASFONTS] != 0 || ::AGS::g_vm->_forceTextAA);
 }
 
 // Draw an outline if requested, then draw the text on top
diff --git a/engines/ags/lib/alfont/alfont.cpp b/engines/ags/lib/alfont/alfont.cpp
index 19dfe53c0e..c0aba2dac6 100644
--- a/engines/ags/lib/alfont/alfont.cpp
+++ b/engines/ags/lib/alfont/alfont.cpp
@@ -34,7 +34,7 @@ Graphics::Font *ALFONT_FONT::getFont() {
 	if (!_fonts.contains(_size)) {
 		// Instantiate the raw TTF data into a font of the given size
 		Graphics::TTFRenderMode renderMode = Graphics::kTTFRenderModeMonochrome;
-		if (_GP(game).options[OPT_ANTIALIASFONTS] != 0)
+		if (_GP(game).options[OPT_ANTIALIASFONTS] != 0 || ::AGS::g_vm->_forceTextAA)
 			renderMode = Graphics::kTTFRenderModeLight;
 		_fonts[_size] = Graphics::loadTTFFont(_ttfData, _size, Graphics::kTTFSizeModeCharacter, 0, renderMode);
 		assert(_fonts[_size]);




More information about the Scummvm-git-logs mailing list