Refactor the font handling code: I've moved all the code that
explicitly deals with GdkFont out into a new module, behind a
polymorphic interface (done by ad-hoc explicit vtable management in
C). This should allow me to drop in a Pango font handling module in
parallel with the existing one, meaning that GTK2 PuTTY will be able
to seamlessly switch between X11 server-side fonts and Pango client-
side ones as the user chooses, or even use a mixture of the two
(e.g. an X11 font for narrow characters and a Pango one for wide
characters, or vice versa).
In the process, incidentally, I got to the bottom of the `weird bug'
mentioned in the old do_text_internal(). It's not a bug in
gdk_draw_text_wc() as I had thought: it's simply that GdkWChar is a
32-bit type rather than a 16-bit one, so no wonder you have to
specify twice the length to find all the characters in the string!
However, there _is_ a bug in GTK2's gdk_draw_text_wc(), which causes
it to strip off everything above the low byte of each GdkWChar,
sigh. Solution to both problems is to use an array of the underlying
Xlib type XChar2b instead, and pass it to gdk_draw_text() cast to
gchar *. Grotty, but it works. (And it'll become significantly less
grotty if and when we have to stop using the GDK font handling
wrappers in favour of going direct to Xlib.)
[originally from svn r7933]
2008-03-22 11:40:23 +00:00
|
|
|
/*
|
|
|
|
* Header file for gtkfont.c. Has to be separate from unix.h
|
|
|
|
* because it depends on GTK data types, hence can't be included
|
|
|
|
* from cross-platform code (which doesn't go near GTK).
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef PUTTY_GTKFONT_H
|
|
|
|
#define PUTTY_GTKFONT_H
|
|
|
|
|
Refactor the GTK drawing system to do both GDK and Cairo.
We're going to have to use Cairo in the GTK3 port, because that's all
GTK3 supports; but we still need old-style GDK for GTK1 support, and
also for performance reasons in GTK2 (see below). Hence, this change
completely restructures GTK PuTTY's drawing code so that there's a
central 'drawing context' structure which contains a type code
indicating GDK or Cairo, and then either some GDK gubbins or some
Cairo gubbins as appropriate; all actual drawing is abstracted through
a set of routines which test the type code in that structure and do
one thing or another. And because the type code is tested at run time,
both sets of drawing primitives can be compiled in at once, and where
possible, they will be.
X server-side bitmap fonts are still supported in the Cairo world, but
because Cairo drawing is entirely client-side, they have to work by
cheekily downloading each glyph bitmap from the server when it's first
needed, and building up a client-side cache of 'cairo_surface_t's
containing the bitmaps with which we then draw on the window. This
technique works, but it's rather slow; hence, even in GTK2, we keep
the GDK drawing back end compiled in, and switch over to it when the
main selected font is a bitmap one.
One visible effect of the new Cairo routines is in the double-width
and double-height text you can get by sending ESC # 3, ESC # 4 and
ESC # 6 escape sequences. In GDK, that's always been done by a really
horrible process of manually scaling the bitmap, server-side, column
by column and row by row, causing each pixel to be exactly doubled or
quadrupled. But in Cairo, we can just set a transformation matrix, and
then that takes effect _before_ the scalable fonts are rendered - so
the results are visibly nicer, and use all the available resolution.
(Sadly, if you're using a server-side bitmap font as your primary one,
then the GDK backend will be selected for all drawing in the terminal
as a whole - so in that situation, even fallback characters absent
from the primary font and rendered by Pango will get the old GDK
scaling treatment. It's only if your main font is scalable, so that
the Cairo backend is selected, that DW/DH characters will come out
looking nice.)
2015-08-15 20:05:56 +00:00
|
|
|
/*
|
|
|
|
* We support two entirely different drawing systems: the old
|
|
|
|
* GDK1/GDK2 one which works on server-side X drawables, and the
|
|
|
|
* new-style Cairo one. GTK1 only supports GDK drawing; GTK3 only
|
|
|
|
* supports Cairo; GTK2 supports both, but deprecates GTK, so we only
|
|
|
|
* enable it if we aren't trying on purpose to compile without the
|
|
|
|
* deprecated functions.
|
|
|
|
*
|
|
|
|
* Our different font classes may prefer different drawing systems: X
|
|
|
|
* server-side fonts are a lot faster to draw with GDK, but for
|
|
|
|
* everything else we prefer Cairo, on general grounds of modernness
|
|
|
|
* and also in particular because its matrix-based scaling system
|
|
|
|
* gives much nicer results for double-width and double-height text
|
|
|
|
* when a scalable font is in use.
|
|
|
|
*/
|
|
|
|
#if !GTK_CHECK_VERSION(3,0,0) && !defined GDK_DISABLE_DEPRECATED
|
|
|
|
#define DRAW_TEXT_GDK
|
|
|
|
#endif
|
|
|
|
#if GTK_CHECK_VERSION(2,8,0)
|
|
|
|
#define DRAW_TEXT_CAIRO
|
|
|
|
#endif
|
|
|
|
|
2015-08-16 08:02:31 +00:00
|
|
|
#if GTK_CHECK_VERSION(3,0,0) || defined GDK_DISABLE_DEPRECATED
|
|
|
|
/*
|
|
|
|
* Where the facility is available, we prefer to render text on to a
|
|
|
|
* persistent server-side pixmap, and redraw windows by simply
|
|
|
|
* blitting rectangles of that pixmap into them as needed. This is
|
|
|
|
* better for performance since we avoid expensive font rendering
|
|
|
|
* calls where possible, and it's particularly good over a non-local X
|
|
|
|
* connection because the response to an expose event can now be a
|
|
|
|
* very simple rectangle-copy operation rather than a lot of fiddly
|
|
|
|
* drawing or bitmap transfer.
|
|
|
|
*
|
|
|
|
* However, GTK is deprecating the use of server-side pixmaps, so we
|
|
|
|
* have to disable this mode under some circumstances.
|
|
|
|
*/
|
|
|
|
#define NO_BACKING_PIXMAPS
|
|
|
|
#endif
|
|
|
|
|
Refactor the font handling code: I've moved all the code that
explicitly deals with GdkFont out into a new module, behind a
polymorphic interface (done by ad-hoc explicit vtable management in
C). This should allow me to drop in a Pango font handling module in
parallel with the existing one, meaning that GTK2 PuTTY will be able
to seamlessly switch between X11 server-side fonts and Pango client-
side ones as the user chooses, or even use a mixture of the two
(e.g. an X11 font for narrow characters and a Pango one for wide
characters, or vice versa).
In the process, incidentally, I got to the bottom of the `weird bug'
mentioned in the old do_text_internal(). It's not a bug in
gdk_draw_text_wc() as I had thought: it's simply that GdkWChar is a
32-bit type rather than a 16-bit one, so no wonder you have to
specify twice the length to find all the characters in the string!
However, there _is_ a bug in GTK2's gdk_draw_text_wc(), which causes
it to strip off everything above the low byte of each GdkWChar,
sigh. Solution to both problems is to use an array of the underlying
Xlib type XChar2b instead, and pass it to gdk_draw_text() cast to
gchar *. Grotty, but it works. (And it'll become significantly less
grotty if and when we have to stop using the GDK font handling
wrappers in favour of going direct to Xlib.)
[originally from svn r7933]
2008-03-22 11:40:23 +00:00
|
|
|
/*
|
|
|
|
* Exports from gtkfont.c.
|
|
|
|
*/
|
|
|
|
struct unifont_vtable; /* contents internal to gtkfont.c */
|
|
|
|
typedef struct unifont {
|
|
|
|
const struct unifont_vtable *vt;
|
|
|
|
/*
|
|
|
|
* `Non-static data members' of the `class', accessible to
|
|
|
|
* external code.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* public_charset is the charset used when the user asks for
|
|
|
|
* `Use font encoding'.
|
|
|
|
*/
|
2011-09-16 19:18:53 +00:00
|
|
|
int public_charset;
|
Refactor the font handling code: I've moved all the code that
explicitly deals with GdkFont out into a new module, behind a
polymorphic interface (done by ad-hoc explicit vtable management in
C). This should allow me to drop in a Pango font handling module in
parallel with the existing one, meaning that GTK2 PuTTY will be able
to seamlessly switch between X11 server-side fonts and Pango client-
side ones as the user chooses, or even use a mixture of the two
(e.g. an X11 font for narrow characters and a Pango one for wide
characters, or vice versa).
In the process, incidentally, I got to the bottom of the `weird bug'
mentioned in the old do_text_internal(). It's not a bug in
gdk_draw_text_wc() as I had thought: it's simply that GdkWChar is a
32-bit type rather than a 16-bit one, so no wonder you have to
specify twice the length to find all the characters in the string!
However, there _is_ a bug in GTK2's gdk_draw_text_wc(), which causes
it to strip off everything above the low byte of each GdkWChar,
sigh. Solution to both problems is to use an array of the underlying
Xlib type XChar2b instead, and pass it to gdk_draw_text() cast to
gchar *. Grotty, but it works. (And it'll become significantly less
grotty if and when we have to stop using the GDK font handling
wrappers in favour of going direct to Xlib.)
[originally from svn r7933]
2008-03-22 11:40:23 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Font dimensions needed by clients.
|
|
|
|
*/
|
|
|
|
int width, height, ascent, descent;
|
2011-09-16 19:18:54 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Indicates whether this font is capable of handling all glyphs
|
|
|
|
* (Pango fonts can do this because Pango automatically supplies
|
|
|
|
* missing glyphs from other fonts), or whether it would like a
|
|
|
|
* fallback font to cope with missing glyphs.
|
|
|
|
*/
|
|
|
|
int want_fallback;
|
Refactor the GTK drawing system to do both GDK and Cairo.
We're going to have to use Cairo in the GTK3 port, because that's all
GTK3 supports; but we still need old-style GDK for GTK1 support, and
also for performance reasons in GTK2 (see below). Hence, this change
completely restructures GTK PuTTY's drawing code so that there's a
central 'drawing context' structure which contains a type code
indicating GDK or Cairo, and then either some GDK gubbins or some
Cairo gubbins as appropriate; all actual drawing is abstracted through
a set of routines which test the type code in that structure and do
one thing or another. And because the type code is tested at run time,
both sets of drawing primitives can be compiled in at once, and where
possible, they will be.
X server-side bitmap fonts are still supported in the Cairo world, but
because Cairo drawing is entirely client-side, they have to work by
cheekily downloading each glyph bitmap from the server when it's first
needed, and building up a client-side cache of 'cairo_surface_t's
containing the bitmaps with which we then draw on the window. This
technique works, but it's rather slow; hence, even in GTK2, we keep
the GDK drawing back end compiled in, and switch over to it when the
main selected font is a bitmap one.
One visible effect of the new Cairo routines is in the double-width
and double-height text you can get by sending ESC # 3, ESC # 4 and
ESC # 6 escape sequences. In GDK, that's always been done by a really
horrible process of manually scaling the bitmap, server-side, column
by column and row by row, causing each pixel to be exactly doubled or
quadrupled. But in Cairo, we can just set a transformation matrix, and
then that takes effect _before_ the scalable fonts are rendered - so
the results are visibly nicer, and use all the available resolution.
(Sadly, if you're using a server-side bitmap font as your primary one,
then the GDK backend will be selected for all drawing in the terminal
as a whole - so in that situation, even fallback characters absent
from the primary font and rendered by Pango will get the old GDK
scaling treatment. It's only if your main font is scalable, so that
the Cairo backend is selected, that DW/DH characters will come out
looking nice.)
2015-08-15 20:05:56 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Preferred drawing API to use when this class of font is active.
|
|
|
|
* (See the enum below, in unifont_drawctx.)
|
|
|
|
*/
|
|
|
|
int preferred_drawtype;
|
Refactor the font handling code: I've moved all the code that
explicitly deals with GdkFont out into a new module, behind a
polymorphic interface (done by ad-hoc explicit vtable management in
C). This should allow me to drop in a Pango font handling module in
parallel with the existing one, meaning that GTK2 PuTTY will be able
to seamlessly switch between X11 server-side fonts and Pango client-
side ones as the user chooses, or even use a mixture of the two
(e.g. an X11 font for narrow characters and a Pango one for wide
characters, or vice versa).
In the process, incidentally, I got to the bottom of the `weird bug'
mentioned in the old do_text_internal(). It's not a bug in
gdk_draw_text_wc() as I had thought: it's simply that GdkWChar is a
32-bit type rather than a 16-bit one, so no wonder you have to
specify twice the length to find all the characters in the string!
However, there _is_ a bug in GTK2's gdk_draw_text_wc(), which causes
it to strip off everything above the low byte of each GdkWChar,
sigh. Solution to both problems is to use an array of the underlying
Xlib type XChar2b instead, and pass it to gdk_draw_text() cast to
gchar *. Grotty, but it works. (And it'll become significantly less
grotty if and when we have to stop using the GDK font handling
wrappers in favour of going direct to Xlib.)
[originally from svn r7933]
2008-03-22 11:40:23 +00:00
|
|
|
} unifont;
|
|
|
|
|
Refactor the GTK drawing system to do both GDK and Cairo.
We're going to have to use Cairo in the GTK3 port, because that's all
GTK3 supports; but we still need old-style GDK for GTK1 support, and
also for performance reasons in GTK2 (see below). Hence, this change
completely restructures GTK PuTTY's drawing code so that there's a
central 'drawing context' structure which contains a type code
indicating GDK or Cairo, and then either some GDK gubbins or some
Cairo gubbins as appropriate; all actual drawing is abstracted through
a set of routines which test the type code in that structure and do
one thing or another. And because the type code is tested at run time,
both sets of drawing primitives can be compiled in at once, and where
possible, they will be.
X server-side bitmap fonts are still supported in the Cairo world, but
because Cairo drawing is entirely client-side, they have to work by
cheekily downloading each glyph bitmap from the server when it's first
needed, and building up a client-side cache of 'cairo_surface_t's
containing the bitmaps with which we then draw on the window. This
technique works, but it's rather slow; hence, even in GTK2, we keep
the GDK drawing back end compiled in, and switch over to it when the
main selected font is a bitmap one.
One visible effect of the new Cairo routines is in the double-width
and double-height text you can get by sending ESC # 3, ESC # 4 and
ESC # 6 escape sequences. In GDK, that's always been done by a really
horrible process of manually scaling the bitmap, server-side, column
by column and row by row, causing each pixel to be exactly doubled or
quadrupled. But in Cairo, we can just set a transformation matrix, and
then that takes effect _before_ the scalable fonts are rendered - so
the results are visibly nicer, and use all the available resolution.
(Sadly, if you're using a server-side bitmap font as your primary one,
then the GDK backend will be selected for all drawing in the terminal
as a whole - so in that situation, even fallback characters absent
from the primary font and rendered by Pango will get the old GDK
scaling treatment. It's only if your main font is scalable, so that
the Cairo backend is selected, that DW/DH characters will come out
looking nice.)
2015-08-15 20:05:56 +00:00
|
|
|
/* A default drawtype, for the case where no font exists to make the
|
|
|
|
* decision with. */
|
|
|
|
#ifdef DRAW_TEXT_CAIRO
|
|
|
|
#define DRAW_DEFAULT_CAIRO
|
|
|
|
#define DRAWTYPE_DEFAULT DRAWTYPE_CAIRO
|
|
|
|
#elif defined DRAW_TEXT_GDK
|
|
|
|
#define DRAW_DEFAULT_GDK
|
|
|
|
#define DRAWTYPE_DEFAULT DRAWTYPE_GDK
|
|
|
|
#else
|
|
|
|
#error No drawtype available at all
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Drawing context passed in to unifont_draw_text, which contains
|
|
|
|
* everything required to know where and how to draw the requested
|
|
|
|
* text.
|
|
|
|
*/
|
|
|
|
typedef struct unifont_drawctx {
|
|
|
|
enum {
|
|
|
|
#ifdef DRAW_TEXT_GDK
|
|
|
|
DRAWTYPE_GDK,
|
|
|
|
#endif
|
|
|
|
#ifdef DRAW_TEXT_CAIRO
|
|
|
|
DRAWTYPE_CAIRO,
|
|
|
|
#endif
|
|
|
|
DRAWTYPE_NTYPES
|
|
|
|
} type;
|
|
|
|
union {
|
|
|
|
#ifdef DRAW_TEXT_GDK
|
|
|
|
struct {
|
|
|
|
GdkDrawable *target;
|
|
|
|
GdkGC *gc;
|
|
|
|
} gdk;
|
|
|
|
#endif
|
|
|
|
#ifdef DRAW_TEXT_CAIRO
|
|
|
|
struct {
|
|
|
|
/* Need an actual widget, in order to backtrack to its X
|
|
|
|
* screen number when creating server-side pixmaps */
|
|
|
|
GtkWidget *widget;
|
|
|
|
cairo_t *cr;
|
|
|
|
cairo_matrix_t origmatrix;
|
|
|
|
} cairo;
|
|
|
|
#endif
|
|
|
|
} u;
|
|
|
|
} unifont_drawctx;
|
|
|
|
|
2008-03-25 21:49:14 +00:00
|
|
|
unifont *unifont_create(GtkWidget *widget, const char *name,
|
|
|
|
int wide, int bold,
|
Refactor the font handling code: I've moved all the code that
explicitly deals with GdkFont out into a new module, behind a
polymorphic interface (done by ad-hoc explicit vtable management in
C). This should allow me to drop in a Pango font handling module in
parallel with the existing one, meaning that GTK2 PuTTY will be able
to seamlessly switch between X11 server-side fonts and Pango client-
side ones as the user chooses, or even use a mixture of the two
(e.g. an X11 font for narrow characters and a Pango one for wide
characters, or vice versa).
In the process, incidentally, I got to the bottom of the `weird bug'
mentioned in the old do_text_internal(). It's not a bug in
gdk_draw_text_wc() as I had thought: it's simply that GdkWChar is a
32-bit type rather than a 16-bit one, so no wonder you have to
specify twice the length to find all the characters in the string!
However, there _is_ a bug in GTK2's gdk_draw_text_wc(), which causes
it to strip off everything above the low byte of each GdkWChar,
sigh. Solution to both problems is to use an array of the underlying
Xlib type XChar2b instead, and pass it to gdk_draw_text() cast to
gchar *. Grotty, but it works. (And it'll become significantly less
grotty if and when we have to stop using the GDK font handling
wrappers in favour of going direct to Xlib.)
[originally from svn r7933]
2008-03-22 11:40:23 +00:00
|
|
|
int shadowoffset, int shadowalways);
|
|
|
|
void unifont_destroy(unifont *font);
|
Refactor the GTK drawing system to do both GDK and Cairo.
We're going to have to use Cairo in the GTK3 port, because that's all
GTK3 supports; but we still need old-style GDK for GTK1 support, and
also for performance reasons in GTK2 (see below). Hence, this change
completely restructures GTK PuTTY's drawing code so that there's a
central 'drawing context' structure which contains a type code
indicating GDK or Cairo, and then either some GDK gubbins or some
Cairo gubbins as appropriate; all actual drawing is abstracted through
a set of routines which test the type code in that structure and do
one thing or another. And because the type code is tested at run time,
both sets of drawing primitives can be compiled in at once, and where
possible, they will be.
X server-side bitmap fonts are still supported in the Cairo world, but
because Cairo drawing is entirely client-side, they have to work by
cheekily downloading each glyph bitmap from the server when it's first
needed, and building up a client-side cache of 'cairo_surface_t's
containing the bitmaps with which we then draw on the window. This
technique works, but it's rather slow; hence, even in GTK2, we keep
the GDK drawing back end compiled in, and switch over to it when the
main selected font is a bitmap one.
One visible effect of the new Cairo routines is in the double-width
and double-height text you can get by sending ESC # 3, ESC # 4 and
ESC # 6 escape sequences. In GDK, that's always been done by a really
horrible process of manually scaling the bitmap, server-side, column
by column and row by row, causing each pixel to be exactly doubled or
quadrupled. But in Cairo, we can just set a transformation matrix, and
then that takes effect _before_ the scalable fonts are rendered - so
the results are visibly nicer, and use all the available resolution.
(Sadly, if you're using a server-side bitmap font as your primary one,
then the GDK backend will be selected for all drawing in the terminal
as a whole - so in that situation, even fallback characters absent
from the primary font and rendered by Pango will get the old GDK
scaling treatment. It's only if your main font is scalable, so that
the Cairo backend is selected, that DW/DH characters will come out
looking nice.)
2015-08-15 20:05:56 +00:00
|
|
|
void unifont_draw_text(unifont_drawctx *ctx, unifont *font,
|
|
|
|
int x, int y, const wchar_t *string, int len,
|
|
|
|
int wide, int bold, int cellwidth);
|
2015-09-26 09:18:53 +00:00
|
|
|
/* Same as unifont_draw_text, but expects 'string' to contain one
|
|
|
|
* normal char plus combining chars, and overdraws them all in the
|
|
|
|
* same character cell. */
|
|
|
|
void unifont_draw_combining(unifont_drawctx *ctx, unifont *font,
|
|
|
|
int x, int y, const wchar_t *string, int len,
|
|
|
|
int wide, int bold, int cellwidth);
|
Refactor the font handling code: I've moved all the code that
explicitly deals with GdkFont out into a new module, behind a
polymorphic interface (done by ad-hoc explicit vtable management in
C). This should allow me to drop in a Pango font handling module in
parallel with the existing one, meaning that GTK2 PuTTY will be able
to seamlessly switch between X11 server-side fonts and Pango client-
side ones as the user chooses, or even use a mixture of the two
(e.g. an X11 font for narrow characters and a Pango one for wide
characters, or vice versa).
In the process, incidentally, I got to the bottom of the `weird bug'
mentioned in the old do_text_internal(). It's not a bug in
gdk_draw_text_wc() as I had thought: it's simply that GdkWChar is a
32-bit type rather than a 16-bit one, so no wonder you have to
specify twice the length to find all the characters in the string!
However, there _is_ a bug in GTK2's gdk_draw_text_wc(), which causes
it to strip off everything above the low byte of each GdkWChar,
sigh. Solution to both problems is to use an array of the underlying
Xlib type XChar2b instead, and pass it to gdk_draw_text() cast to
gchar *. Grotty, but it works. (And it'll become significantly less
grotty if and when we have to stop using the GDK font handling
wrappers in favour of going direct to Xlib.)
[originally from svn r7933]
2008-03-22 11:40:23 +00:00
|
|
|
|
2011-09-16 19:18:54 +00:00
|
|
|
/*
|
|
|
|
* This function behaves exactly like the low-level unifont_create,
|
|
|
|
* except that as well as the requested font it also allocates (if
|
|
|
|
* necessary) a fallback font for filling in replacement glyphs.
|
|
|
|
*
|
|
|
|
* Return value is usable with unifont_destroy and unifont_draw_text
|
|
|
|
* as if it were an ordinary unifont.
|
|
|
|
*/
|
|
|
|
unifont *multifont_create(GtkWidget *widget, const char *name,
|
|
|
|
int wide, int bold,
|
|
|
|
int shadowoffset, int shadowalways);
|
|
|
|
|
2008-03-25 21:49:14 +00:00
|
|
|
/*
|
|
|
|
* Unified font selector dialog. I can't be bothered to do a
|
|
|
|
* proper GTK subclassing today, so this will just be an ordinary
|
|
|
|
* data structure with some useful members.
|
|
|
|
*
|
|
|
|
* (Of course, these aren't the only members; this structure is
|
|
|
|
* contained within a bigger one which holds data visible only to
|
|
|
|
* the implementation.)
|
|
|
|
*/
|
|
|
|
typedef struct unifontsel {
|
|
|
|
void *user_data; /* settable by the user */
|
|
|
|
GtkWindow *window;
|
|
|
|
GtkWidget *ok_button, *cancel_button;
|
|
|
|
} unifontsel;
|
|
|
|
|
|
|
|
unifontsel *unifontsel_new(const char *wintitle);
|
|
|
|
void unifontsel_destroy(unifontsel *fontsel);
|
|
|
|
void unifontsel_set_name(unifontsel *fontsel, const char *fontname);
|
|
|
|
char *unifontsel_get_name(unifontsel *fontsel);
|
|
|
|
|
Refactor the font handling code: I've moved all the code that
explicitly deals with GdkFont out into a new module, behind a
polymorphic interface (done by ad-hoc explicit vtable management in
C). This should allow me to drop in a Pango font handling module in
parallel with the existing one, meaning that GTK2 PuTTY will be able
to seamlessly switch between X11 server-side fonts and Pango client-
side ones as the user chooses, or even use a mixture of the two
(e.g. an X11 font for narrow characters and a Pango one for wide
characters, or vice versa).
In the process, incidentally, I got to the bottom of the `weird bug'
mentioned in the old do_text_internal(). It's not a bug in
gdk_draw_text_wc() as I had thought: it's simply that GdkWChar is a
32-bit type rather than a 16-bit one, so no wonder you have to
specify twice the length to find all the characters in the string!
However, there _is_ a bug in GTK2's gdk_draw_text_wc(), which causes
it to strip off everything above the low byte of each GdkWChar,
sigh. Solution to both problems is to use an array of the underlying
Xlib type XChar2b instead, and pass it to gdk_draw_text() cast to
gchar *. Grotty, but it works. (And it'll become significantly less
grotty if and when we have to stop using the GDK font handling
wrappers in favour of going direct to Xlib.)
[originally from svn r7933]
2008-03-22 11:40:23 +00:00
|
|
|
#endif /* PUTTY_GTKFONT_H */
|