X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=gdk%2Fgdkdraw.c;h=8ae417e4aa6b7fe95f92ff052aa5f515de58eb31;hb=95b3f3e46016e4993e60e8c139bfd03a106201ba;hp=3d39d3faacc73ee1d566f82b2333311f07039a52;hpb=f6f1ce01c6b33fe75e32c7e76ef5e7fc9ce494ab;p=~andy%2Fgtk diff --git a/gdk/gdkdraw.c b/gdk/gdkdraw.c index 3d39d3faa..8ae417e4a 100644 --- a/gdk/gdkdraw.c +++ b/gdk/gdkdraw.c @@ -12,9 +12,18 @@ * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. */ + +/* + * Modified by the GTK+ Team and others 1997-1999. See the AUTHORS + * file for a list of people on the GTK+ Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GTK+ at ftp://ftp.gtk.org/pub/gtk/. + */ + #include #include #include "gdk.h" @@ -292,6 +301,66 @@ gdk_draw_text (GdkDrawable *drawable, g_error("undefined font type\n"); } +void +gdk_draw_text_wc (GdkDrawable *drawable, + GdkFont *font, + GdkGC *gc, + gint x, + gint y, + const GdkWChar *text, + gint text_length) +{ + GdkWindowPrivate *drawable_private; + GdkFontPrivate *font_private; + GdkGCPrivate *gc_private; + + g_return_if_fail (drawable != NULL); + g_return_if_fail (font != NULL); + g_return_if_fail (gc != NULL); + g_return_if_fail (text != NULL); + + drawable_private = (GdkWindowPrivate*) drawable; + if (drawable_private->destroyed) + return; + gc_private = (GdkGCPrivate*) gc; + font_private = (GdkFontPrivate*) font; + + if (font->type == GDK_FONT_FONT) + { + XFontStruct *xfont = (XFontStruct *) font_private->xfont; + gchar *text_8bit; + gint i; + XSetFont(drawable_private->xdisplay, gc_private->xgc, xfont->fid); + text_8bit = g_new (gchar, text_length); + for (i=0; ixdisplay, drawable_private->xwindow, + gc_private->xgc, x, y, text_8bit, text_length); + g_free (text_8bit); + } + else if (font->type == GDK_FONT_FONTSET) + { + if (sizeof(GdkWChar) == sizeof(wchar_t)) + { + XwcDrawString (drawable_private->xdisplay, drawable_private->xwindow, + (XFontSet) font_private->xfont, + gc_private->xgc, x, y, (wchar_t *)text, text_length); + } + else + { + wchar_t *text_wchar; + gint i; + text_wchar = g_new (wchar_t, text_length); + for (i=0; ixdisplay, drawable_private->xwindow, + (XFontSet) font_private->xfont, + gc_private->xgc, x, y, text_wchar, text_length); + g_free (text_wchar); + } + } + else + g_error("undefined font type\n"); +} + void gdk_draw_pixmap (GdkDrawable *drawable, GdkGC *gc, @@ -432,12 +501,14 @@ gdk_draw_lines (GdkDrawable *drawable, g_return_if_fail (gc != NULL); drawable_private = (GdkWindowPrivate*) drawable; + if (drawable_private->destroyed) + return; gc_private = (GdkGCPrivate*) gc; XDrawLines (drawable_private->xdisplay, - drawable_private->xwindow, - gc_private->xgc, - (XPoint *) points, - npoints, - CoordModeOrigin); + drawable_private->xwindow, + gc_private->xgc, + (XPoint *) points, + npoints, + CoordModeOrigin); }