gdk/win32/gdkdraw.c gdk/win32/gdkfont.c Various minor cleanups and

1999-11-08  Tor Lillqvist  <tml@iki.fi>

* gdk/win32/gdkdraw.c
* gdk/win32/gdkfont.c
* gdk/win32/gdkgc.c: Various minor cleanups and bugfixes
following yesterday's changes. (Unrelated to Owen's reorg.)
This commit is contained in:
Tor Lillqvist 1999-11-08 21:34:06 +00:00 committed by Tor Lillqvist
parent 5491cd971d
commit b5f414a1a5
13 changed files with 99 additions and 32 deletions

View File

@ -1,3 +1,10 @@
1999-11-08 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkdraw.c
* gdk/win32/gdkfont.c
* gdk/win32/gdkgc.c: Various minor cleanups and bugfixes
following yesterday's changes. (Unrelated to Owen's reorg.)
Mon Nov 8 16:18:25 1999 Owen Taylor <otaylor@redhat.com> Mon Nov 8 16:18:25 1999 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkinput-gxi.c: Add missing include, * gdk/x11/gdkinput-gxi.c: Add missing include,

View File

@ -1,3 +1,10 @@
1999-11-08 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkdraw.c
* gdk/win32/gdkfont.c
* gdk/win32/gdkgc.c: Various minor cleanups and bugfixes
following yesterday's changes. (Unrelated to Owen's reorg.)
Mon Nov 8 16:18:25 1999 Owen Taylor <otaylor@redhat.com> Mon Nov 8 16:18:25 1999 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkinput-gxi.c: Add missing include, * gdk/x11/gdkinput-gxi.c: Add missing include,

View File

@ -1,3 +1,10 @@
1999-11-08 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkdraw.c
* gdk/win32/gdkfont.c
* gdk/win32/gdkgc.c: Various minor cleanups and bugfixes
following yesterday's changes. (Unrelated to Owen's reorg.)
Mon Nov 8 16:18:25 1999 Owen Taylor <otaylor@redhat.com> Mon Nov 8 16:18:25 1999 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkinput-gxi.c: Add missing include, * gdk/x11/gdkinput-gxi.c: Add missing include,

View File

@ -1,3 +1,10 @@
1999-11-08 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkdraw.c
* gdk/win32/gdkfont.c
* gdk/win32/gdkgc.c: Various minor cleanups and bugfixes
following yesterday's changes. (Unrelated to Owen's reorg.)
Mon Nov 8 16:18:25 1999 Owen Taylor <otaylor@redhat.com> Mon Nov 8 16:18:25 1999 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkinput-gxi.c: Add missing include, * gdk/x11/gdkinput-gxi.c: Add missing include,

View File

@ -1,3 +1,10 @@
1999-11-08 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkdraw.c
* gdk/win32/gdkfont.c
* gdk/win32/gdkgc.c: Various minor cleanups and bugfixes
following yesterday's changes. (Unrelated to Owen's reorg.)
Mon Nov 8 16:18:25 1999 Owen Taylor <otaylor@redhat.com> Mon Nov 8 16:18:25 1999 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkinput-gxi.c: Add missing include, * gdk/x11/gdkinput-gxi.c: Add missing include,

View File

@ -1,3 +1,10 @@
1999-11-08 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkdraw.c
* gdk/win32/gdkfont.c
* gdk/win32/gdkgc.c: Various minor cleanups and bugfixes
following yesterday's changes. (Unrelated to Owen's reorg.)
Mon Nov 8 16:18:25 1999 Owen Taylor <otaylor@redhat.com> Mon Nov 8 16:18:25 1999 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkinput-gxi.c: Add missing include, * gdk/x11/gdkinput-gxi.c: Add missing include,

View File

@ -1,3 +1,10 @@
1999-11-08 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkdraw.c
* gdk/win32/gdkfont.c
* gdk/win32/gdkgc.c: Various minor cleanups and bugfixes
following yesterday's changes. (Unrelated to Owen's reorg.)
Mon Nov 8 16:18:25 1999 Owen Taylor <otaylor@redhat.com> Mon Nov 8 16:18:25 1999 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkinput-gxi.c: Add missing include, * gdk/x11/gdkinput-gxi.c: Add missing include,

View File

@ -447,13 +447,13 @@ gdk_draw_text_handler (GdkWin32SingleFont *singlefont,
int wclen, int wclen,
void *arg) void *arg)
{ {
HDC hdc;
HGDIOBJ oldfont; HGDIOBJ oldfont;
SIZE size; SIZE size;
GdkDrawablePrivate *drawable_private;
GdkGCPrivate *gc_private;
gdk_draw_text_arg *argp = (gdk_draw_text_arg *) arg; gdk_draw_text_arg *argp = (gdk_draw_text_arg *) arg;
if (!singlefont)
return;
if ((oldfont = SelectObject (argp->hdc, singlefont->xfont)) == NULL) if ((oldfont = SelectObject (argp->hdc, singlefont->xfont)) == NULL)
{ {
g_warning ("gdk_draw_text_handler: SelectObject failed"); g_warning ("gdk_draw_text_handler: SelectObject failed");
@ -465,7 +465,7 @@ gdk_draw_text_handler (GdkWin32SingleFont *singlefont,
GetTextExtentPoint32W (argp->hdc, wcstr, wclen, &size); GetTextExtentPoint32W (argp->hdc, wcstr, wclen, &size);
argp->x += size.cx; argp->x += size.cx;
SelectObject (hdc, oldfont); SelectObject (argp->hdc, oldfont);
} }
/* gdk_draw_text /* gdk_draw_text
@ -480,7 +480,6 @@ gdk_draw_text (GdkDrawable *drawable,
const gchar *text, const gchar *text,
gint text_length) gint text_length)
{ {
HDC hdc;
GdkDrawablePrivate *drawable_private; GdkDrawablePrivate *drawable_private;
GdkGCPrivate *gc_private; GdkGCPrivate *gc_private;
wchar_t *wcstr; wchar_t *wcstr;
@ -534,7 +533,6 @@ gdk_draw_text_wc (GdkDrawable *drawable,
const GdkWChar *text, const GdkWChar *text,
gint text_length) gint text_length)
{ {
HDC hdc;
GdkDrawablePrivate *drawable_private; GdkDrawablePrivate *drawable_private;
GdkGCPrivate *gc_private; GdkGCPrivate *gc_private;
gint i, wlen; gint i, wlen;

View File

@ -447,13 +447,13 @@ gdk_draw_text_handler (GdkWin32SingleFont *singlefont,
int wclen, int wclen,
void *arg) void *arg)
{ {
HDC hdc;
HGDIOBJ oldfont; HGDIOBJ oldfont;
SIZE size; SIZE size;
GdkDrawablePrivate *drawable_private;
GdkGCPrivate *gc_private;
gdk_draw_text_arg *argp = (gdk_draw_text_arg *) arg; gdk_draw_text_arg *argp = (gdk_draw_text_arg *) arg;
if (!singlefont)
return;
if ((oldfont = SelectObject (argp->hdc, singlefont->xfont)) == NULL) if ((oldfont = SelectObject (argp->hdc, singlefont->xfont)) == NULL)
{ {
g_warning ("gdk_draw_text_handler: SelectObject failed"); g_warning ("gdk_draw_text_handler: SelectObject failed");
@ -465,7 +465,7 @@ gdk_draw_text_handler (GdkWin32SingleFont *singlefont,
GetTextExtentPoint32W (argp->hdc, wcstr, wclen, &size); GetTextExtentPoint32W (argp->hdc, wcstr, wclen, &size);
argp->x += size.cx; argp->x += size.cx;
SelectObject (hdc, oldfont); SelectObject (argp->hdc, oldfont);
} }
/* gdk_draw_text /* gdk_draw_text
@ -480,7 +480,6 @@ gdk_draw_text (GdkDrawable *drawable,
const gchar *text, const gchar *text,
gint text_length) gint text_length)
{ {
HDC hdc;
GdkDrawablePrivate *drawable_private; GdkDrawablePrivate *drawable_private;
GdkGCPrivate *gc_private; GdkGCPrivate *gc_private;
wchar_t *wcstr; wchar_t *wcstr;
@ -534,7 +533,6 @@ gdk_draw_text_wc (GdkDrawable *drawable,
const GdkWChar *text, const GdkWChar *text,
gint text_length) gint text_length)
{ {
HDC hdc;
GdkDrawablePrivate *drawable_private; GdkDrawablePrivate *drawable_private;
GdkGCPrivate *gc_private; GdkGCPrivate *gc_private;
gint i, wlen; gint i, wlen;

View File

@ -789,12 +789,11 @@ gdk_font_load (const gchar *font_name)
font->ascent = textmetric.tmAscent; font->ascent = textmetric.tmAscent;
font->descent = textmetric.tmDescent; font->descent = textmetric.tmDescent;
GDK_NOTE (MISC, g_print ("... = %#x charset %s codepage %d (max %d bytes) " GDK_NOTE (MISC, g_print ("... = %#x charset %s codepage %d "
"asc %d desc %d\n", "asc %d desc %d\n",
singlefont->xfont, singlefont->xfont,
charset_name (singlefont->charset), charset_name (singlefont->charset),
singlefont->codepage, singlefont->codepage,
singlefont->cpinfo.MaxCharSize,
font->ascent, font->descent)); font->ascent, font->descent));
gdk_font_hash_insert (GDK_FONT_FONTSET, font, font_name); gdk_font_hash_insert (GDK_FONT_FONTSET, font, font_name);
@ -851,10 +850,16 @@ gdk_fontset_load (gchar *fontset_name)
singlefont = gdk_font_load_internal (s); singlefont = gdk_font_load_internal (s);
if (singlefont) if (singlefont)
{ {
GDK_NOTE
(MISC, g_print ("... = %#x charset %s codepage %d\n",
singlefont->xfont,
charset_name (singlefont->charset),
singlefont->codepage));
private->fonts = g_slist_append (private->fonts, singlefont); private->fonts = g_slist_append (private->fonts, singlefont);
oldfont = SelectObject (gdk_DC, singlefont->xfont); oldfont = SelectObject (gdk_DC, singlefont->xfont);
GetTextMetrics (gdk_DC, &textmetric); GetTextMetrics (gdk_DC, &textmetric);
singlefont->charset = GetTextCharsetInfo (gdk_DC, &singlefont->fs, 0); singlefont->charset =
GetTextCharsetInfo (gdk_DC, &singlefont->fs, 0);
SelectObject (gdk_DC, oldfont); SelectObject (gdk_DC, oldfont);
font->ascent = MAX (font->ascent, textmetric.tmAscent); font->ascent = MAX (font->ascent, textmetric.tmAscent);
font->descent = MAX (font->descent, textmetric.tmDescent); font->descent = MAX (font->descent, textmetric.tmDescent);
@ -932,6 +937,7 @@ gdk_font_unref (GdkFont *font)
list = list->next; list = list->next;
} }
g_slist_free (private->fonts);
break; break;
default: default:
@ -1130,6 +1136,8 @@ gdk_wchar_text_handle (GdkFont *font,
end = wcp + wclen; end = wcp + wclen;
private = (GdkFontPrivate *) font; private = (GdkFontPrivate *) font;
g_assert (private->ref_count > 0);
while (wcp < end) while (wcp < end)
{ {
/* Split Unicode string into pieces of the same class */ /* Split Unicode string into pieces of the same class */
@ -1175,6 +1183,9 @@ gdk_text_size_handler (GdkWin32SingleFont *singlefont,
HGDIOBJ oldfont; HGDIOBJ oldfont;
gdk_text_size_arg *arg = (gdk_text_size_arg *) argp; gdk_text_size_arg *arg = (gdk_text_size_arg *) argp;
if (!singlefont)
return;
if ((oldfont = SelectObject (gdk_DC, singlefont->xfont)) == NULL) if ((oldfont = SelectObject (gdk_DC, singlefont->xfont)) == NULL)
{ {
g_warning ("gdk_text_size_handler: SelectObject failed"); g_warning ("gdk_text_size_handler: SelectObject failed");
@ -1208,12 +1219,9 @@ gdk_text_size (GdkFont *font,
wcstr = g_new (wchar_t, text_length); wcstr = g_new (wchar_t, text_length);
if ((wlen = gdk_nmbstowchar_ts (wcstr, text, text_length, text_length)) == -1) if ((wlen = gdk_nmbstowchar_ts (wcstr, text, text_length, text_length)) == -1)
{ g_warning ("gdk_text_size: gdk_nmbstowchar_ts failed");
g_warning ("gdk_text_size: gdk_nmbstowchar_ts failed"); else
return FALSE; gdk_wchar_text_handle (font, wcstr, wlen, gdk_text_size_handler, arg);
}
gdk_wchar_text_handle (font, wcstr, wlen, gdk_text_size_handler, arg);
g_free (wcstr); g_free (wcstr);
@ -1347,6 +1355,8 @@ gdk_text_extents (GdkFont *font,
else else
gdk_wchar_text_handle (font, wcstr, wlen, gdk_text_size_handler, &arg); gdk_wchar_text_handle (font, wcstr, wlen, gdk_text_size_handler, &arg);
g_free (wcstr);
/* XXX This is quite bogus */ /* XXX This is quite bogus */
if (lbearing) if (lbearing)
*lbearing = 0; *lbearing = 0;

View File

@ -789,12 +789,11 @@ gdk_font_load (const gchar *font_name)
font->ascent = textmetric.tmAscent; font->ascent = textmetric.tmAscent;
font->descent = textmetric.tmDescent; font->descent = textmetric.tmDescent;
GDK_NOTE (MISC, g_print ("... = %#x charset %s codepage %d (max %d bytes) " GDK_NOTE (MISC, g_print ("... = %#x charset %s codepage %d "
"asc %d desc %d\n", "asc %d desc %d\n",
singlefont->xfont, singlefont->xfont,
charset_name (singlefont->charset), charset_name (singlefont->charset),
singlefont->codepage, singlefont->codepage,
singlefont->cpinfo.MaxCharSize,
font->ascent, font->descent)); font->ascent, font->descent));
gdk_font_hash_insert (GDK_FONT_FONTSET, font, font_name); gdk_font_hash_insert (GDK_FONT_FONTSET, font, font_name);
@ -851,10 +850,16 @@ gdk_fontset_load (gchar *fontset_name)
singlefont = gdk_font_load_internal (s); singlefont = gdk_font_load_internal (s);
if (singlefont) if (singlefont)
{ {
GDK_NOTE
(MISC, g_print ("... = %#x charset %s codepage %d\n",
singlefont->xfont,
charset_name (singlefont->charset),
singlefont->codepage));
private->fonts = g_slist_append (private->fonts, singlefont); private->fonts = g_slist_append (private->fonts, singlefont);
oldfont = SelectObject (gdk_DC, singlefont->xfont); oldfont = SelectObject (gdk_DC, singlefont->xfont);
GetTextMetrics (gdk_DC, &textmetric); GetTextMetrics (gdk_DC, &textmetric);
singlefont->charset = GetTextCharsetInfo (gdk_DC, &singlefont->fs, 0); singlefont->charset =
GetTextCharsetInfo (gdk_DC, &singlefont->fs, 0);
SelectObject (gdk_DC, oldfont); SelectObject (gdk_DC, oldfont);
font->ascent = MAX (font->ascent, textmetric.tmAscent); font->ascent = MAX (font->ascent, textmetric.tmAscent);
font->descent = MAX (font->descent, textmetric.tmDescent); font->descent = MAX (font->descent, textmetric.tmDescent);
@ -932,6 +937,7 @@ gdk_font_unref (GdkFont *font)
list = list->next; list = list->next;
} }
g_slist_free (private->fonts);
break; break;
default: default:
@ -1130,6 +1136,8 @@ gdk_wchar_text_handle (GdkFont *font,
end = wcp + wclen; end = wcp + wclen;
private = (GdkFontPrivate *) font; private = (GdkFontPrivate *) font;
g_assert (private->ref_count > 0);
while (wcp < end) while (wcp < end)
{ {
/* Split Unicode string into pieces of the same class */ /* Split Unicode string into pieces of the same class */
@ -1175,6 +1183,9 @@ gdk_text_size_handler (GdkWin32SingleFont *singlefont,
HGDIOBJ oldfont; HGDIOBJ oldfont;
gdk_text_size_arg *arg = (gdk_text_size_arg *) argp; gdk_text_size_arg *arg = (gdk_text_size_arg *) argp;
if (!singlefont)
return;
if ((oldfont = SelectObject (gdk_DC, singlefont->xfont)) == NULL) if ((oldfont = SelectObject (gdk_DC, singlefont->xfont)) == NULL)
{ {
g_warning ("gdk_text_size_handler: SelectObject failed"); g_warning ("gdk_text_size_handler: SelectObject failed");
@ -1208,12 +1219,9 @@ gdk_text_size (GdkFont *font,
wcstr = g_new (wchar_t, text_length); wcstr = g_new (wchar_t, text_length);
if ((wlen = gdk_nmbstowchar_ts (wcstr, text, text_length, text_length)) == -1) if ((wlen = gdk_nmbstowchar_ts (wcstr, text, text_length, text_length)) == -1)
{ g_warning ("gdk_text_size: gdk_nmbstowchar_ts failed");
g_warning ("gdk_text_size: gdk_nmbstowchar_ts failed"); else
return FALSE; gdk_wchar_text_handle (font, wcstr, wlen, gdk_text_size_handler, arg);
}
gdk_wchar_text_handle (font, wcstr, wlen, gdk_text_size_handler, arg);
g_free (wcstr); g_free (wcstr);
@ -1347,6 +1355,8 @@ gdk_text_extents (GdkFont *font,
else else
gdk_wchar_text_handle (font, wcstr, wlen, gdk_text_size_handler, &arg); gdk_wchar_text_handle (font, wcstr, wlen, gdk_text_size_handler, &arg);
g_free (wcstr);
/* XXX This is quite bogus */ /* XXX This is quite bogus */
if (lbearing) if (lbearing)
*lbearing = 0; *lbearing = 0;

View File

@ -29,6 +29,7 @@
#include <string.h> #include <string.h>
#include "gdkgc.h" #include "gdkgc.h"
#include "gdkfont.h"
#include "gdkpixmap.h" #include "gdkpixmap.h"
#include "gdkprivate.h" #include "gdkprivate.h"
#include "gdkx.h" #include "gdkx.h"
@ -92,7 +93,7 @@ gdk_gc_new_with_values (GdkWindow *window,
{ {
private->font = values->font; private->font = values->font;
gdk_font_ref (private->font); gdk_font_ref (private->font);
GDK_NOTE (MISC, g_print (" font=%#x", private->font)); GDK_NOTE (MISC, g_print (" font"));
} }
else else
private->font = NULL; private->font = NULL;

View File

@ -29,6 +29,7 @@
#include <string.h> #include <string.h>
#include "gdkgc.h" #include "gdkgc.h"
#include "gdkfont.h"
#include "gdkpixmap.h" #include "gdkpixmap.h"
#include "gdkprivate.h" #include "gdkprivate.h"
#include "gdkx.h" #include "gdkx.h"
@ -92,7 +93,7 @@ gdk_gc_new_with_values (GdkWindow *window,
{ {
private->font = values->font; private->font = values->font;
gdk_font_ref (private->font); gdk_font_ref (private->font);
GDK_NOTE (MISC, g_print (" font=%#x", private->font)); GDK_NOTE (MISC, g_print (" font"));
} }
else else
private->font = NULL; private->font = NULL;