[Scummvm-git-logs] scummvm master -> 7b24fb0b01b5b32d1e22e83139a9bfbd1bd5e02b

sev- sev at scummvm.org
Mon Jan 30 10:08:59 CET 2017


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:
b4a31646ff GRAPHICS: Added missing include
7b24fb0b01 GRAPHICS: Initial work on rich text formatting in MacText


Commit: b4a31646ffc543a8294010eae8dc6633d5693d98
    https://github.com/scummvm/scummvm/commit/b4a31646ffc543a8294010eae8dc6633d5693d98
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-01-30T10:10:07+01:00

Commit Message:
GRAPHICS: Added missing include

Changed paths:
    graphics/fonts/macfont.h


diff --git a/graphics/fonts/macfont.h b/graphics/fonts/macfont.h
index 33fb0fb..874d304 100644
--- a/graphics/fonts/macfont.h
+++ b/graphics/fonts/macfont.h
@@ -25,6 +25,7 @@
 
 #include "common/array.h"
 #include "common/hashmap.h"
+#include "common/stream.h"
 #include "graphics/font.h"
 
 namespace Graphics {


Commit: 7b24fb0b01b5b32d1e22e83139a9bfbd1bd5e02b
    https://github.com/scummvm/scummvm/commit/7b24fb0b01b5b32d1e22e83139a9bfbd1bd5e02b
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-01-30T10:10:22+01:00

Commit Message:
GRAPHICS: Initial work on rich text formatting in MacText

Changed paths:
    graphics/macgui/mactext.cpp
    graphics/macgui/mactext.h


diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp
index ae233d5..8d83c19 100644
--- a/graphics/macgui/mactext.cpp
+++ b/graphics/macgui/mactext.cpp
@@ -19,12 +19,25 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
+#include "graphics/macgui/macfontmanager.h"
 #include "graphics/macgui/mactext.h"
+#include "graphics/macgui/macwindowmanager.h"
 #include "graphics/font.h"
 
 namespace Graphics {
 
-MacText::MacText(Common::String s, MacWindowManager *wm, const Graphics::Font *font, int fgcolor, int bgcolor, int maxWidth, TextAlign textAlignment) {
+const Font *MacFontRun::getFont() {
+	if (font)
+		return font;
+
+	MacFont macFont = MacFont(fontId, fontSize, textSlant);
+
+	font = wm->_fontMan->getFont(macFont);
+
+	return font;
+}
+
+MacText::MacText(Common::String s, MacWindowManager *wm, const Font *font, int fgcolor, int bgcolor, int maxWidth, TextAlign textAlignment) {
 	_str = s;
 	_wm = wm;
 	_font = font;
@@ -40,6 +53,9 @@ MacText::MacText(Common::String s, MacWindowManager *wm, const Graphics::Font *f
 	splitString(_str);
 
 	_fullRefresh = true;
+
+	_defaultFormatting.font = font;
+	_defaultFormatting.wm = wm;
 }
 
 void MacText::splitString(Common::String &str) {
diff --git a/graphics/macgui/mactext.h b/graphics/macgui/mactext.h
index 0cef3fb..241ad65 100644
--- a/graphics/macgui/mactext.h
+++ b/graphics/macgui/mactext.h
@@ -30,7 +30,6 @@
 namespace Graphics {
 
 class MacWindowManager;
-class MacFont;
 
 struct MacFontRun {
 	uint16 fontId;
@@ -41,7 +40,43 @@ struct MacFontRun {
 	uint16 palinfo2;
 	uint16 palinfo3;
 
-	MacFont *font;
+	const Font *font;
+	MacWindowManager *wm;
+
+	MacFontRun() {
+		wm = nullptr;
+		fontId = textSlant = unk3f = fontSize;
+		palinfo1 = palinfo2  = palinfo3;
+		font = nullptr;
+	}
+
+	MacFontRun(MacWindowManager *wm_, uint16 fontId_, byte textSlant_, byte unk3f_, uint16 fontSize_,
+			uint16 palinfo1_, uint16 palinfo2_, uint16 palinfo3_) {
+		wm        = wm_;
+		fontId    = fontId_;
+		textSlant = textSlant_;
+		unk3f     = unk3f_;
+		fontSize  = fontSize_;
+		palinfo1  = palinfo1_;
+		palinfo2  = palinfo2_;
+		palinfo3  = palinfo3_;
+		font      = nullptr;
+	}
+
+	void setValues(MacWindowManager *wm_, uint16 fontId_, byte textSlant_, byte unk3f_, uint16 fontSize_,
+			uint16 palinfo1_, uint16 palinfo2_, uint16 palinfo3_, const Font *font_) {
+		wm        = wm_;
+		fontId    = fontId_;
+		textSlant = textSlant_;
+		unk3f     = unk3f_;
+		fontSize  = fontSize_;
+		palinfo1  = palinfo1_;
+		palinfo2  = palinfo2_;
+		palinfo3  = palinfo3_;
+		font      = font_;
+	}
+
+	const Font *getFont();
 };
 
 class MacText {
@@ -82,6 +117,9 @@ private:
 	bool _fullRefresh;
 
 	TextAlign _textAlignment;
+
+	Common::Array< Common::Array<MacFontRun> > _formatting;
+	MacFontRun _defaultFormatting;
 };
 
 } // End of namespace Graphics





More information about the Scummvm-git-logs mailing list