diff options
author | Silenio Quarti | 2006-06-08 17:17:38 +0000 |
---|---|---|
committer | Silenio Quarti | 2006-06-08 17:17:38 +0000 |
commit | ff95f186106d1d356c813d019de91a816aab9e4e (patch) | |
tree | 4220753843f346e82c75049c2cef2daec67bddd5 /bundles/org.eclipse.swt/Eclipse SWT/cairo | |
parent | 5782a7a6c12d443e5d141047bc86f8591d5777b4 (diff) | |
download | eclipse.platform.swt-ff95f186106d1d356c813d019de91a816aab9e4e.tar.gz eclipse.platform.swt-ff95f186106d1d356c813d019de91a816aab9e4e.tar.xz eclipse.platform.swt-ff95f186106d1d356c813d019de91a816aab9e4e.zip |
136472 - GC#drawText doesn't work with arabic text when advance is on
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/cairo')
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/cairo/org/eclipse/swt/graphics/Path.java | 23 |
1 files changed, 17 insertions, 6 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 3e928df842..c4908caae4 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,6 +13,7 @@ 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 @@ -185,13 +186,23 @@ 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; - 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); byte[] buffer = Converter.wcsToMbcs(null, string, true); - Cairo.cairo_text_path(handle, buffer); + 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); + } } /** |