[Scummvm-cvs-logs] CVS: scummvm/gui font.cpp,1.2,1.3 font.h,1.4,1.5 newgui.cpp,1.81,1.82

Max Horn fingolfin at users.sourceforge.net
Mon Mar 15 10:56:04 CET 2004


Update of /cvsroot/scummvm/scummvm/gui
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1932

Modified Files:
	font.cpp font.h newgui.cpp 
Log Message:
cleanup; added a TODO to Font class

Index: font.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/font.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- font.cpp	13 Mar 2004 13:03:25 -0000	1.2
+++ font.cpp	15 Mar 2004 18:44:14 -0000	1.3
@@ -71,6 +71,9 @@
 }
 
 
+#pragma mark -
+
+
 int Font::getStringWidth(const Common::String &str) const {
 	int space = 0;
 

Index: font.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/font.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- font.h	13 Mar 2004 13:22:14 -0000	1.4
+++ font.h	15 Mar 2004 18:44:14 -0000	1.5
@@ -46,6 +46,19 @@
 	Surface() : pixels(0), w(0), h(0), pitch(0), bytesPerPixel(0) {}
 };
 
+/**
+ * Instances of this class represent a distinct font, with a built-in renderer.
+ * @todo Maybe move the high-level methods (drawString etc.) to a separate 
+ *       FontRenderer class? That way, we could have different variants... ?
+ * @todo Add more parameters to drawString, or additional similar methods,
+ *       featuring abilities like
+ *       - rendering with wrap-around instead of inserting an ellipsis or
+ *         cutting them; needs a 'height' parameter
+ *       - rendering multi-line strings (essentially, invoke the regular
+ *         drawString for each line, and advance one line)
+ *       - combinations of the two above: honor line feeds, and also wrap
+ *         overlong lines
+ */
 class Font {
 public:
 	virtual int getFontHeight() const = 0;

Index: newgui.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/newgui.cpp,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -d -r1.81 -r1.82
--- newgui.cpp	13 Mar 2004 13:22:14 -0000	1.81
+++ newgui.cpp	15 Mar 2004 18:44:14 -0000	1.82
@@ -363,11 +363,7 @@
 }
 
 int NewGui::getStringWidth(const String &str) {
-	int space = 0;
-
-	for (uint i = 0; i < str.size(); ++i)
-		space += getCharWidth(str[i]);
-	return space;
+	return g_guifont.getStringWidth(str);
 }
 
 int NewGui::getCharWidth(byte c) {





More information about the Scummvm-git-logs mailing list