self.FetchGamePaks( self.install_directory )
# NOTE: unrelated to self.setup_platforms - grab support files and binaries and install them
if ( self.platform == 'Windows' ):
- depsfile = 'GtkR-deps-1.6-4.zip'
+ depsfile = 'GtkR-deps-1.6-3.zip'
if ( not os.path.exists( depsfile ) ):
cmd = [ 'wget', '-N', 'http://zerowing.idsoftware.com/files/radiant/developer/1.6.1/%s' % depsfile ]
print( repr( cmd ) )
'gtk2/lib/libgdkglext-win32-1.0-0.dll',
'gtk2/lib/iconv.dll',
'gtk2/zlib1.dll',
- 'freetype-dev_2.4.2-1_win32/bin/freetype6.dll',
- 'fontconfig-dev_2.8.0-2_win32/bin/libfontconfig-1.dll',
- 'expat_2.0.1-1_win32/bin/libexpat-1.dll',
+# 'freetype-dev_2.4.2-1_win32/bin/freetype6.dll',
+# 'fontconfig-dev_2.8.0-2_win32/bin/libfontconfig-1.dll',
+# 'expat_2.0.1-1_win32/bin/libexpat-1.dll',
]:
cmd = [ 'cp', '-v', os.path.join( srcdir, f ), 'install' ]
print( repr( cmd ) )
for d in [
'gtk2/etc',
'gtk2/share',
- 'fontconfig-dev_2.8.0-2_win32/etc',
- 'fontconfig-dev_2.8.0-2_win32/share',
- 'freetype-dev_2.4.2-1_win32/share',
+# 'fontconfig-dev_2.8.0-2_win32/etc',
+# 'fontconfig-dev_2.8.0-2_win32/share',
+# 'freetype-dev_2.4.2-1_win32/share',
]:
cmd = [ 'cp', '-r', '-v', os.path.join( srcdir, d ), 'install' ]
print( repr( cmd ) )
#include "stdafx.h"
#include <gtk/gtkgl.h>
+
+#ifndef _WIN32
#include <pango/pangoft2.h>
+#endif
+
#include "glwidget.h"
#include "qgl.h"
}
+#ifdef _WIN32
+
+GLuint font_list_base;
+static gchar font_string[] = "courier 8";
+static gint font_height;
+static int font_created = 0;
+
+#else
+
// Think about rewriting this font stuff to use OpenGL display lists and glBitmap().
// Bit maps together with display lists may offer a performance increase, but
// they would not allow antialiased fonts.
static PangoContext *ft2_context = NULL;
static int _debug_font_created = 0;
+#endif
+
// Units are pixels. Returns a positive value [most likely].
int gtk_glwidget_font_ascent()
{
+#ifdef _WIN32
+
+ return 6; // Approximation.
+
+#else
+
if (!_debug_font_created) {
Error("Programming error: gtk_glwidget_font_ascent() called but font does not exist; "
"you should have called gtk_glwidget_create_font() first");
}
return font_ascent;
+
+#endif
}
// Units are pixels. Returns a positive value [most likely].
int gtk_glwidget_font_descent()
{
+#ifdef _WIN32
+
+ return 0; // Approximation.
+
+#else
+
if (!_debug_font_created) {
Error("Programming error: gtk_glwidget_font_descent() called but font does not exist; "
"you should have called gtk_glwidget_create_font() first");
}
return font_descent;
+
+#endif
+}
+
+#ifdef _WIN32
+
+void gtk_glwidget_create_font_win_internal()
+{
+ if (font_created) return;
+ font_created = 1;
+
+ PangoFontDescription *font_desc;
+ PangoFont *font;
+ PangoFontMetrics *font_metrics;
+
+ font_list_base = qglGenLists (256);
+
+ font_desc = pango_font_description_from_string (font_string);
+
+ font = gdk_gl_font_use_pango_font (font_desc, 0, 256, font_list_base);
+
+ if(font != NULL)
+ {
+ font_metrics = pango_font_get_metrics (font, NULL);
+
+ font_height = pango_font_metrics_get_ascent (font_metrics) +
+ pango_font_metrics_get_descent (font_metrics);
+ font_height = PANGO_PIXELS (font_height);
+
+ pango_font_metrics_unref (font_metrics);
+ }
+
+ pango_font_description_free (font_desc);
}
+#endif
+
void gtk_glwidget_create_font()
{
+#ifdef _WIN32
+
+ // Do nothing.
+
+#else
+
PangoFontDescription *font_desc;
PangoLayout *layout;
PangoRectangle log_rect;
font_ascent = PANGO_PIXELS_CEIL(font_ascent_pango_units);
font_descent = PANGO_PIXELS_CEIL(font_descent_pango_units);
y_offset_bitmap_render_pango_units = (font_ascent * PANGO_SCALE) - font_ascent_pango_units;
+
+#endif
}
void gtk_glwidget_destroy_font()
{
+#ifdef _WIN32
+
+ // Do nothing.
+
+#else
+
if (!_debug_font_created) {
Error("Programming error: gtk_glwidget_destroy_font() called when font "
"does not exist");
y_offset_bitmap_render_pango_units = -1;
g_object_unref(G_OBJECT(ft2_context));
_debug_font_created = 0;
+
+#endif
}
// Google for "glDrawPixels clipping".
void gtk_glwidget_print_string(const char *s)
{
+#ifdef _WIN32
+
+ gtk_glwidget_create_font_win_internal();
+ qglListBase(font_list_base);
+ qglCallLists(strlen(s), GL_UNSIGNED_BYTE, (unsigned char *)s);
+
+#else
+
// The idea for this code initially came from the font-pangoft2.c example that comes with GtkGLExt.
PangoLayout *layout;
}
g_object_unref(G_OBJECT(layout));
+
+#endif
}
void gtk_glwidget_print_char(char s)
{
+#ifdef _WIN32
+
+ gtk_glwidget_create_font_win_internal();
+ qglListBase(font_list_base);
+ qglCallLists(1, GL_UNSIGNED_BYTE, (unsigned char *) &s);
+
+#else
+
char str[2];
str[0] = s;
str[1] = '\0';
gtk_glwidget_print_string(str);
+
+#endif
}