diff options
author | Owen Taylor <otaylor@redhat.com> | 2001-02-27 04:30:56 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 2001-02-27 04:30:56 +0000 |
commit | 8875974d1824f14f19d67a421440cc2550a4b408 (patch) | |
tree | 6a1ec2b0479e73ff5d545aaf4856449d67cdd054 | |
parent | 46e0b468ed8a0745c4df3fbbf0ecf60cb307c148 (diff) | |
download | gdk-pixbuf-8875974d1824f14f19d67a421440cc2550a4b408.tar.gz |
Update to describe submitting patches and bug reports to
Mon Feb 26 16:34:33 2001 Owen Taylor <otaylor@redhat.com>
* README: Update to describe submitting patches
and bug reports to bugzilla.gnome.org.
Tue Feb 20 23:48:16 2001 Owen Taylor <otaylor@redhat.com>
* gdk/gdkim.c,gdk/gdkprivate.h: Add private function
_gdk_wcstombs_len() which takes a length.
* gdk/gdkfont.c,gdk/gdkprivate.h,gdk/gdkdraw.c:
Consistently handle calls to _wc() font for GDK_FONT_FONT
routines by:
a) for 8-bit fonts, converting to chars via wcstombs
(Will make GtkLabel handle using GDK_FONT_FONT for
non-iso-8859-1 a wee bit better, though GDK_FONT_FONTSET
is still the only supported way to get correct i18n.
#50834)
b) for 16-bit fonts, assuming each wchar is a glyph
index. (Broken, but no more broken than anything else)
-rw-r--r-- | ChangeLog | 23 | ||||
-rw-r--r-- | ChangeLog.pre-2-0 | 23 | ||||
-rw-r--r-- | ChangeLog.pre-2-10 | 23 | ||||
-rw-r--r-- | ChangeLog.pre-2-2 | 23 | ||||
-rw-r--r-- | ChangeLog.pre-2-4 | 23 | ||||
-rw-r--r-- | ChangeLog.pre-2-6 | 23 | ||||
-rw-r--r-- | ChangeLog.pre-2-8 | 23 | ||||
-rw-r--r-- | HACKING | 19 | ||||
-rw-r--r-- | README | 65 | ||||
-rw-r--r-- | gdk/gdkdraw.c | 18 | ||||
-rw-r--r-- | gdk/gdkfont.c | 158 | ||||
-rw-r--r-- | gdk/gdkim.c | 93 | ||||
-rw-r--r-- | gdk/gdkprivate.h | 8 |
13 files changed, 354 insertions, 168 deletions
@@ -1,3 +1,26 @@ +Mon Feb 26 16:34:33 2001 Owen Taylor <otaylor@redhat.com> + + * README: Update to describe submitting patches + and bug reports to bugzilla.gnome.org. + +Tue Feb 20 23:48:16 2001 Owen Taylor <otaylor@redhat.com> + + * gdk/gdkim.c,gdk/gdkprivate.h: Add private function + _gdk_wcstombs_len() which takes a length. + + * gdk/gdkfont.c,gdk/gdkprivate.h,gdk/gdkdraw.c: + Consistently handle calls to _wc() font for GDK_FONT_FONT + routines by: + + a) for 8-bit fonts, converting to chars via wcstombs + (Will make GtkLabel handle using GDK_FONT_FONT for + non-iso-8859-1 a wee bit better, though GDK_FONT_FONTSET + is still the only supported way to get correct i18n. + #50834) + + b) for 16-bit fonts, assuming each wchar is a glyph + index. (Broken, but no more broken than anything else) + Mon Feb 26 21:36:11 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkwindow.[ch] (gtk_window_focus_in/out_event): We can't diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index b6dda6286..90c7070f8 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,26 @@ +Mon Feb 26 16:34:33 2001 Owen Taylor <otaylor@redhat.com> + + * README: Update to describe submitting patches + and bug reports to bugzilla.gnome.org. + +Tue Feb 20 23:48:16 2001 Owen Taylor <otaylor@redhat.com> + + * gdk/gdkim.c,gdk/gdkprivate.h: Add private function + _gdk_wcstombs_len() which takes a length. + + * gdk/gdkfont.c,gdk/gdkprivate.h,gdk/gdkdraw.c: + Consistently handle calls to _wc() font for GDK_FONT_FONT + routines by: + + a) for 8-bit fonts, converting to chars via wcstombs + (Will make GtkLabel handle using GDK_FONT_FONT for + non-iso-8859-1 a wee bit better, though GDK_FONT_FONTSET + is still the only supported way to get correct i18n. + #50834) + + b) for 16-bit fonts, assuming each wchar is a glyph + index. (Broken, but no more broken than anything else) + Mon Feb 26 21:36:11 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkwindow.[ch] (gtk_window_focus_in/out_event): We can't diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index b6dda6286..90c7070f8 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,26 @@ +Mon Feb 26 16:34:33 2001 Owen Taylor <otaylor@redhat.com> + + * README: Update to describe submitting patches + and bug reports to bugzilla.gnome.org. + +Tue Feb 20 23:48:16 2001 Owen Taylor <otaylor@redhat.com> + + * gdk/gdkim.c,gdk/gdkprivate.h: Add private function + _gdk_wcstombs_len() which takes a length. + + * gdk/gdkfont.c,gdk/gdkprivate.h,gdk/gdkdraw.c: + Consistently handle calls to _wc() font for GDK_FONT_FONT + routines by: + + a) for 8-bit fonts, converting to chars via wcstombs + (Will make GtkLabel handle using GDK_FONT_FONT for + non-iso-8859-1 a wee bit better, though GDK_FONT_FONTSET + is still the only supported way to get correct i18n. + #50834) + + b) for 16-bit fonts, assuming each wchar is a glyph + index. (Broken, but no more broken than anything else) + Mon Feb 26 21:36:11 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkwindow.[ch] (gtk_window_focus_in/out_event): We can't diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index b6dda6286..90c7070f8 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,26 @@ +Mon Feb 26 16:34:33 2001 Owen Taylor <otaylor@redhat.com> + + * README: Update to describe submitting patches + and bug reports to bugzilla.gnome.org. + +Tue Feb 20 23:48:16 2001 Owen Taylor <otaylor@redhat.com> + + * gdk/gdkim.c,gdk/gdkprivate.h: Add private function + _gdk_wcstombs_len() which takes a length. + + * gdk/gdkfont.c,gdk/gdkprivate.h,gdk/gdkdraw.c: + Consistently handle calls to _wc() font for GDK_FONT_FONT + routines by: + + a) for 8-bit fonts, converting to chars via wcstombs + (Will make GtkLabel handle using GDK_FONT_FONT for + non-iso-8859-1 a wee bit better, though GDK_FONT_FONTSET + is still the only supported way to get correct i18n. + #50834) + + b) for 16-bit fonts, assuming each wchar is a glyph + index. (Broken, but no more broken than anything else) + Mon Feb 26 21:36:11 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkwindow.[ch] (gtk_window_focus_in/out_event): We can't diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index b6dda6286..90c7070f8 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,26 @@ +Mon Feb 26 16:34:33 2001 Owen Taylor <otaylor@redhat.com> + + * README: Update to describe submitting patches + and bug reports to bugzilla.gnome.org. + +Tue Feb 20 23:48:16 2001 Owen Taylor <otaylor@redhat.com> + + * gdk/gdkim.c,gdk/gdkprivate.h: Add private function + _gdk_wcstombs_len() which takes a length. + + * gdk/gdkfont.c,gdk/gdkprivate.h,gdk/gdkdraw.c: + Consistently handle calls to _wc() font for GDK_FONT_FONT + routines by: + + a) for 8-bit fonts, converting to chars via wcstombs + (Will make GtkLabel handle using GDK_FONT_FONT for + non-iso-8859-1 a wee bit better, though GDK_FONT_FONTSET + is still the only supported way to get correct i18n. + #50834) + + b) for 16-bit fonts, assuming each wchar is a glyph + index. (Broken, but no more broken than anything else) + Mon Feb 26 21:36:11 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkwindow.[ch] (gtk_window_focus_in/out_event): We can't diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index b6dda6286..90c7070f8 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,26 @@ +Mon Feb 26 16:34:33 2001 Owen Taylor <otaylor@redhat.com> + + * README: Update to describe submitting patches + and bug reports to bugzilla.gnome.org. + +Tue Feb 20 23:48:16 2001 Owen Taylor <otaylor@redhat.com> + + * gdk/gdkim.c,gdk/gdkprivate.h: Add private function + _gdk_wcstombs_len() which takes a length. + + * gdk/gdkfont.c,gdk/gdkprivate.h,gdk/gdkdraw.c: + Consistently handle calls to _wc() font for GDK_FONT_FONT + routines by: + + a) for 8-bit fonts, converting to chars via wcstombs + (Will make GtkLabel handle using GDK_FONT_FONT for + non-iso-8859-1 a wee bit better, though GDK_FONT_FONTSET + is still the only supported way to get correct i18n. + #50834) + + b) for 16-bit fonts, assuming each wchar is a glyph + index. (Broken, but no more broken than anything else) + Mon Feb 26 21:36:11 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkwindow.[ch] (gtk_window_focus_in/out_event): We can't diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index b6dda6286..90c7070f8 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,26 @@ +Mon Feb 26 16:34:33 2001 Owen Taylor <otaylor@redhat.com> + + * README: Update to describe submitting patches + and bug reports to bugzilla.gnome.org. + +Tue Feb 20 23:48:16 2001 Owen Taylor <otaylor@redhat.com> + + * gdk/gdkim.c,gdk/gdkprivate.h: Add private function + _gdk_wcstombs_len() which takes a length. + + * gdk/gdkfont.c,gdk/gdkprivate.h,gdk/gdkdraw.c: + Consistently handle calls to _wc() font for GDK_FONT_FONT + routines by: + + a) for 8-bit fonts, converting to chars via wcstombs + (Will make GtkLabel handle using GDK_FONT_FONT for + non-iso-8859-1 a wee bit better, though GDK_FONT_FONTSET + is still the only supported way to get correct i18n. + #50834) + + b) for 16-bit fonts, assuming each wchar is a glyph + index. (Broken, but no more broken than anything else) + Mon Feb 26 21:36:11 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkwindow.[ch] (gtk_window_focus_in/out_event): We can't @@ -41,16 +41,15 @@ to autogen.sh and they will be passed on to configure. If at all possible, please use CVS to get the latest development version of gtk+ and glib. You can do the following to get glib and gtk+ from cvs: - $ export CVSROOT=':pserver:anonymous@cvs.gimp.org:/debian/home/gnomecvs' + $ export CVSROOT=':pserver:anonymous@cvs.gnome.org:/cvs/gnome' $ cvs login (there is no password, just hit return) - $ cvs -z9 checkout glib - $ cvs -z9 checkout gtk+ - -Please submit patches to the gtk-list@redhat.com mailing list (you must -subscribe before you post, e-mail gtk-list-request@redhat.com with a -subject of "subscribe"). All kinds of contributions are accepted. -Patches that you wish to go into the distribution should also be uploaded -to ftp://ftp.gimp.org/incoming. Follow the rules there for naming your -patches. + $ cvs -z3 checkout glib + $ cvs -z3 checkout gtk+ + +For information about submitting patches and commiting changes +to CVS, see the README and README.cvs-commits files. In particular, +don't, under any circumstances, commit anything to CVS before +reading and understanding README.cvs-commmits. + @@ -12,11 +12,8 @@ The official ftp site is: The official web site is: http://www.gtk.org/ -A mailing list is located at: - gtk-list@redhat.com - -To subscribe: mail -s subscribe gtk-list-request@redhat.com < /dev/null -(Send mail to gtk-list-request@redhat.com with the subject "subscribe") +Information about mailing lists can be found at + http://www.gtk.org/mailinglists.html Installation ============ @@ -26,23 +23,11 @@ See the file 'INSTALL' How to report bugs ================== -Bugs should be reported to the GNOME bug tracking -system. (http://bugs.gnome.org). To report a problem -about GTK+, send mail to submit@bugs.gnome.org. - -The subject of the mail should describe your problem. -In the body of the mail, you should first include -a "pseudo-header" that gives the package and -version number. This should be separated by a blank -line from the actual headers. - - Package: gtk+ - Version: 1.2.9 +Bugs should be reported to the GNOME bug tracking system. +(http://bugzilla.gnome.org, product gtk+.) You will need +to create an account for yourself. -[ Please substitute 1.2.9 with the version of GTK+ that - you have installed ] - -Then describe the bug. Include: +In the bug report please include: * Information about your system. For instance: @@ -60,11 +45,6 @@ Then describe the bug. Include: As a last resort, you can also provide a pointer to a larger piece of software that can be downloaded. - (Bugs that can be reproduced within the GIMP are almost as good - as bugs that can be reproduced in testgtk. If you are reporting a - bug found with the GIMP, please include the version number of the GIMP - you are using) - * If the bug was a crash, the exact text that was printed out when the crash occured. @@ -74,28 +54,19 @@ Then describe the bug. Include: is produced running the test program with the --sync command line option. -An example of a bug report: - -==== -To: submit@bugs.gnome.org -From: yourname@your.address.org -Subject: handlebox test in testgtk is misnamed. - -Package: gtk+ -Version: 1.2.9 - -When I run gtk/testgtk, the button "handle box" -is misnamed. There are multiple handle boxes in -the demo, so it should be "handle boxes", to -be like "buttons" or "check buttons". -=== - Patches ======= -Patches can be uploaded to the incoming/ directory on -ftp.gtk.org. Please follow the instructions there, and include -your name and email address in the README file. +Patches should also be submitted to bugzilla.gnome.org. If the +patch fixes an existing bug, add the patch as an attachment +to that bug report. + +Otherwise, enter a new bug report that describes the patch, +and attach the patch to that bug report. + +Bug reports containing patches should include the PATCH keyword +in their keyword fields. If the patch adds to or changes the GTK+ +programming interface, the API keyword should also be included. -If the patch fixes a bug, it is usually a good idea to include -all the information described in "How to Report Bugs". +Patches should be in unified diff form. (The -u option to GNU +diff.) diff --git a/gdk/gdkdraw.c b/gdk/gdkdraw.c index 8ae417e4a..849e0e9b9 100644 --- a/gdk/gdkdraw.c +++ b/gdk/gdkdraw.c @@ -327,15 +327,15 @@ gdk_draw_text_wc (GdkDrawable *drawable, 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; i<text_length; i++) text_8bit[i] = text[i]; - XDrawString (drawable_private->xdisplay, drawable_private->xwindow, - gc_private->xgc, x, y, text_8bit, text_length); - g_free (text_8bit); + gchar *glyphs; + int glyphs_len; + + _gdk_font_wc_to_glyphs (font, text, text_length, + &glyphs, &glyphs_len); + + gdk_draw_text (drawable, font, gc, x, y, glyphs, glyphs_len); + + g_free (glyphs); } else if (font->type == GDK_FONT_FONTSET) { diff --git a/gdk/gdkfont.c b/gdk/gdkfont.c index 120d249d9..4acc2ce0a 100644 --- a/gdk/gdkfont.c +++ b/gdk/gdkfont.c @@ -374,7 +374,6 @@ gdk_text_width_wc (GdkFont *font, { GdkFontPrivate *private; gint width; - XFontStruct *xfont; XFontSet fontset; g_return_val_if_fail (font != NULL, -1); @@ -385,21 +384,19 @@ gdk_text_width_wc (GdkFont *font, switch (font->type) { case GDK_FONT_FONT: - xfont = (XFontStruct *) private->xfont; - if ((xfont->min_byte1 == 0) && (xfont->max_byte1 == 0)) - { - gchar *text_8bit; - gint i; - text_8bit = g_new (gchar, text_length); - for (i=0; i<text_length; i++) text_8bit[i] = text[i]; - width = XTextWidth (xfont, text_8bit, text_length); - g_free (text_8bit); - } - else - { - width = 0; - } - break; + { + gchar *glyphs; + int glyphs_len; + + _gdk_font_wc_to_glyphs (font, text, text_length, + &glyphs, &glyphs_len); + + width = gdk_text_width (font, glyphs, glyphs_len); + + g_free (glyphs); + + break; + } case GDK_FONT_FONTSET: if (sizeof(GdkWChar) == sizeof(wchar_t)) { @@ -475,10 +472,7 @@ gdk_char_width_wc (GdkFont *font, GdkWChar character) { GdkFontPrivate *private; - XCharStruct *chars; gint width; - guint ch = character & 0xff; /* get rid of sign-extension */ - XFontStruct *xfont; XFontSet fontset; g_return_val_if_fail (font != NULL, -1); @@ -488,25 +482,18 @@ gdk_char_width_wc (GdkFont *font, switch (font->type) { case GDK_FONT_FONT: - /* only 8 bits characters are considered here */ - xfont = (XFontStruct *) private->xfont; - if ((xfont->min_byte1 == 0) && - (xfont->max_byte1 == 0) && - (ch >= xfont->min_char_or_byte2) && - (ch <= xfont->max_char_or_byte2)) - { - chars = xfont->per_char; - if (chars) - width = chars[ch - xfont->min_char_or_byte2].width; - else - width = xfont->min_bounds.width; - } - else - { - char ch2 = character; - width = XTextWidth (xfont, &ch2, 1); - } - break; + { + gchar *glyphs; + int glyphs_len; + + _gdk_font_wc_to_glyphs (font, &character, 1, &glyphs, &glyphs_len); + + width = gdk_text_width (font, glyphs, glyphs_len); + + g_free (glyphs); + + break; + } case GDK_FONT_FONTSET: fontset = (XFontSet) private->xfont; { @@ -610,13 +597,8 @@ gdk_text_extents_wc (GdkFont *font, gint *descent) { GdkFontPrivate *private; - XCharStruct overall; - XFontStruct *xfont; XFontSet fontset; XRectangle ink, logical; - int direction; - int font_ascent; - int font_descent; g_return_if_fail (font != NULL); g_return_if_fail (text != NULL); @@ -627,31 +609,17 @@ gdk_text_extents_wc (GdkFont *font, { case GDK_FONT_FONT: { - gchar *text_8bit; - gint i; - - xfont = (XFontStruct *) private->xfont; - g_return_if_fail ((xfont->min_byte1 == 0) && (xfont->max_byte1 == 0)); - - text_8bit = g_new (gchar, text_length); - for (i=0; i<text_length; i++) - text_8bit[i] = text[i]; - - XTextExtents (xfont, text_8bit, text_length, - &direction, &font_ascent, &font_descent, - &overall); - g_free (text_8bit); - - if (lbearing) - *lbearing = overall.lbearing; - if (rbearing) - *rbearing = overall.rbearing; - if (width) - *width = overall.width; - if (ascent) - *ascent = overall.ascent; - if (descent) - *descent = overall.descent; + gchar *glyphs; + int glyphs_len; + + _gdk_font_wc_to_glyphs (font, text, text_length, + &glyphs, &glyphs_len); + + gdk_text_extents (font, glyphs, glyphs_len, + lbearing, rbearing, width, ascent, descent); + + g_free (glyphs); + break; } case GDK_FONT_FONTSET: @@ -827,3 +795,57 @@ gdk_char_height (GdkFont *font, return gdk_text_height (font, &character, 1); } + +void +_gdk_font_wc_to_glyphs (GdkFont *font, + const GdkWChar *text, + gint text_length, + gchar **result, + gint *result_length) +{ + XFontStruct *xfont; + GdkFontPrivate *font_private = (GdkFontPrivate*) font; + + g_return_if_fail (font != NULL); + g_return_if_fail (font->type == GDK_FONT_FONT); + + xfont = (XFontStruct *) font_private->xfont; + + if ((xfont->min_byte1 == 0) && (xfont->max_byte1 == 0)) + { + /* 8-bit font, assume that we are in a 8-bit locale, + * and convert to bytes using wcstombs. + */ + char *mbstr = _gdk_wcstombs_len (text, text_length); + + if (result_length) + *result_length = strlen (mbstr); + + if (result) + *result = mbstr; + else + g_free (mbstr); + } + else + { + /* 16-bit font. Who knows what was intended? Make a random + * guess. + */ + XChar2b *result2b = g_new (XChar2b, text_length + 1); + gint i; + + for (i = 0; i < text_length; i++) + { + result2b[i].byte1 = text[i] / 256; + result2b[i].byte2 = text[i] % 256; + } + + result2b[i].byte1 = result2b[i].byte2 = 0; + + if (result) + *result = (gchar *)result2b; + + if (result_length) + *result_length = text_length; + } +} diff --git a/gdk/gdkim.c b/gdk/gdkim.c index c3a151254..90b06c470 100644 --- a/gdk/gdkim.c +++ b/gdk/gdkim.c @@ -1484,67 +1484,92 @@ gdk_ic_get_events (GdkIC *ic) * * Returns a multi-byte string converted from the specified array * of wide characters. The string is newly allocated. The array of - * wide characters must be null-terminated. If the conversion is - * failed, it returns NULL. + * wide characters is nul-terminated, if len < 0 */ gchar * -gdk_wcstombs (const GdkWChar *src) +_gdk_wcstombs_len (const GdkWChar *src, + int len) { - gchar *mbstr; + gchar *mbstr = NULL; + gint length; + + if (len < 0) + { + length = 0; + + while (src[length] != 0) + length++; + } + else + length = len; if (gdk_use_mb) { XTextProperty tpr; + wchar_t *src_wc; - if (sizeof(wchar_t) != sizeof(GdkWChar)) + /* The len < 0 part is to ensure nul termination + */ + if (len < 0 && sizeof(wchar_t) == sizeof(GdkWChar)) { - gint i; - wchar_t *src_alt; - for (i=0; src[i]; i++); - src_alt = g_new (wchar_t, i+1); - for (; i>=0; i--) - src_alt[i] = src[i]; - if (XwcTextListToTextProperty (gdk_display, &src_alt, 1, XTextStyle, &tpr) - != Success) - { - g_free (src_alt); - return NULL; - } - g_free (src_alt); + src_wc = (wchar_t *)src; } else { - if (XwcTextListToTextProperty (gdk_display, (wchar_t**)&src, 1, - XTextStyle, &tpr) != Success) - { - return NULL; - } + gint i; + + src_wc = g_new (wchar_t, length + 1); + + for (i = 0; i < length; i++) + src_wc[i] = src[i]; + + src_wc[i] = 0; } - /* - * We must copy the string into an area allocated by glib, because - * the string 'tpr.value' must be freed by XFree(). - */ - mbstr = g_strdup(tpr.value); - XFree (tpr.value); + + if (XwcTextListToTextProperty (gdk_display, &src_wc, 1, + XTextStyle, &tpr) == Success) + { + /* + * We must copy the string into an area allocated by glib, because + * the string 'tpr.value' must be freed by XFree(). + */ + mbstr = g_strdup(tpr.value); + XFree (tpr.value); + } + + if (src_wc != (wchar_t *)src) + g_free (src_wc); } else { - gint length = 0; gint i; - while (src[length] != 0) - length++; - mbstr = g_new (gchar, length + 1); - for (i=0; i<length+1; i++) + for (i=0; i < length; i++) mbstr[i] = src[i]; + + mbstr[i] = '\0'; } return mbstr; } /* + * gdk_wcstombs + * + * Returns a multi-byte string converted from the specified array + * of wide characters. The string is newly allocated. The array of + * wide characters must be null-terminated. If the conversion is + * failed, it returns NULL. + */ +gchar * +gdk_wcstombs (const GdkWChar *src) +{ + return _gdk_wcstombs_len (src, -1); +} + +/* * gdk_mbstowcs * * Converts the specified string into wide characters, and, returns the diff --git a/gdk/gdkprivate.h b/gdk/gdkprivate.h index b54921185..7b49d1e94 100644 --- a/gdk/gdkprivate.h +++ b/gdk/gdkprivate.h @@ -322,6 +322,14 @@ extern GdkWindow *gdk_xim_window; /* currently using Window */ extern guint gdk_debug_flags; +void _gdk_font_wc_to_glyphs (GdkFont *font, + const GdkWChar *text, + gint text_length, + gchar **result, + gint *result_length); +gchar *_gdk_wcstombs_len (const GdkWChar *src, + int length); + #ifdef __cplusplus } #endif /* __cplusplus */ |