Index: debian/control
===================================================================
--- debian/control	(revision 2375)
+++ debian/control	(working copy)
@@ -8,7 +8,7 @@
 
 Package: warzone2100
 Architecture: any
-Depends: warzone2100-data (= ${Source-Version}), ${shlibs:Depends}
+Depends: warzone2100-data (= ${Source-Version}), ${shlibs:Depends}, ttf-dejavu
 Description: Post-nuclear 3D real-time strategy game
  Warzone 2100 was an innovative 3D real-time strategy game back in
  1999, and most will agree it didn't enjoy the commercial success it
Index: lib/ivis_common/textdraw.h
===================================================================
--- lib/ivis_common/textdraw.h	(revision 2375)
+++ lib/ivis_common/textdraw.h	(working copy)
@@ -21,7 +21,9 @@
 #define _INCLUDED_TEXTDRAW_
 
 #include "ivisdef.h"
+#include "lib/framework/utf8.h"
 
+
 #define PIE_TEXT_WHITE				(-1)
 #define PIE_TEXT_LIGHTBLUE			(-2)
 #define PIE_TEXT_DARKBLUE			(-3)
@@ -32,14 +34,40 @@
 extern int iV_GetTextAboveBase(void);
 extern int iV_GetTextBelowBase(void);
 extern int iV_GetTextLineSize(void);
-extern unsigned int iV_GetTextWidth(const char* String);
+//extern unsigned int iV_GetTextWidth(const char* String);
 extern unsigned int iV_GetCharWidth(char Char);
+extern unsigned int iV_GetTextWidth2(const utf_32_char* string);
+#define iV_GetTextWidth iV_GetTextWidth2
+#if 0
+static inline unsigned int iV_GetTextWidth(const char* string)
+{
+	unsigned int width;
+	utf_32_char* utf_32_string = utf8_decode(string);
+	width = iV_GetTextWidth2(utf_32_string);
+	free(utf_32_string);
+
+	return width;
+}
+#endif
+
+extern unsigned int iV_GetTextHeight(const utf_32_char* string);
 extern void iV_SetTextColour(SWORD Index);
 
 #define ASCII_SPACE			(32)
 #define ASCII_NEWLINE		('@')
 #define ASCII_COLOURMODE	('#')
 
+#define TEXT_UTF8_SPACE       " "
+#define TEXT_UTF8_NEWLINE     "\n"
+#define TEXT_UTF8_COLOUR_MODE "Ã¾Â?Â?Â?Â?Â?Â?"
+static const utf_32_char text_space = 0x20;
+static const utf_32_char text_newline = 0xa;
+static const utf_32_char text_colour_mode = 0x80000000;
+
+static const char text_space_utf8[] = TEXT_UTF8_SPACE;
+static const char text_newline_utf8[] = TEXT_UTF8_NEWLINE;
+static const char text_colour_mode_utf8[] = TEXT_UTF8_COLOUR_MODE;
+
 // Valid values for "Justify" argument of iV_DrawFormattedText().
 
 enum {
@@ -51,7 +79,25 @@
 
 extern UDWORD iV_DrawFormattedText(const char* String, UDWORD x, UDWORD y, UDWORD Width, UDWORD Justify);
 
-extern void iV_DrawText(const char* string, UDWORD x, UDWORD y);
-extern void iV_DrawTextRotated(const char* string, unsigned int XPos, unsigned int YPos, float rotation);
+//extern void iV_DrawText(const utf_32_char* string, UDWORD x, UDWORD y);
+extern void iV_DrawTextRotated(const utf_32_char* string, float XPos, float YPos, float rotation);
+extern void iV_SetTextSize(float size);
 
+static inline void iV_DrawText(const utf_32_char* string, float x, float y)
+{
+	iV_DrawTextRotated(string, x, y, 0.f);
+}
+
+static inline void iV_DrawTextRotated_utf8(const char* string, float x, float y, float rotation)
+{
+	utf_32_char* utf_32_string = utf8_decode(string);
+	iV_DrawTextRotated(utf_32_string, x, y, rotation);
+	free(utf_32_string);
+}
+
+static inline void iV_DrawText_utf8(const char* string, float x, float y)
+{
+	iV_DrawTextRotated_utf8(string, x, y, 0.f);
+}
+
 #endif // _INCLUDED_TEXTDRAW_
Index: lib/ivis_opengl/pieblitfunc.c
===================================================================
--- lib/ivis_opengl/pieblitfunc.c	(revision 2375)
+++ lib/ivis_opengl/pieblitfunc.c	(working copy)
@@ -219,12 +219,11 @@
 
 void pie_DrawImageFileID(IMAGEFILE *ImageFile, UWORD ID, int x, int y)
 {
-	IMAGEDEF *Image;
 	PIEIMAGE pieImage;
 	PIERECT dest;
+	IMAGEDEF* Image = &ImageFile->ImageDefs[ID];
 
 	assert(ID < ImageFile->Header.NumImages);
-	Image = &ImageFile->ImageDefs[ID];
 
 	pieImage.texPage = ImageFile->TPageIDs[Image->TPageID];
 	pieImage.tu = Image->Tu;
Index: lib/ivis_opengl/piedraw.c
===================================================================
--- lib/ivis_opengl/piedraw.c	(revision 2375)
+++ lib/ivis_opengl/piedraw.c	(working copy)
@@ -923,7 +923,7 @@
 void pie_DrawImage(PIEIMAGE *image, PIERECT *dest, PIESTYLE *style)
 {
 	/* Set transparent color to be 0 red, 0 green, 0 blue, 0 alpha */
-	polyCount++;
+	++polyCount;
 
 	pie_SetTexturePage(image->texPage);
 
Index: lib/ivis_opengl/textdraw.c
===================================================================
--- lib/ivis_opengl/textdraw.c	(revision 2375)
+++ lib/ivis_opengl/textdraw.c	(working copy)
@@ -31,7 +31,16 @@
 #include "lib/ivis_common/bitimage.h"
 
 #include <GL/gl.h>
+#include <GL/glc.h>
 
+static float font_size = 12.f;
+// Contains the font color in the following order: red, green, blue, alpha
+static float font_colour[4] = {1.f, 1.f, 1.f, 1.f};
+
+static GLint GLC_Context = 0;
+static GLint GLC_Font_Regular = 0;
+static GLint GLC_Font_Bold = 0;
+
 /***************************************************************************/
 /*
  *	Local Definitions
@@ -60,21 +69,12 @@
  */
 /***************************************************************************/
 
-static SWORD TextColourIndex;
 static int NumFonts;
 static int ActiveFontID;
 static IVIS_FONT iVFonts[MAX_IVIS_FONTS];
 
 /***************************************************************************/
 /*
- *	Local ProtoTypes
- */
-/***************************************************************************/
-static void pie_BeginTextRender(SWORD ColourIndex);
-static void pie_TextRender(IMAGEFILE *ImageFile, UWORD ID, int x, int y);
-
-/***************************************************************************/
-/*
  *	Source
  */
 /***************************************************************************/
@@ -142,10 +142,28 @@
 	return NumFonts - 1;
 }
 
+unsigned int iV_GetFontCount()
+{
+	return NumFonts;
+}
+
+extern int FEFont;
+extern int WFont;
 void iV_SetFont(int FontID)
 {
 	assert(FontID < NumFonts);
 	ActiveFontID = FontID;
+
+	if (FontID == WFont)
+	{
+		font_size = 12.f;
+		glcFont(GLC_Font_Regular);
+	}
+	else if (FontID == FEFont)
+	{
+		font_size = 21.f;
+		glcFont(GLC_Font_Bold);
+	}
 }
 
 
@@ -168,7 +186,7 @@
 }
 
 
-
+#if 0
 unsigned int iV_GetTextWidth(const char *String)
 {
 	unsigned int width = 0;
@@ -179,8 +197,125 @@
 
 	return width;
 }
+#endif
 
+static inline float getGLCResolution()
+{
+    float resolution = glcGetf(GLC_RESOLUTION);
 
+    // The default resolution as used by OpenGLC is 72 dpi
+    if (resolution == 0.)
+        return 72.;
+
+    return resolution;
+}
+
+static inline float getGLCPixelSize()
+{
+    float pixel_size = font_size * getGLCResolution() / 72.;
+    return pixel_size;
+}
+
+static inline float getGLCPointWidth(const float* boundingbox)
+{
+    // boundingbox contains: [ xlb ylb xrb yrb xrt yrt xlt ylt ]
+    // l = left; r = right; b = bottom; t = top;
+    float rightTopX = boundingbox[4];
+    float leftTopX = boundingbox[6];
+
+    float point_width = rightTopX - leftTopX;
+
+    return point_width;
+}
+
+static inline float getGLCPointHeight(const float* boundingbox)
+{
+    // boundingbox contains: [ xlb ylb xrb yrb xrt yrt xlt ylt ]
+    // l = left; r = right; b = bottom; t = top;
+    float leftBottomY = boundingbox[1];
+    float leftTopY = boundingbox[7];
+
+    float point_height = leftTopY - leftBottomY;
+
+    return point_height;
+}
+
+static inline float getGLCPointToPixel(float point_width)
+{
+    float pixel_width = point_width * getGLCPixelSize();
+
+    return pixel_width;
+}
+
+static inline unsigned int iV_GetCountedStringHeight(const size_t count, const utf_32_char* string)
+{
+    float boundingbox[8];
+    float pixel_height, point_height;
+
+    glcMeasureCountedString(GL_FALSE, count, string);
+    if (!glcGetStringMetric(GLC_BOUNDS, boundingbox))
+    {
+        debug(LOG_ERROR, "iV_GetCountedStringHeight: couldn't retrieve a bounding box for the string");
+        return 0;
+    }
+
+    point_height = getGLCPointHeight(boundingbox);
+    pixel_height = getGLCPointToPixel(point_height);
+    return (unsigned int)pixel_height;
+}
+
+static inline unsigned int iV_GetCountedStringWidth(const size_t count, const utf_32_char* string)
+{
+    float boundingbox[8];
+    float pixel_width, point_width;
+
+    glcMeasureCountedString(GL_FALSE, count, string);
+    if (!glcGetStringMetric(GLC_BOUNDS, boundingbox))
+    {
+        debug(LOG_ERROR, "iV_GetCountedStringWidth: couldn't retrieve a bounding box for the string");
+        return 0;
+    }
+
+    point_width = getGLCPointWidth(boundingbox);
+    pixel_width = getGLCPointToPixel(point_width);
+    return (unsigned int)pixel_width;
+}
+
+unsigned int iV_GetTextWidth2(const utf_32_char* string)
+{
+    float boundingbox[8];
+    float pixel_width, point_width;
+
+    glcMeasureString(GL_FALSE, string);
+    if (!glcGetStringMetric(GLC_BOUNDS, boundingbox))
+    {
+        debug(LOG_ERROR, "iV_GetTextWidth: couldn't retrieve a bounding box for the string");
+        return 0;
+    }
+
+    point_width = getGLCPointWidth(boundingbox);
+    pixel_width = getGLCPointToPixel(point_width);
+    return (unsigned int)pixel_width;
+}
+
+unsigned int iV_GetTextHeight(const utf_32_char* string)
+{
+    float boundingbox[8];
+    float pixel_height, point_height;
+
+    glcMeasureString(GL_FALSE, string);
+    if (!glcGetStringMetric(GLC_BOUNDS, boundingbox))
+    {
+        debug(LOG_ERROR, "iV_GetTextHeight: couldn't retrieve a bounding box for the string");
+        return 0;
+    }
+
+    point_height = getGLCPointHeight(boundingbox);
+    pixel_height = getGLCPointToPixel(point_height);
+    return (unsigned int)pixel_height;
+}
+
+
 unsigned int iV_GetCharWidth(char Char)
 {
 	UWORD ImageID;
@@ -200,6 +335,30 @@
 {
 	IVIS_FONT *Font = &iVFonts[ActiveFontID];
 	Font->FontColourIndex = Index;
+
+	switch (Index)
+	{
+		case PIE_TEXT_WHITE:
+			font_colour[0] = 1.f;
+			font_colour[1] = 1.f;
+			font_colour[2] = 1.f;
+			font_colour[3] = 1.f;
+			break;
+
+		case PIE_TEXT_LIGHTBLUE:
+			font_colour[0] = 0.627451f;
+			font_colour[1] = 0.627451f;
+			font_colour[2] = 1.f;
+			font_colour[3] = 1.f;
+			break;
+
+        case PIE_TEXT_DARKBLUE:
+			font_colour[0] = 0.376471f;
+			font_colour[1] = 0.376471f;
+			font_colour[2] = 0.752941f;
+			font_colour[3] = 1.f;
+			break;
+	};
 }
 
 // --------------------------------------------------------------------------
@@ -363,7 +522,10 @@
 		}
 
 		// draw the text.
-		iV_DrawText(FString, jx, jy);
+		utf_32_char* tmpStr = utf8_decode(FString);
+		iV_SetTextSize(12.f);
+		iV_DrawText(tmpStr, jx, jy);
+		free(tmpStr);
 
 
 //DBPRINTF(("[%s] @ %d,%d\n",FString,jx,jy));
@@ -399,120 +561,115 @@
 	return jy;
 }
 
+static inline void iV_initializeGLC()
+{
+	if (GLC_Context)
+		return;
 
+	GLC_Context = glcGenContext();
+	if (!GLC_Context)
+		debug(LOG_ERROR, "glcGenContext() failed");
+	else
+		debug(LOG_NEVER, "glcGenContext() succesful: GLC_Context = %d", GLC_Context);
 
-void iV_DrawText(const char *string, UDWORD x, UDWORD y)
-{
-	IVIS_FONT *Font = &iVFonts[ActiveFontID];
+	glcContext(GLC_Context);
 
-	/* Colour selection */
-	pie_BeginTextRender(Font->FontColourIndex);
+	glcDisable(GLC_GL_OBJECTS);
+	glcDisable(GLC_AUTO_FONT);
+	glcRenderStyle(GLC_TRIANGLE);
 
-	for (; *string != 0; ++string)
-	{
-		unsigned int Index = (unsigned char)*string;
-		UWORD ImageID;
+	GLC_Font_Regular = glcGenFontID();
+	GLC_Font_Bold = glcGenFontID();
 
-		// Toggle colour mode?
-		if (Index == ASCII_COLOURMODE)
-		{
-			static SWORD OldTextColourIndex = -1;
+	static const char* font_family = "DejaVu Sans Mono";
+	static const char* font_face_regular = "Book";
+	static const char* font_face_bold = "Bold";
 
-			if (TextColourIndex >= 0)
-			{
-				OldTextColourIndex = TextColourIndex;
-				TextColourIndex = -1;
-			}
-			else
-			{
-				if (OldTextColourIndex >= 0)
-				{
-					TextColourIndex = OldTextColourIndex;
-				}
-			}
+	if (!glcNewFontFromFamily(GLC_Font_Regular, font_family))
+			debug(LOG_ERROR, "glcNewFontFromFamily(GLC_Font_Regular (%d), \"%s\") failed", GLC_Font_Regular, font_family);
+		else
+			debug(LOG_NEVER, "glcNewFontFromFamily(GLC_Font_Regular (%d), \"%s\") succesful", GLC_Font_Regular, font_family);
 
-			// Don't draw this character
-			continue;
-		}
-		else if (Index == ASCII_SPACE)
-		{
-			x += Font->FontSpaceSize;
+	if (!glcFontFace(GLC_Font_Regular, font_face_regular))
+			debug(LOG_ERROR, "glcFontFace(GLC_Font_Regular (%d), \"%s\") failed", GLC_Font_Regular, font_face_regular);
+		else
+			debug(LOG_NEVER, "glcFontFace(GLC_Font_Regular (%d), \"%s\") succesful", GLC_Font_Regular, font_face_regular);
 
-			// Don't draw this character
-			continue;
-		}
+	if (!glcNewFontFromFamily(GLC_Font_Bold, font_family))
+			debug(LOG_ERROR, "glcNewFontFromFamily(GLC_Font_Bold (%d), \"%s\") failed", GLC_Font_Bold, font_family);
+		else
+			debug(LOG_NEVER, "glcNewFontFromFamily(GLC_Font_Bold (%d), \"%s\") succesful", GLC_Font_Bold, font_family);
 
-		// Draw the character
-		ImageID = Font->AsciiTable[Index];
-		pie_TextRender(Font->FontFile, ImageID, x, y);
+	if (!glcFontFace(GLC_Font_Bold, font_face_bold))
+			debug(LOG_ERROR, "glcFontFace(GLC_Font_Bold (%d), \"%s\") failed", GLC_Font_Bold, font_face_bold);
+		else
+			debug(LOG_NEVER, "glcFontFace(GLC_Font_Bold (%d), \"%s\") succesful", GLC_Font_Bold, font_face_bold);
 
-		// Advance the drawing position
-		x += iV_GetImageWidth(Font->FontFile, ImageID) + 1;
+	debug(LOG_NEVER, "finished initializing GLC");
+
+	glcFont(GLC_Font_Regular);
+	glcAppendFont(GLC_Font_Bold);
+
+
+
+/// FONT DUMP CODE
+	GLint font_count = glcGeti(GLC_CURRENT_FONT_COUNT);
+	debug(LOG_ERROR, "GLC_CURRENT_FONT_COUNT = %d", font_count);
+
+	for (unsigned int i = 0; i < font_count; ++i)
+	{
+		GLint font = glcGetListi(GLC_CURRENT_FONT_LIST, i);
+		/* The output of the family name and the face is printed using 2 steps
+		 * because glcGetFontc and glcGetFontFace return their result in the
+		 * same buffer (according to GLC specs).
+		 */
+		char prBuffer[1024];
+		snprintf(prBuffer, sizeof(prBuffer), "Font #%d : %s ", font, (const char*)glcGetFontc(font, GLC_FAMILY));
+		prBuffer[sizeof(prBuffer) - 1] = 0;
+		strncat(prBuffer, glcGetFontFace(font), sizeof(prBuffer));
+		prBuffer[sizeof(prBuffer) - 1] = 0;
+		debug(LOG_ERROR, prBuffer);
 	}
+
+	glcStringType(GLC_UCS4);
 }
 
+void iV_DrawTextRotated(const utf_32_char* string, float XPos, float YPos, float rotation)
+{
+/// HACK: if necessary initialize GLC
+	if (!GLC_Context)
+		iV_initializeGLC();
 
-void iV_DrawTextRotated(const char* string, unsigned int XPos, unsigned int YPos, float rotation)
-{
-	glTranslatef((float)XPos, (float)YPos, 0.f);
+	pie_SetTexturePage(-2);
+
+	// Enable Anti Aliasing
+	glEnable(GL_BLEND);
+	glBlendFunc(GL_SRC_ALPHA, GL_ONE);
+	glEnable(GL_POLYGON_SMOOTH);
+
+	if (rotation != 0.f)
+		rotation = 360.f - rotation;
+
+	glTranslatef(XPos, YPos, 0.f);
+	glRotatef(180.f, 1.f, 0.f, 0.f);
 	glRotatef(rotation, 0.f, 0.f, 1.f);
+	glScalef(font_size, font_size, 0.f);
 
-	// Now call iV_DrawText at position (0,0) of the translated matrix
-	iV_DrawText(string, 0, 0);
+	glColor4f(font_colour[0], font_colour[1], font_colour[2], font_colour[3]);
 
-	// Reset the tranlation matrix
+	glFrontFace(GL_CW);
+	glcRenderString(string);
+	glFrontFace(GL_CCW);
+
+	// Turn off anti aliasing
+	glDisable(GL_BLEND);
+	glDisable(GL_POLYGON_SMOOTH);
+
+	// Reset the current model view matrix
 	glLoadIdentity();
 }
 
-void pie_BeginTextRender(SWORD ColourIndex)
+void iV_SetTextSize(float size)
 {
-	TextColourIndex = ColourIndex;
-	pie_SetRendMode(REND_TEXT);
-	pie_SetBilinear(FALSE);
+	font_size = size;
 }
-
-#define PIE_TEXT_WHITE_COLOUR		(0xffffffff)
-#define PIE_TEXT_LIGHTBLUE_COLOUR	(0xffa0a0ff)
-#define PIE_TEXT_DARKBLUE_COLOUR	(0xff6060c0)
-
-static void pie_TextRender(IMAGEFILE *ImageFile, UWORD ID, int x, int y)
-{
-	UDWORD Red;
-	UDWORD Green;
-	UDWORD Blue;
-	UDWORD Alpha = MAX_UB_LIGHT;
-	iColour* psPalette;
-
-
-	if (TextColourIndex == PIE_TEXT_WHITE
-	 || TextColourIndex == 255)
-	{
-		pie_SetColour(MAX_LIGHT);
-	}
-	else
-	{
-		if (TextColourIndex == PIE_TEXT_WHITE)
-		{
-			pie_SetColour(PIE_TEXT_WHITE_COLOUR);
-		}
-		else if (TextColourIndex == PIE_TEXT_LIGHTBLUE)
-		{
-			pie_SetColour(PIE_TEXT_LIGHTBLUE_COLOUR);
-		}
-		else if (TextColourIndex == PIE_TEXT_DARKBLUE)
-		{
-			pie_SetColour(PIE_TEXT_DARKBLUE_COLOUR);
-		}
-		else
-		{
-			psPalette = pie_GetGamePal();
-			Red  = psPalette[TextColourIndex].r;
-			Green = psPalette[TextColourIndex].g;
-			Blue = psPalette[TextColourIndex].b;
-			pie_SetColour(((Alpha << 24) | (Red << 16) | (Green << 8) | Blue));
-		}
-	}
-	pie_SetColourKeyedBlack(TRUE);
-	pie_DrawImageFileID(ImageFile, ID, x, y);
-	pie_SetColourKeyedBlack(FALSE);
-}
Index: lib/widget/button.h
===================================================================
--- lib/widget/button.h	(revision 2375)
+++ lib/widget/button.h	(working copy)
@@ -25,6 +25,8 @@
 #ifndef _button_h
 #define _button_h
 
+#include "lib/framework/utf8.h"
+
 /* Button states */
 #define WBUTS_NORMAL	0x0000
 #define WBUTS_DOWN		0x0001		// Button is down
@@ -41,7 +43,7 @@
 	WIDGET_BASE;
 
 	UDWORD		state;				// The current button state
-	const char *pText;				// The text for the button
+	utf_32_char* pText;				// The text for the button
 	const char *pTip;				// The tool tip for the button
 	SWORD HilightAudioID;				// Audio ID for form clicked sound
 	SWORD ClickedAudioID;				// Audio ID for form hilighted sound
@@ -90,3 +92,4 @@
 
 #endif
 
+
Index: lib/widget/editbox.c
===================================================================
--- lib/widget/editbox.c	(revision 2375)
+++ lib/widget/editbox.c	(working copy)
@@ -729,7 +729,7 @@
 //	if(psEdBox->pFontDisplay) {
 //		psEdBox->pFontDisplay(fx,fy, pPrint);
 //	} else {
-		iV_DrawText(pPrint,fx,fy);
+		iV_DrawText_utf8(pPrint,fx,fy);
 //	}
 	*pInsPoint = ch;
 
Index: lib/widget/label.c
===================================================================
--- lib/widget/label.c	(revision 2375)
+++ lib/widget/label.c	(working copy)
@@ -79,10 +79,7 @@
 
 	if (psInit->pText)
 	{
-		strncpy((*ppsWidget)->aText, psInit->pText, sizeof((*ppsWidget)->aText));
-
-		// Terminate the string with a NUL character
-		(*ppsWidget)->aText[sizeof((*ppsWidget)->aText) - 1] = '\0';
+		(*ppsWidget)->aText = utf8_decode(psInit->pText);
 	}
 	else
 	{
@@ -130,7 +127,8 @@
 		fx = xOffset + psLabel->x;
 	}
   	fy = yOffset + psLabel->y + (psLabel->height - iV_GetTextLineSize())/2 - iV_GetTextAboveBase();
-	iV_DrawText(psLabel->aText,fx,fy);
+	iV_SetTextSize(12.f);
+	iV_DrawText(psLabel->aText, fx, fy);
 }
 
 /* Respond to a mouse moving over a label */
@@ -161,3 +159,4 @@
 
 
 
+
Index: lib/widget/label.h
===================================================================
--- lib/widget/label.h	(revision 2375)
+++ lib/widget/label.h	(working copy)
@@ -28,13 +28,15 @@
 // label states.
 #define WLABEL_HILITE	0x0004		// label is hilited
 
+#include "lib/framework/utf8.h"
+
 typedef struct _w_label
 {
 	/* The common widget data */
 	WIDGET_BASE;
 
 	UDWORD		state;					// The current button state
-	char		aText[WIDG_MAXSTR];		// Text on the label
+	utf_32_char* aText;                 // Text on the label
 	int FontID;
 	const char	*pTip;					// The tool tip for the button
 } W_LABEL;
@@ -56,3 +58,4 @@
 
 #endif
 
+
Index: lib/widget/tip.c
===================================================================
--- lib/widget/tip.c	(revision 2375)
+++ lib/widget/tip.c	(working copy)
@@ -225,7 +225,8 @@
 		iV_SetFont(FontID);
 //		iV_SetTextColour((UWORD)*(pColours + WCOL_TEXT));
 		iV_SetTextColour((UWORD)TipColour);
-		iV_DrawText(pTip,fx,fy);
+		iV_SetTextSize(12.f);
+		iV_DrawText_utf8(pTip,fx,fy);
 
 		break;
 	default:
@@ -235,3 +236,4 @@
 
 
 
+
Index: lib/widget/widget.c
===================================================================
--- lib/widget/widget.c	(revision 2375)
+++ lib/widget/widget.c	(working copy)
@@ -1128,12 +1128,17 @@
 				aStringRetBuffer[0] = '\0';
 				break;
 			case WIDG_LABEL:
-				strcpy(aStringRetBuffer, ((W_LABEL *)psWidget)->aText);
+			{
+				char* utf8_text = utf8_encode(((W_LABEL *)psWidget)->aText);
+				strcpy(aStringRetBuffer, utf8_text);
+				free(utf8_text);
 				break;
+			}
 			case WIDG_BUTTON:
 				if (((W_BUTTON *)psWidget)->pText)
 				{
-					strcpy(aStringRetBuffer, ((W_BUTTON *)psWidget)->pText);
+					char* utf8_text = utf8_encode(((W_BUTTON *)psWidget)->pText);
+					strcpy(aStringRetBuffer, utf8_text);
 				}
 				else
 				{
@@ -1190,14 +1195,12 @@
 			break;
 
 		case WIDG_LABEL:
-			strncpy(((W_LABEL *)psWidget)->aText, pText, sizeof(((W_LABEL *)psWidget)->aText));
-
-			// Terminate the string with a NUL character
-			((W_LABEL *)psWidget)->aText[sizeof(((W_LABEL *)psWidget)->aText) - 1] = '\0';
+			((W_LABEL *)psWidget)->aText = utf8_decode(pText);
 			break;
 
 		case WIDG_BUTTON:
-			((W_BUTTON *)psWidget)->pText = pText;
+			free(((W_BUTTON *)psWidget)->pText);
+			((W_BUTTON *)psWidget)->pText = utf8_decode(pText);
 			break;
 
 		case WIDG_EDITBOX:
Index: lib/widget/widget.h
===================================================================
--- lib/widget/widget.h	(revision 2375)
+++ lib/widget/widget.h	(working copy)
@@ -26,6 +26,7 @@
 #define _widget_h
 
 #include "lib/framework/frame.h"
+#include "lib/framework/utf8.h"
 #include "widgbase.h"
 
 /***********************************************************************************
@@ -195,7 +196,7 @@
 	/* The basic init entries */
 	WINIT_BASE;
 
-	const char *pText; // button text
+	utf_32_char* pText; // button text
 	const char *pTip; // Tool tip text
 	int FontID; // ID of the IVIS font to use for this widget.
 } W_BUTINIT;
@@ -464,3 +465,4 @@
 
 #endif
 
+
Index: src/display3d.c
===================================================================
--- src/display3d.c	(revision 2375)
+++ src/display3d.c	(working copy)
@@ -299,21 +299,23 @@
 
 static void displayMultiChat( void )
 {
-UDWORD	pixelLength;
-UDWORD	pixelHeight;
+	UDWORD	pixelLength;
+	UDWORD	pixelHeight;
 
-		pixelLength = iV_GetTextWidth(sTextToSend);
-		pixelHeight = iV_GetTextLineSize();
+	utf_32_char* text = utf8_decode(sTextToSend);
 
-		if(gameTime2%500<250)
-		{
-			iV_BoxFill( RET_X + pixelLength + 3, 474 + E_H - (pixelHeight/4), RET_X + pixelLength + 10, 473 + E_H, 255 );
-		}
+	pixelLength = iV_GetTextWidth(text);
+	pixelHeight = iV_GetTextLineSize();
 
-		/* GET RID OF THE MAGIC NUMBERS BELOW */
-		iV_TransBoxFill( RET_X + 1, 474 + E_H - pixelHeight, RET_X + 1 + pixelLength + 2, 473 + E_H );
+	if(gameTime2%500<250)
+	{
+		iV_BoxFill( RET_X + pixelLength + 3, 474 + E_H - (pixelHeight/4), RET_X + pixelLength + 10, 473 + E_H, 255 );
+	}
 
-		iV_DrawText( sTextToSend, RET_X + 3, 469 + E_H );
+	/* GET RID OF THE MAGIC NUMBERS BELOW */
+	iV_TransBoxFill( RET_X + 1, 474 + E_H - pixelHeight, RET_X + 1 + pixelLength + 2, 473 + E_H );
+
+	iV_DrawText(text, RET_X + 3, 469 + E_H );
 }
 
 // Optimisation to stop it being calculated every frame
@@ -417,23 +419,37 @@
 		// FIXME: This wasn't shown before. Do we want to keep it? Or change it?
 		if(gamePaused())
 		{
-			iV_DrawText( _("Developed by Pumpkin Studios"), RET_X + 3, 467 + E_H );
-			iV_DrawText( _("Published by EIDOS Interactive"), pie_GetVideoBufferWidth() - 196, 467 + E_H );
+			static utf_32_char* developer = NULL;
+			static utf_32_char* publisher = NULL;
+			if (developer == NULL)
+			{
+				const char* utf8_developer = _("Developed by Pumpkin Studios");
+				developer = utf8_decode(utf8_developer);
+			}
+
+			if (publisher == NULL)
+			{
+				const char* utf8_publisher = _("Published by EIDOS Interactive");
+				publisher = utf8_decode(utf8_publisher);
+			}
+
+			iV_DrawText(developer, 26.f, (float)(pie_GetVideoBufferHeight() - iV_GetTextHeight(developer)));
+			iV_DrawText(publisher, (float)(pie_GetVideoBufferWidth() - iV_GetTextWidth2(publisher) - 26), (float)(pie_GetVideoBufferHeight() - iV_GetTextHeight(publisher)));
 		}
 	}
 
 	if(getDebugMappingStatus() && !demoGetStatus() && !gamePaused())
 	{
-		iV_DrawText( "DEBUG ", RET_X + 134, 440 + E_H );
+		iV_DrawText_utf8( "DEBUG ", RET_X + 134, 440 + E_H );
 	}
 	else
 	{
 #ifdef DEBUG
 		if(!gamePaused())
 		{
-			iV_DrawText( getLevelName(), RET_X + 134, 420 + E_H );
+			iV_DrawText_utf8( getLevelName(), RET_X + 134, 420 + E_H );
 			getAsciiTime(buildInfo,gameTime);
-			iV_DrawText( buildInfo, RET_X + 134, 434 + E_H );
+			iV_DrawText_utf8( buildInfo, RET_X + 134, 434 + E_H );
 		}
 #endif
 	}
Index: src/frontend.c
===================================================================
--- src/frontend.c	(revision 2375)
+++ src/frontend.c	(working copy)
@@ -1194,11 +1194,12 @@
 	sButInit.id = id;
 	sButInit.x = (short)PosX;
 	sButInit.y = (short)PosY;
+	sButInit.pText = utf8_decode(txt);
 
 	if(bAlign)
 	{
 		sButInit.style = WBUT_PLAIN;
-		sButInit.width = (short)(iV_GetTextWidth(txt)+10);//FRONTEND_BUTWIDTH;
+		sButInit.width = (short)(iV_GetTextWidth(sButInit.pText) + 10);//FRONTEND_BUTWIDTH;
 
 		sButInit.x+=35;
 
@@ -1215,7 +1216,6 @@
 	sButInit.height = FRONTEND_BUTHEIGHT;
 	sButInit.pDisplay = displayTextOption;
 	sButInit.FontID = FEFont;
-	sButInit.pText = txt;
 	widgAddButton(psWScreen, &sButInit);
 
 	if(bGrey)										// dont allow clicks to this button...
@@ -1295,20 +1295,40 @@
 
 // ////////////////////////////////////////////////////////////////////////////
 // drawing functions
+#include <GL/glc.h>
+#include "lib/ivis_common/piestate.h"
 
+extern void iV_SetTextSize(float size);
+extern unsigned iV_GetFontCount(void);
 // show a background piccy
 static void displayTitleBitmap(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, UDWORD *pColours)
 {
+	static const utf_32_char* versionString = NULL;
+	if (!versionString)
+	{
 #ifdef DEBUG
-	static const char versionString[] = "Version " VERSION " - Built " __DATE__ " - DEBUG";
+		static const char sTmp[] = "Version " VERSION " - Built " __DATE__ " - DEBUG";
 #else
-	static const char versionString[] = "Version " VERSION " - Built " __DATE__;
+		static const char sTmp[] = "Version " VERSION " - Built " __DATE__;
 #endif
+		versionString = utf8_decode(sTmp);
+	}
 
+	static utf_32_char* utf32_test_string = NULL;
+	if (!utf32_test_string)
+	{
+		static const char utf8_test_string[] = "aeiou áéíóú àèìòù âêîôû äëïöü ãõñ";
+
+		utf32_test_string = utf8_decode(utf8_test_string);
+	}
+
 	iV_SetFont(WFont);
-	iV_SetTextColour(-1);
+	iV_SetTextColour(PIE_TEXT_WHITE);
 
-	iV_DrawTextRotated(versionString, pie_GetVideoBufferWidth() - 10, pie_GetVideoBufferHeight() - 15, 270.f);
+	iV_DrawTextRotated(versionString, (float)pie_GetVideoBufferWidth() - 10.f, (float)pie_GetVideoBufferHeight() - 15.f, 270.f);
+	iV_DrawTextRotated(glcGetc(GLC_EXTENSIONS), 10.f, (float)pie_GetVideoBufferHeight() - 15.f, 0.f);
+	iV_SetTextSize(40.f);
+	iV_DrawTextRotated(utf32_test_string, 10.f, 40.f, 0.f);
 }
 
 // ////////////////////////////////////////////////////////////////////////////
@@ -1366,7 +1386,7 @@
 		}
 	}
 
-	iV_DrawText( psBut->pText, fx, fy);
+	iV_DrawText(psBut->pText, fx, fy);
 
 	return;
 }
@@ -1376,11 +1396,9 @@
 // show text written on its side.
 void displayTextAt270(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, UDWORD *pColours)
 {
-	SDWORD		fx,fy;
-	W_LABEL		*psLab;
+	int		fx,fy;
+	W_LABEL* psLab = (W_LABEL *)psWidget;
 
-	psLab = (W_LABEL *)psWidget;
-
 	iV_SetFont(FEFont);
 
 
@@ -1391,7 +1409,10 @@
 	fy = yOffset + psWidget->y + iV_GetTextWidth(psLab->aText) ;
 
 
-	iV_DrawTextRotated(psLab->aText, fx, fy, 270.f);
+	iV_SetTextSize(25.f);
+	glcFontFace(1, "Bold");
+	iV_DrawTextRotated(psLab->aText, (float)fx, (float)fy, 270.f);
+	glcFontFace(1, "Book");
 }
 
 
Index: src/hci.c
===================================================================
--- src/hci.c	(revision 2375)
+++ src/hci.c	(working copy)
@@ -3977,7 +3977,7 @@
 	sButInit.width = CLOSE_SIZE;
 	sButInit.height = CLOSE_SIZE;
 	sButInit.FontID = WFont;
-	sButInit.pText = pCloseText;
+	sButInit.pText = utf8_decode(pCloseText);
 	sButInit.pTip = _("Close");
 	if (!widgAddButton(psWScreen, &sButInit))
 	{
@@ -4107,7 +4107,7 @@
 	/* Add the add object buttons */
 	sButInit.id = IDOPT_DROID;
 	sButInit.x += OPT_GAP + OPT_BUTWIDTH;
-	sButInit.pText = "Unit";
+	sButInit.pText = utf8_decode("Unit");
 	sButInit.pTip = "Place Unit on map";
 	if (!widgAddButton(psWScreen, &sButInit))
 	{
@@ -4116,7 +4116,7 @@
 
 	sButInit.id = IDOPT_STRUCT;
 	sButInit.x += OPT_GAP + OPT_BUTWIDTH;
-	sButInit.pText = "Struct";
+	sButInit.pText = utf8_decode("Struct");
 	sButInit.pTip = "Place Structures on map";
 	if (!widgAddButton(psWScreen, &sButInit))
 	{
@@ -4125,7 +4125,7 @@
 
 	sButInit.id = IDOPT_FEATURE;
 	sButInit.x += OPT_GAP + OPT_BUTWIDTH;
-	sButInit.pText = "Feat";
+	sButInit.pText = utf8_decode("Feat");
 	sButInit.pTip = "Place Features on map";
 	if (!widgAddButton(psWScreen, &sButInit))
 	{
@@ -4139,7 +4139,7 @@
 	sButInit.y = OPT_HEIGHT - OPT_GAP - OPT_BUTHEIGHT;
 	sButInit.width = OPT_WIDTH - OPT_GAP*2;
 	sButInit.height = OPT_BUTHEIGHT;
-	sButInit.pText = "Quit";
+	sButInit.pText = utf8_decode("Quit");
 	sButInit.pTip = _("Exit Game");
 	if (!widgAddButton(psWScreen, &sButInit))
 	{
@@ -4183,7 +4183,7 @@
 	sButInit.FontID = WFont;
 	for(player = 0; player < MAX_PLAYERS; player++)
 	{
-		sButInit.pText = apPlayerText[player];
+		sButInit.pText = utf8_decode(apPlayerText[player]);
 		sButInit.pTip = apPlayerTip[player];
 		if (!widgAddButton(psWScreen, &sButInit))
 		{
Index: src/ingameop.c
===================================================================
--- src/ingameop.c	(revision 2375)
+++ src/ingameop.c	(working copy)
@@ -82,7 +82,7 @@
 
 	sButInit.FontID		= WFont;
 	sButInit.pDisplay	= displayTextOption;
-	sButInit.pText		= string;
+	sButInit.pText		= utf8_decode(string);
 	widgAddButton(psWScreen, &sButInit);
 
 	return TRUE;
@@ -453,3 +453,4 @@
 
 }
 
+
Index: src/intdisplay.c
===================================================================
--- src/intdisplay.c	(revision 2375)
+++ src/intdisplay.c	(working copy)
@@ -597,7 +597,10 @@
 		ASSERT( psDroid->droidType == DROID_COMMAND,
 			"intUpdateCommandSize: droid is not a command droid" );
 
-		sprintf(Label->aText, "%d/%d", psDroid->psGroup ? grpNumMembers(psDroid->psGroup) : 0, cmdDroidMaxGroup(psDroid));
+		char tmpBuffer[64];
+		sprintf(tmpBuffer, "%d/%d", psDroid->psGroup ? grpNumMembers(psDroid->psGroup) : 0, cmdDroidMaxGroup(psDroid));
+		free(Label->aText);
+		Label->aText = utf8_decode(tmpBuffer);
 		Label->style &= ~WIDG_HIDDEN;
 	}
 	else
@@ -716,7 +719,8 @@
 	SDWORD		BarWidth, textWidth = 0;
 	SDWORD		iX,iY;
 #if	DRAW_POWER_BAR_TEXT
-	static char		szVal[8];
+	static char szVal[8];
+	utf_32_char* powerBarText;
 #endif
 		//SDWORD Used,Avail,ManPow;
 
@@ -731,7 +735,8 @@
 #if	DRAW_POWER_BAR_TEXT
     iV_SetFont(WFont);
 	sprintf( szVal, "%d", realPower );
-	textWidth = iV_GetTextWidth( szVal );
+	powerBarText = utf8_decode(szVal);
+	textWidth = iV_GetTextWidth(powerBarText);
 	BarWidth -= textWidth;
 #endif
 
@@ -868,7 +873,7 @@
 
 #if	DRAW_POWER_BAR_TEXT
 	iV_SetTextColour(-1);
-	iV_DrawText( szVal, iX, iY );
+	iV_DrawText(powerBarText, iX, iY);
 #endif
 }
 
@@ -3331,13 +3336,25 @@
 
 #define	DRAW_BAR_TEXT	1
 
+static const utf_32_char* getCheckWidth()
+{
+	static utf_32_char* checkWidth = NULL;
 
+	if (!checkWidth)
+	{
+		static const char utf8_checkWidth[] = "00000";
+		checkWidth = utf8_decode(utf8_checkWidth);
+	}
+
+	return checkWidth;
+}
+
 /* Draws a stats bar for the design screen */
 void intDisplayStatsBar(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, UDWORD *pColours)
 {
 	W_BARGRAPH		*BarGraph = (W_BARGRAPH*)psWidget;
 	SDWORD			x0, y0, iX, iY;
-	static char		szVal[6], szCheckWidth[6] = "00000";
+	static char		szVal[12];
 
 	x0 = xOffset + BarGraph->x;
 	y0 = yOffset + BarGraph->y;
@@ -3351,7 +3368,7 @@
 
 	/* indent to allow text value */
 #if	DRAW_BAR_TEXT
-	iX = x0 + iV_GetTextWidth( szCheckWidth );
+	iX = x0 + iV_GetTextWidth(getCheckWidth());
 	iY = y0 + (iV_GetImageHeight(IntImages,IMAGE_DES_STATSCURR) - iV_GetTextLineSize())/2 -
 					iV_GetTextAboveBase();
 #else
@@ -3365,9 +3382,9 @@
 
 	/* draw text value */
 #if	DRAW_BAR_TEXT
-	sprintf( szVal, "%d", BarGraph->iValue );
+	sprintf(szVal, "%d", BarGraph->iValue);
 	iV_SetTextColour(-1);
-	iV_DrawText( szVal, x0, iY );
+	iV_DrawText_utf8(szVal, x0, iY);
 #endif
 
 	//draw the comparison value - only if not zero
@@ -3390,7 +3407,7 @@
 	W_BARGRAPH      *BarGraph = (W_BARGRAPH*)psWidget;
 	SDWORD		    x0, y0, iX, iY;
     UDWORD          width, barWidth;
-	static char		szVal[6], szCheckWidth[6] = "00000";
+	static char		szVal[6];
     UBYTE           arbitaryOffset;
 
 	x0 = xOffset + BarGraph->x;
@@ -3409,7 +3426,7 @@
 
 	/* indent to allow text value */
 #if	DRAW_BAR_TEXT
-	iX = x0 + iV_GetTextWidth( szCheckWidth );
+	iX = x0 + iV_GetTextWidth(getCheckWidth());
 	iY = y0 + (iV_GetImageHeight(IntImages,IMAGE_DES_STATSCURR) - iV_GetTextLineSize())/2 -
 					iV_GetTextAboveBase();
 #else
@@ -3434,7 +3451,7 @@
 #if	DRAW_BAR_TEXT
 	sprintf( szVal, "%d", BarGraph->iValue );
 	iV_SetTextColour(-1);
-	iV_DrawText( szVal, x0, iY );
+	iV_DrawText_utf8(szVal, x0, iY);
 #endif
 
 
Index: src/messagedef.h
===================================================================
--- src/messagedef.h	(revision 2375)
+++ src/messagedef.h	(working copy)
@@ -27,6 +27,7 @@
 
 #include "deliverance.h"
 #include "lib/ivis_common/pietypes.h"
+#include "lib/framework/utf8.h"
 
 typedef enum _message_type
 {
@@ -78,7 +79,7 @@
 	UBYTE		flag;			//flag data to control video playback 1 = loop till audio finish
 	UBYTE		numText;		//the number of textmessages associated with
 								//this sequence
-	char		**ppTextMsg;	//Pointer to text messages - if any
+	utf_32_char **ppTextMsg;	//Pointer to text messages - if any
 	char		*pAudio;		/*name of audio track to play (for this seq)*/
 	UWORD		numFrames;		/* On PSX if type is VIEW_RPL then
 								this is used as a number_of_frames_in_the_stream
Index: src/seqdisp.c
===================================================================
--- src/seqdisp.c	(revision 2375)
+++ src/seqdisp.c	(working copy)
@@ -656,7 +656,7 @@
 					{
 						aSeqList[currentPlaySeq].aText[i].x = 20 + D_W;
 					}
-					iV_DrawText(&(aSeqList[currentPlaySeq].aText[i].pText[0]),
+					iV_DrawText_utf8(&(aSeqList[currentPlaySeq].aText[i].pText[0]),
 							aSeqList[currentPlaySeq].aText[i].x, aSeqList[currentPlaySeq].aText[i].y);
 				}
 				else if (aSeqList[currentPlaySeq].bSeqLoop)//if its a looped video always draw the text
@@ -665,7 +665,7 @@
 					{
 						aSeqList[currentPlaySeq].aText[i].x = 20 + D_W;
 					}
-					iV_DrawText(&(aSeqList[currentPlaySeq].aText[i].pText[0]),
+					iV_DrawText_utf8(&(aSeqList[currentPlaySeq].aText[i].pText[0]),
 							aSeqList[currentPlaySeq].aText[i].x, aSeqList[currentPlaySeq].aText[i].y);
 				}
 
Index: warzone2100.cbp
===================================================================
--- warzone2100.cbp	(revision 2375)
+++ warzone2100.cbp	(working copy)
@@ -50,6 +50,7 @@
 			<Add library="SDL_net" />
 			<Add library="GL" />
 			<Add library="GLU" />
+			<Add library="GLC" />
 			<Add library="openal" />
 			<Add library="vorbisfile" />
 			<Add library="vorbis" />

