From: Rudolf Polzer Date: Thu, 18 Nov 2010 11:55:49 +0000 (+0100) Subject: pango font stuff: remove reference to a deprectaed pango interface from the new ZeroR... X-Git-Tag: xonotic-v0.5.0~144^2~6 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=e240a832bda898b5be0289d1799b8fbd9cb06050;p=xonotic%2Fnetradiant.git pango font stuff: remove reference to a deprectaed pango interface from the new ZeroRadiant code (duh...); make pango a proper dependency now --- diff --git a/Makefile b/Makefile index bb2f743c..564a3c97 100644 --- a/Makefile +++ b/Makefile @@ -68,6 +68,9 @@ LIBS_PNG ?= $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKGCONFIG) li CPPFLAGS_GTK ?= $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKGCONFIG) gtk+-2.0 --cflags $(STDERR_TO_DEVNULL)) LIBS_GTK ?= $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKGCONFIG) gtk+-2.0 --libs-only-L $(STDERR_TO_DEVNULL)) \ $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKGCONFIG) gtk+-2.0 --libs-only-l $(STDERR_TO_DEVNULL)) +CPPFLAGS_PANGOFT2 ?= $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKGCONFIG) pangoft2 --cflags $(STDERR_TO_DEVNULL)) +LIBS_PANGOFT2 ?= $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKGCONFIG) pangoft2 --libs-only-L $(STDERR_TO_DEVNULL)) \ + $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKGCONFIG) pangoft2 --libs-only-l $(STDERR_TO_DEVNULL)) CPPFLAGS_GTKGLEXT ?= $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKGCONFIG) gtkglext-1.0 --cflags $(STDERR_TO_DEVNULL)) LIBS_GTKGLEXT ?= $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKGCONFIG) gtkglext-1.0 --libs-only-L $(STDERR_TO_DEVNULL)) \ $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKGCONFIG) gtkglext-1.0 --libs-only-l $(STDERR_TO_DEVNULL)) @@ -320,6 +323,7 @@ dependencies-check: checkheader libpng12-dev png.h png_create_read_struct "$(CPPFLAGS_PNG)" "$(LIBS_PNG)"; \ checkheader "mesa-common-dev (or another OpenGL library)" GL/gl.h glClear "$(CPPFLAGS_GL)" "$(LIBS_GL)"; \ checkheader libgtk2.0-dev gtk/gtkdialog.h gtk_dialog_run "$(CPPFLAGS_GTK)" "$(LIBS_GTK)"; \ + checkheader libpango1.0-dev pango/pangoft2.h pango_ft2_font_map_new "$(CPPFLAGS_PANGOFT2)" "$(LIBS_PANGOFT2)"; \ checkheader libgtkglext1-dev gtk/gtkglwidget.h gtk_widget_get_gl_context "$(CPPFLAGS_GTKGLEXT)" "$(LIBS_GTKGLEXT)"; \ [ "$(OS)" != "Win32" ] && checkheader libc6-dev dlfcn.h dlopen "$(CPPFLAGS_DL)" "$(LIBS_DL)"; \ checkheader zlib1g-dev zlib.h zlibVersion "$(CPPFLAGS_ZLIB)" "$(LIBS_ZLIB)"; \ @@ -544,8 +548,8 @@ $(INSTALLDIR)/q3data.$(EXE): \ $(if $(findstring $(OS),Win32),icons/q3data.o,) \ $(INSTALLDIR)/radiant.$(EXE): LDFLAGS_EXTRA := $(MWINDOWS) -$(INSTALLDIR)/radiant.$(EXE): LIBS_EXTRA := $(LIBS_GL) $(LIBS_DL) $(LIBS_XML) $(LIBS_GLIB) $(LIBS_GTK) $(LIBS_GTKGLEXT) $(LIBS_ZLIB) -$(INSTALLDIR)/radiant.$(EXE): CPPFLAGS_EXTRA := $(CPPFLAGS_GL) $(CPPFLAGS_DL) $(CPPFLAGS_XML) $(CPPFLAGS_GLIB) $(CPPFLAGS_GTK) $(CPPFLAGS_GTKGLEXT) -Ilibs -Iinclude +$(INSTALLDIR)/radiant.$(EXE): LIBS_EXTRA := $(LIBS_GL) $(LIBS_DL) $(LIBS_XML) $(LIBS_GLIB) $(LIBS_GTK) $(LIBS_GTKGLEXT) $(LIBS_ZLIB) $(LIBS_PANGOFT2) +$(INSTALLDIR)/radiant.$(EXE): CPPFLAGS_EXTRA := $(CPPFLAGS_GL) $(CPPFLAGS_DL) $(CPPFLAGS_XML) $(CPPFLAGS_GLIB) $(CPPFLAGS_GTK) $(CPPFLAGS_GTKGLEXT) $(CPPFLAGS_PANGOFT2) -Ilibs -Iinclude $(INSTALLDIR)/radiant.$(EXE): \ radiant/autosave.o \ radiant/brushmanip.o \ @@ -645,7 +649,7 @@ libprofile.$(A): \ libs/profile/file.o \ libs/profile/profile.o \ -libgtkutil.$(A): CPPFLAGS_EXTRA := $(CPPFLAGS_GLIB) $(CPPFLAGS_GTK) $(CPPFLAGS_GTKGLEXT) -Ilibs -Iinclude +libgtkutil.$(A): CPPFLAGS_EXTRA := $(CPPFLAGS_GLIB) $(CPPFLAGS_GTK) $(CPPFLAGS_GTKGLEXT) $(CPPFLAGS_PANGOFT2) -Ilibs -Iinclude libgtkutil.$(A): \ libs/gtkutil/accelerator.o \ libs/gtkutil/button.o \ diff --git a/libs/gtkutil/glfont.cpp b/libs/gtkutil/glfont.cpp index 962f3fe9..f2095a8b 100644 --- a/libs/gtkutil/glfont.cpp +++ b/libs/gtkutil/glfont.cpp @@ -163,6 +163,7 @@ void glfont_release(GLFont& font) // new font code ripped from ZeroRadiant (not in use yet) #include +#include #include "igl.h" class GLFontInternal @@ -173,9 +174,10 @@ class GLFontInternal int font_descent; int y_offset_bitmap_render_pango_units; PangoContext *ft2_context; + PangoFontMap *fontmap; public: - GLFontInternal(const char *_font_string): font_string(font_string) + GLFontInternal(const char *_font_string): font_string(_font_string) { PangoFontDescription *font_desc; PangoLayout *layout; @@ -183,12 +185,16 @@ class GLFontInternal int font_ascent_pango_units; int font_descent_pango_units; - // This call is deprecated so we'll have to fix it sometime. - ft2_context = pango_ft2_get_context(72, 72); + //ft2_context = pango_ft2_get_context(72, 72); + fontmap = pango_ft2_font_map_new(); + pango_ft2_font_map_set_resolution(PANGO_FT2_FONT_MAP(fontmap), 72, 72); + ft2_context = pango_font_map_create_context(fontmap); font_desc = pango_font_description_from_string(font_string); + //pango_font_description_set_size(font_desc, 10 * PANGO_SCALE); pango_context_set_font_description(ft2_context, font_desc); pango_font_description_free(font_desc); + // TODO fallback to fixed 8, courier new 8 layout = pango_layout_new(ft2_context); #if !PANGO_VERSION_CHECK(1,22,0) @@ -212,6 +218,7 @@ class GLFontInternal ~GLFontInternal() { g_object_unref(G_OBJECT(ft2_context)); + g_object_unref(G_OBJECT(fontmap)); } // Renders the input text at the current location with the current color.