[Scummvm-git-logs] scummvm master -> 6fc5c46539fc2ba9a02b0bc202a5d3ba119b3847

sev- noreply at scummvm.org
Sun May 12 13:27:12 UTC 2024


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:
5bd7b57282 GRAPHICS: MACGUI: Switch TTFMap to saner data structure not requiring global constructor
6fc5c46539 GUI: Disable the super-slow TTF font rendering in RichText


Commit: 5bd7b572825c4eeff744a53fbc6ce370c77bc50e
    https://github.com/scummvm/scummvm/commit/5bd7b572825c4eeff744a53fbc6ce370c77bc50e
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-05-12T15:23:30+02:00

Commit Message:
GRAPHICS: MACGUI: Switch TTFMap to saner data structure not requiring global constructor

Changed paths:
    graphics/macgui/macfontmanager.cpp
    graphics/macgui/macfontmanager.h
    gui/widgets/richtext.cpp


diff --git a/graphics/macgui/macfontmanager.cpp b/graphics/macgui/macfontmanager.cpp
index 2531dc607da..146860593e1 100644
--- a/graphics/macgui/macfontmanager.cpp
+++ b/graphics/macgui/macfontmanager.cpp
@@ -672,12 +672,12 @@ int MacFontManager::registerFontName(Common::String name, int preferredId) {
 	return id;
 }
 
-int MacFontManager::registerTTFFont(const Common::Array<TTFMap> &ttfList) {
+int MacFontManager::registerTTFFont(const TTFMap ttfList[]) {
 	int defaultValue = 1;
 	int realId = 100;
 	auto checkId = [&](int id) {
-		for (auto &&i : ttfList) {
-			if (_fontInfo.contains(id + i.slant)) {
+		for (const TTFMap *i = ttfList; i->ttfName; i++) {
+			if (_fontInfo.contains(id + i->slant)) {
 				return true;
 			}
 		}
@@ -687,9 +687,9 @@ int MacFontManager::registerTTFFont(const Common::Array<TTFMap> &ttfList) {
 	while (checkId(realId))
 		realId++;
 
-	for (auto &&i : ttfList) {
+	for (const TTFMap *i = ttfList; i->ttfName; i++) {
 		int id = realId;
-		Common::String name = i.ttfName;
+		Common::String name = i->ttfName;
 
 		if (name.empty()) {
 			if (defaultValue == 1)
@@ -705,7 +705,7 @@ int MacFontManager::registerTTFFont(const Common::Array<TTFMap> &ttfList) {
 
 		int slant = 0;
 
-		id += slant | i.slant;
+		id += slant | i->slant;
 
 		FontInfo *info = new FontInfo;
 		info->name = name;
diff --git a/graphics/macgui/macfontmanager.h b/graphics/macgui/macfontmanager.h
index 83c73def721..99e9c244c27 100644
--- a/graphics/macgui/macfontmanager.h
+++ b/graphics/macgui/macfontmanager.h
@@ -179,7 +179,7 @@ public:
 
 	void printFontRegistry(int debugLevel, uint32 channel);
 
-	int registerTTFFont(const Common::Array<Graphics::TTFMap> &ttfList);
+	int registerTTFFont(const Graphics::TTFMap ttfList[]);
 
 	int getFamilyId(int newId, int newSlant);
 
diff --git a/gui/widgets/richtext.cpp b/gui/widgets/richtext.cpp
index 48f1a536e5a..12989daa574 100644
--- a/gui/widgets/richtext.cpp
+++ b/gui/widgets/richtext.cpp
@@ -34,11 +34,12 @@
 
 namespace GUI {
 
-Common::Array<Graphics::TTFMap> ttfFamily = {
+const Graphics::TTFMap ttfFamily[] = {
 	{"NotoSans-Regular.ttf", Graphics::kMacFontRegular},
 	{"NotoSans-Bold.ttf", Graphics::kMacFontBold},
 	{"NotoSerif-Italic.ttf", Graphics::kMacFontItalic},
 	{"NotoSerif-Bold-Italic.ttf", Graphics::kMacFontBold | Graphics::kMacFontItalic},
+	{nullptr, 0}
 };
 
 RichTextWidget::RichTextWidget(GuiObject *boss, int x, int y, int w, int h, bool scale, const Common::U32String &text, const Common::U32String &tooltip)


Commit: 6fc5c46539fc2ba9a02b0bc202a5d3ba119b3847
    https://github.com/scummvm/scummvm/commit/6fc5c46539fc2ba9a02b0bc202a5d3ba119b3847
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-05-12T15:26:33+02:00

Commit Message:
GUI: Disable the super-slow TTF font rendering in RichText

It requires proper font caching

Changed paths:
    gui/widgets/richtext.cpp


diff --git a/gui/widgets/richtext.cpp b/gui/widgets/richtext.cpp
index 12989daa574..3e388448f71 100644
--- a/gui/widgets/richtext.cpp
+++ b/gui/widgets/richtext.cpp
@@ -197,8 +197,13 @@ void RichTextWidget::createWidget() {
 
 	const int fontHeight = g_gui.xmlEval()->getVar("Globals.Font.Height", 25);
 
+#if 1
+	Graphics::MacFont macFont(Graphics::kMacFontNewYork, fontHeight, Graphics::kMacFontRegular);
+	(void)ttfFamily;
+#else
 	int newId = wm->_fontMan->registerTTFFont(ttfFamily);
 	Graphics::MacFont macFont(newId, fontHeight, Graphics::kMacFontRegular);
+#endif
 
 	_txtWnd = new Graphics::MacText(Common::U32String(), wm, &macFont, fg, bg, _textWidth, Graphics::kTextAlignLeft);
 




More information about the Scummvm-git-logs mailing list