From 82d9762c932708c073b22d5340f37497e7b81612 Mon Sep 17 00:00:00 2001 From: Silenio Quarti Date: Tue, 13 Jun 2006 14:36:34 +0000 Subject: fixing compile problems on Motif --- .../cairo/org/eclipse/swt/graphics/Path.java | 19 +------------------ .../motif/org/eclipse/swt/graphics/GC.java | 9 +++++++++ 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cairo/org/eclipse/swt/graphics/Path.java b/bundles/org.eclipse.swt/Eclipse SWT/cairo/org/eclipse/swt/graphics/Path.java index c4908caae4..735dd5eebe 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/cairo/org/eclipse/swt/graphics/Path.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/cairo/org/eclipse/swt/graphics/Path.java @@ -13,7 +13,6 @@ package org.eclipse.swt.graphics; import org.eclipse.swt.*; import org.eclipse.swt.internal.*; import org.eclipse.swt.internal.cairo.*; -import org.eclipse.swt.internal.gtk.*; /** * Instances of this class represent paths through the two-dimensional @@ -186,23 +185,7 @@ public void addString(String string, float x, float y, Font font) { if (font == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); if (font.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT); move = false; - byte[] buffer = Converter.wcsToMbcs(null, string, true); - if (OS.GTK_VERSION >= OS.VERSION(2, 8, 0)) { - int /*long*/ layout = OS.pango_cairo_create_layout(handle); - if (layout == 0) SWT.error(SWT.ERROR_NO_HANDLES); - OS.pango_layout_set_text(layout, buffer, -1); - OS.pango_layout_set_font_description(layout, font.handle); - Cairo.cairo_move_to(handle, x, y); - OS.pango_cairo_layout_path(handle, layout); - OS.g_object_unref(layout); - } else { - GC.setCairoFont(handle, font); - cairo_font_extents_t extents = new cairo_font_extents_t(); - Cairo.cairo_font_extents(handle, extents); - double baseline = y + extents.ascent; - Cairo.cairo_move_to(handle, x, baseline); - Cairo.cairo_text_path(handle, buffer); - } + GC.addCairoString(handle, string, x, y, font); } /** diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/GC.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/GC.java index 9828025211..df1f06429e 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/GC.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/GC.java @@ -134,6 +134,15 @@ public GC(Drawable drawable, int style) { init(drawable, data, xGC); if (device.tracking) device.new_Object(this); } +static void addCairoString(int cairo, String string, float x, float y, Font font) { + byte[] buffer = Converter.wcsToMbcs(null, string, true); + GC.setCairoFont(cairo, font); + cairo_font_extents_t extents = new cairo_font_extents_t(); + Cairo.cairo_font_extents(cairo, extents); + double baseline = y + extents.ascent; + Cairo.cairo_move_to(cairo, x, baseline); + Cairo.cairo_text_path(cairo, buffer); +} static int checkStyle (int style) { if ((style & SWT.LEFT_TO_RIGHT) != 0) style &= ~SWT.RIGHT_TO_LEFT; return style & (SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT); -- cgit