Commit d5839378 authored by Nalin Dahyabhai's avatar Nalin Dahyabhai

check for GTK+ 2.2, and if found, force use of multihead-safe APIs to try

* configure.in: check for GTK+ 2.2, and if found, force use of multihead-safe
	APIs to try to flush out some bugs.
* src/vte.c, src/vteapp.c, src/vtedraw.c, src/vtefc.c, src/vteglyph.c: clean
	up some sloppy multihead changes.
* src/vte.c, src/vte.h (vte_terminal_match_set_cursor_type): add.
* src/vtedraw.c, src/vtedraw.h: add a draw_char() method which is allowed to
	fail.
* src/vte.c(vte_terminal_draw_graphic): separate the width of a column and the
	number of columns to be drawn.  Use _vte_draw_char() to avoid
	crude approximations of characters when we have a font for them.
parent 7db421ff
2003-05-28 nalin
* configure.in: check for GTK+ 2.2, and if found, force use of
multihead-safe APIs to try to flush out some bugs.
* src/vte.c, src/vteapp.c, src/vtedraw.c, src/vtefc.c, src/vteglyph.c:
clean up some sloppy multihead changes.
* src/vte.c, src/vte.h (vte_terminal_match_set_cursor_type): add.
* src/vtedraw.c, src/vtedraw.h: add a draw_char() method which is
allowed to fail.
* src/vte.c(vte_terminal_draw_graphic): separate the width of a column
and the number of columns to be drawn. Use _vte_draw_char() to avoid
crude approximations of characters when we have a font for them.
2003-05-21 nalin
* src/vte.c(vte_terminal_scroll_region): force an entire window repaint
if we're supposed to scroll the background but we're not scrolling the
......
......@@ -31,11 +31,17 @@ fi
CFLAGS="$X_CFLAGS $CFLAGS"
LIBS="$X_LIBS $LIBS"
if pkg-config --exists "gtk+-2.0 >= 2.2" ; then
MODULEGTK="gtk+-2.0 >= 2.2"
AC_DEFINE(GDK_MULTIHEAD_SAFE,1,[Force use of GDK's multihead-safe APIs.])
else
MODULEGTK="gtk+-2.0"
fi
PKG_CHECK_MODULES(GLIB,glib-2.0)
PKG_CHECK_MODULES(GOBJECT,[glib-2.0 gobject-2.0])
PKG_CHECK_MODULES(GTK,[glib-2.0 gobject-2.0 gtk+-2.0])
PKG_CHECK_MODULES(GTK,[glib-2.0 gobject-2.0 $MODULEGTK])
wantedmodules="glib-2.0 gobject-2.0 gtk+-2.0 fontconfig"
wantedmodules="glib-2.0 gobject-2.0 $MODULEGTK fontconfig"
# Use Xft2 if Pango has Xft2 support and it isn't disabled.
if test "$have_x" = yes ; then
......
This diff is collapsed.
......@@ -281,6 +281,8 @@ int vte_terminal_match_add(VteTerminal *terminal, const char *match);
/* Set the cursor to be used when the pointer is over a given match. */
void vte_terminal_match_set_cursor(VteTerminal *terminal, int tag,
GdkCursor *cursor);
void vte_terminal_match_set_cursor_type(VteTerminal *terminal,
int tag, GdkCursorType cursor_type);
/* Remove a matching expression by tag. */
void vte_terminal_match_remove(VteTerminal *terminal, int tag);
......
......@@ -347,7 +347,12 @@ take_xconsole_ownership(GtkWidget *widget, gpointer data)
name = g_strdup_printf("MIT_CONSOLE_%s", hostname);
atom = gdk_atom_intern(name, FALSE);
#if GTK_CHECK_VERSION(2,2,0)
clipboard = gtk_clipboard_get_for_display(gtk_widget_get_display(widget),
atom);
#else
clipboard = gtk_clipboard_get(atom);
#endif
g_free(name);
gtk_clipboard_set_with_owner(clipboard,
......@@ -378,7 +383,6 @@ main(int argc, char **argv)
int i, j;
GList *args = NULL;
GdkColor fore, back, tint;
GdkCursor *gumby = NULL, *hand = NULL;
const char *usage = "Usage: %s "
"[ [-B image] | [-T] ] "
"[-D] "
......@@ -602,13 +606,11 @@ main(int argc, char **argv)
vte_terminal_match_add(VTE_TERMINAL(widget), "abcdefg");
if (dingus) {
i = vte_terminal_match_add(VTE_TERMINAL(widget), DINGUS1);
gumby = gdk_cursor_new(GDK_GUMBY);
vte_terminal_match_set_cursor(VTE_TERMINAL(widget), i, gumby);
gdk_cursor_unref(gumby);
hand = gdk_cursor_new(GDK_HAND1);
vte_terminal_match_set_cursor_type(VTE_TERMINAL(widget),
i, GDK_GUMBY);
i = vte_terminal_match_add(VTE_TERMINAL(widget), DINGUS2);
vte_terminal_match_set_cursor(VTE_TERMINAL(widget), i, hand);
gdk_cursor_unref(hand);
vte_terminal_match_set_cursor_type(VTE_TERMINAL(widget),
i, GDK_HAND1);
}
if (console) {
......
......@@ -129,6 +129,9 @@ GdkColormap *
_vte_draw_get_colormap(struct _vte_draw *draw, gboolean maybe_use_default)
{
GdkColormap *colormap;
#if GTK_CHECK_VERSION(2,2,0)
GdkScreen *screen;
#endif
g_return_val_if_fail(draw->impl != NULL, NULL);
g_return_val_if_fail(draw->impl->get_colormap != NULL, NULL);
colormap = draw->impl->get_colormap(draw);
......@@ -139,7 +142,12 @@ _vte_draw_get_colormap(struct _vte_draw *draw, gboolean maybe_use_default)
return NULL;
}
#if GTK_CHECK_VERSION(2,2,0)
colormap = gdk_screen_get_default_colormap(gdk_screen_get_default());
if (gtk_widget_has_screen(draw->widget)) {
screen = gtk_widget_get_screen(draw->widget);
} else {
screen = gdk_display_get_default_screen(gtk_widget_get_display(draw->widget));
}
colormap = gdk_screen_get_default_colormap(screen);
#else
colormap = gdk_colormap_get_system();
#endif
......@@ -257,6 +265,20 @@ _vte_draw_text(struct _vte_draw *draw,
draw->impl->draw_text(draw, requests, n_requests, color, alpha);
}
gboolean
_vte_draw_char(struct _vte_draw *draw,
struct _vte_draw_text_request *request,
GdkColor *color, guchar alpha)
{
g_return_val_if_fail(draw->started == TRUE, FALSE);
g_return_val_if_fail(draw->impl != NULL, FALSE);
if (draw->impl->draw_char == NULL) {
draw->impl->draw_text(draw, request, 1, color, alpha);
return TRUE;
}
return draw->impl->draw_char(draw, request, color, alpha);
}
void
_vte_draw_fill_rectangle(struct _vte_draw *draw,
gint x, gint y, gint width, gint height,
......
......@@ -74,6 +74,9 @@ struct _vte_draw_impl {
void (*draw_text)(struct _vte_draw *,
struct _vte_draw_text_request *, gsize,
GdkColor *, guchar);
gboolean (*draw_char)(struct _vte_draw *,
struct _vte_draw_text_request *,
GdkColor *, guchar);
void (*draw_rectangle)(struct _vte_draw *,
gint, gint, gint, gint,
GdkColor *, guchar);
......@@ -133,6 +136,9 @@ gboolean _vte_draw_get_using_fontconfig(struct _vte_draw *draw);
void _vte_draw_text(struct _vte_draw *draw,
struct _vte_draw_text_request *requests, gsize n_requests,
GdkColor *color, guchar alpha);
gboolean _vte_draw_char(struct _vte_draw *draw,
struct _vte_draw_text_request *request,
GdkColor *color, guchar alpha);
void _vte_draw_fill_rectangle(struct _vte_draw *draw,
gint x, gint y, gint width, gint height,
GdkColor *color, guchar alpha);
......
......@@ -63,9 +63,13 @@ _vte_fc_slant_from_pango_style(int style)
}
static void
_vte_fc_transcribe_from_pango_font_description(FcPattern *pattern,
_vte_fc_transcribe_from_pango_font_description(GtkWidget *widget,
FcPattern *pattern,
const PangoFontDescription *font_desc)
{
#if GTK_CHECK_VERSION(2,2,0)
GdkScreen *screen;
#endif
const char *family = "monospace";
PangoLanguage *language;
double size = 10.0;
......@@ -94,7 +98,12 @@ _vte_fc_transcribe_from_pango_font_description(FcPattern *pattern,
/* Set the language for the pattern. */
#if GTK_CHECK_VERSION(2,2,0)
context = gdk_pango_context_get_for_screen(gdk_screen_get_default());
if (gtk_widget_has_screen(widget)) {
screen = gtk_widget_get_screen(widget);
} else {
screen = gdk_display_get_default_screen(gtk_widget_get_display(widget));
}
context = gdk_pango_context_get_for_screen(screen);
#else
context = gdk_pango_context_get();
#endif
......@@ -122,7 +131,7 @@ _vte_fc_transcribe_from_pango_font_description(FcPattern *pattern,
}
static void
_vte_fc_defaults_from_gtk(FcPattern *pattern)
_vte_fc_defaults_from_gtk(GtkWidget *widget, FcPattern *pattern)
{
GtkSettings *settings;
#if GTK_CHECK_VERSION(2,2,0)
......@@ -134,7 +143,11 @@ _vte_fc_defaults_from_gtk(FcPattern *pattern)
/* Add any defaults configured for GTK+. */
#if GTK_CHECK_VERSION(2,2,0)
screen = gdk_screen_get_default();
if (gtk_widget_has_screen(widget)) {
screen = gtk_widget_get_screen(widget);
} else {
screen = gdk_display_get_default_screen(gtk_widget_get_display(widget));
}
settings = gtk_settings_get_for_screen(screen);
#else
settings = gtk_settings_get_default();
......@@ -246,7 +259,7 @@ _vte_fc_defaults_from_gtk(FcPattern *pattern)
}
static void
_vte_fc_defaults_from_rdb(FcPattern *pattern)
_vte_fc_defaults_from_rdb(GtkWidget *widget, FcPattern *pattern)
{
FcBool fcb;
double fcd;
......@@ -328,7 +341,8 @@ _vte_fc_defaults_from_rdb(FcPattern *pattern)
/* Create a sorted set of fontconfig patterns from a Pango font description
* and append them to the array. */
gboolean
_vte_fc_patterns_from_pango_font_desc(const PangoFontDescription *font_desc,
_vte_fc_patterns_from_pango_font_desc(GtkWidget *widget,
const PangoFontDescription *font_desc,
GArray *pattern_array,
_vte_fc_defaults_cb defaults_cb,
gpointer defaults_data)
......@@ -346,16 +360,17 @@ _vte_fc_patterns_from_pango_font_desc(const PangoFontDescription *font_desc,
pattern = FcPatternCreate();
/* Transcribe what we can get from the Pango font description. */
_vte_fc_transcribe_from_pango_font_description(pattern, font_desc);
_vte_fc_transcribe_from_pango_font_description(widget, pattern,
font_desc);
/* Add any defaults specified in the configuration. */
FcConfigSubstitute(NULL, pattern, FcMatchPattern);
/* Add any defaults configured for GTK+. */
_vte_fc_defaults_from_gtk(pattern);
_vte_fc_defaults_from_gtk(widget, pattern);
/* Add defaults configured via the resource database. */
_vte_fc_defaults_from_rdb(pattern);
_vte_fc_defaults_from_rdb(widget, pattern);
/* Add any defaults which are hard-coded in fontconfig. */
FcDefaultSubstitute(pattern);
......@@ -373,7 +388,7 @@ _vte_fc_patterns_from_pango_font_desc(const PangoFontDescription *font_desc,
tmp = FcFontRenderPrepare(NULL,
pattern,
fontset->fonts[i]);
_vte_fc_defaults_from_gtk(tmp);
_vte_fc_defaults_from_gtk(widget, tmp);
save = FcPatternDuplicate(tmp);
FcPatternDestroy(tmp);
g_array_append_val(pattern_array, save);
......@@ -387,7 +402,7 @@ _vte_fc_patterns_from_pango_font_desc(const PangoFontDescription *font_desc,
match = FcFontMatch(NULL, pattern, &result);
if (result == FcResultMatch) {
tmp = FcPatternDuplicate(match);
_vte_fc_defaults_from_gtk(tmp);
_vte_fc_defaults_from_gtk(widget, tmp);
save = FcPatternDuplicate(tmp);
FcPatternDestroy(tmp);
g_array_append_val(pattern_array, save);
......
......@@ -32,7 +32,8 @@ G_BEGIN_DECLS
typedef void (*_vte_fc_defaults_cb)(FcPattern *pattern, gpointer data);
gboolean
_vte_fc_patterns_from_pango_font_desc(const PangoFontDescription *font_desc,
_vte_fc_patterns_from_pango_font_desc(GtkWidget *widget,
const PangoFontDescription *font_desc,
GArray *pattern_array,
_vte_fc_defaults_cb defaults_cb,
gpointer defaults_data);
......
......@@ -223,7 +223,8 @@ _vte_ft2_set_text_font(struct _vte_draw *draw,
data->cache = NULL;
}
data->cache = _vte_glyph_cache_new();
_vte_glyph_cache_set_font_description(NULL, data->cache, fontdesc,
_vte_glyph_cache_set_font_description(draw->widget, NULL,
data->cache, fontdesc,
NULL, NULL);
}
......@@ -279,6 +280,24 @@ _vte_ft2_draw_text(struct _vte_draw *draw,
}
}
static gboolean
_vte_ft2_draw_char(struct _vte_draw *draw,
struct _vte_draw_text_request *request,
GdkColor *color, guchar alpha)
{
struct _vte_ft2_data *data;
data = (struct _vte_ft2_data*) draw->impl_data;
if (data->cache != NULL) {
if (_vte_glyph_get(data->cache, request->c) != NULL) {
_vte_ft2_draw_text(draw, request, 1, color, alpha);
return TRUE;
}
}
return FALSE;
}
static void
_vte_ft2_draw_rectangle(struct _vte_draw *draw,
gint x, gint y, gint width, gint height,
......@@ -348,6 +367,7 @@ struct _vte_draw_impl _vte_draw_ft2 = {
_vte_ft2_get_text_ascent,
_vte_ft2_get_using_fontconfig,
_vte_ft2_draw_text,
_vte_ft2_draw_char,
_vte_ft2_draw_rectangle,
_vte_ft2_fill_rectangle,
_vte_ft2_set_scroll,
......
......@@ -513,6 +513,24 @@ _vte_gl_draw_text(struct _vte_draw *draw,
glDrawPixels(columns, rows, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
}
static gboolean
_vte_gl_draw_char(struct _vte_draw *draw,
struct _vte_draw_text_request *request,
GdkColor *color, guchar alpha)
{
struct _vte_gl_data *data;
data = (struct _vte_gl_data*) draw->impl_data;
if (data->cache != NULL) {
if (_vte_glyph_get(data->cache, request->c) != NULL) {
_vte_gl_draw_text(draw, request, 1, color, alpha);
return TRUE;
}
}
return FALSE;
}
static void
_vte_gl_rectangle(struct _vte_draw *draw,
GLenum type,
......@@ -586,6 +604,7 @@ struct _vte_draw_impl _vte_draw_gl = {
_vte_gl_get_text_ascent,
_vte_gl_get_using_fontconfig,
_vte_gl_draw_text,
_vte_gl_draw_char,
_vte_gl_draw_rectangle,
_vte_gl_fill_rectangle,
_vte_gl_set_scroll,
......
......@@ -134,7 +134,8 @@ _vte_glyph_cache_free(struct _vte_glyph_cache *cache)
}
void
_vte_glyph_cache_set_font_description(FcConfig *config,
_vte_glyph_cache_set_font_description(GtkWidget *widget,
FcConfig *config,
struct _vte_glyph_cache *cache,
const PangoFontDescription *fontdesc,
_vte_fc_defaults_cb defaults_cb,
......@@ -154,7 +155,7 @@ _vte_glyph_cache_set_font_description(FcConfig *config,
/* Convert the font description to a sorted set of patterns. */
patterns = g_array_new(TRUE, TRUE, sizeof(FcPattern*));
if (!_vte_fc_patterns_from_pango_font_desc(fontdesc, patterns,
if (!_vte_fc_patterns_from_pango_font_desc(widget, fontdesc, patterns,
defaults_cb,
defaults_data)) {
g_array_free(patterns, TRUE);
......
......@@ -21,7 +21,7 @@
#ident "$Id$"
#include <glib.h>
#include <gtk/gtk.h>
#include "vtefc.h"
#include "vtergb.h"
......@@ -67,7 +67,7 @@ struct _vte_glyph_cache {
struct _vte_glyph_cache *_vte_glyph_cache_new(void);
void _vte_glyph_cache_free(struct _vte_glyph_cache *cache);
const FcPattern *_vte_glyph_cache_get_pattern(struct _vte_glyph_cache *cache);
void _vte_glyph_cache_set_font_description(FcConfig *config,
void _vte_glyph_cache_set_font_description(GtkWidget *widget, FcConfig *config,
struct _vte_glyph_cache *cache,
const PangoFontDescription *fontdesc,
_vte_fc_defaults_cb defaults_cb,
......
......@@ -279,7 +279,7 @@ _vte_pango_set_text_font(struct _vte_draw *draw,
if (gtk_widget_has_screen(draw->widget)) {
screen = gtk_widget_get_screen(draw->widget);
} else {
screen = gdk_screen_get_default();
screen = gdk_display_get_default_screen(gtk_widget_get_display(draw->widget));
}
ctx = gdk_pango_context_get_for_screen(screen);
#else
......@@ -396,6 +396,15 @@ _vte_pango_draw_text(struct _vte_draw *draw,
}
}
static gboolean
_vte_pango_draw_char(struct _vte_draw *draw,
struct _vte_draw_text_request *request,
GdkColor *color, guchar alpha)
{
_vte_pango_draw_text(draw, request, 1, color, alpha);
return TRUE;
}
static void
_vte_pango_draw_rectangle(struct _vte_draw *draw,
gint x, gint y, gint width, gint height,
......@@ -460,6 +469,7 @@ struct _vte_draw_impl _vte_draw_pango = {
_vte_pango_get_text_ascent,
_vte_pango_get_using_fontconfig,
_vte_pango_draw_text,
_vte_pango_draw_char,
_vte_pango_draw_rectangle,
_vte_pango_fill_rectangle,
_vte_pango_set_scroll,
......
......@@ -410,6 +410,15 @@ _vte_pango_x_draw_text(struct _vte_draw *draw,
}
}
static gboolean
_vte_pango_x_draw_char(struct _vte_draw *draw,
struct _vte_draw_text_request *request,
GdkColor *color, guchar alpha)
{
_vte_pango_x_draw_text(draw, request, 1, color, alpha);
return TRUE;
}
static void
_vte_pango_x_draw_rectangle(struct _vte_draw *draw,
gint x, gint y, gint width, gint height,
......@@ -474,6 +483,7 @@ struct _vte_draw_impl _vte_draw_pango_x = {
_vte_pango_x_get_text_ascent,
_vte_pango_x_get_using_fontconfig,
_vte_pango_x_draw_text,
_vte_pango_x_draw_char,
_vte_pango_x_draw_rectangle,
_vte_pango_x_fill_rectangle,
_vte_pango_x_set_scroll,
......
......@@ -176,6 +176,16 @@ _vte_skel_draw_text(struct _vte_draw *draw,
data = (struct _vte_skel_data*) draw->impl_data;
}
static gboolean
_vte_skel_draw_char(struct _vte_draw *draw,
struct _vte_draw_text_request *request,
GdkColor *color, guchar alpha)
{
struct _vte_skel_data *data;
data = (struct _vte_skel_data*) draw->impl_data;
return FALSE;
}
static void
_vte_skel_draw_rectangle(struct _vte_draw *draw,
gint x, gint y, gint width, gint height,
......@@ -222,6 +232,7 @@ struct _vte_draw_impl _vte_draw_skel = {
_vte_skel_get_text_ascent,
_vte_skel_get_using_fontconfig,
_vte_skel_draw_text,
_vte_skel_draw_char,
_vte_skel_draw_rectangle,
_vte_skel_fill_rectangle,
_vte_skel_set_scroll,
......
......@@ -48,6 +48,9 @@
#define CHAR_WIDTH_FUDGE 10
struct _vte_xft_font {
#if GTK_CHECK_VERSION(2,2,0)
GdkDisplay *display;
#endif
GArray *patterns;
GArray *fonts;
GTree *fontmap;
......@@ -77,20 +80,47 @@ _vte_xft_direct_compare(gconstpointer a, gconstpointer b)
return GPOINTER_TO_INT(a) - GPOINTER_TO_INT(b);
}
static gboolean
_vte_xft_char_exists(struct _vte_xft_font *font, XftFont *ftfont, FcChar32 c)
{
#if GTK_CHECK_VERSION(2,2,0)
return XftCharExists(GDK_DISPLAY_XDISPLAY(font->display),
ftfont,
c) == FcTrue;
#else
return XftCharExists(GDK_DISPLAY(), ftfont, c) == FcTrue;
#endif
}
static void
_vte_xft_text_extents(struct _vte_xft_font *font, XftFont *ftfont, FcChar32 c,
XGlyphInfo *extents)
{
#if GTK_CHECK_VERSION(2,2,0)
return XftTextExtents32(GDK_DISPLAY_XDISPLAY(font->display),
ftfont, &c, 1, extents);
#else
return XftTextExtents32(GDK_DISPLAY(), ftfont, &c, 1, extents);
#endif
}
static struct _vte_xft_font *
_vte_xft_font_open(const PangoFontDescription *fontdesc)
_vte_xft_font_open(GtkWidget *widget, const PangoFontDescription *fontdesc)
{
struct _vte_xft_font *font;
GArray *patterns;
patterns = g_array_new(TRUE, TRUE, sizeof(FcPattern*));
if (!_vte_fc_patterns_from_pango_font_desc(fontdesc, patterns,
if (!_vte_fc_patterns_from_pango_font_desc(widget, fontdesc, patterns,
NULL, NULL)) {
g_array_free(patterns, TRUE);
return NULL;
}
font = g_malloc0(sizeof(struct _vte_xft_font));
#if GTK_CHECK_VERSION(2,2,0)
font->display = gtk_widget_get_display(widget);
#endif
font->patterns = patterns;
font->fonts = g_array_new(TRUE, TRUE, sizeof(XftFont*));
font->fontmap = g_tree_new(_vte_xft_direct_compare);
......@@ -187,7 +217,7 @@ _vte_xft_font_for_char(struct _vte_xft_font *font, gunichar c)
for (i = 0; i < font->fonts->len; i++) {
ftfont = g_array_index(font->fonts, XftFont *, i);
if ((ftfont != NULL) &&
(XftCharExists(display, ftfont, (FcChar32) c) == FcTrue)) {
(_vte_xft_char_exists(font, ftfont, c))) {
break;
}
}
......@@ -215,7 +245,7 @@ _vte_xft_font_for_char(struct _vte_xft_font *font, gunichar c)
}
g_array_append_val(font->fonts, ftfont);
if ((ftfont != NULL) &&
(XftCharExists(display, ftfont, (FcChar32) c) == FcTrue)) {
(_vte_xft_char_exists(font, ftfont, c))) {
break;
}
}
......@@ -272,7 +302,7 @@ _vte_xft_char_width(struct _vte_xft_font *font, XftFont *ftfont, gunichar c)
/* Compute and store the width. */
memset(&extents, 0, sizeof(extents));
if (ftfont != NULL) {
XftTextExtents32(GDK_DISPLAY(), ftfont, &c, 1, &extents);
_vte_xft_text_extents(font, ftfont, c, &extents);
}
i = extents.xOff + CHAR_WIDTH_FUDGE;
g_tree_insert(font->widths, p, GINT_TO_POINTER(i));
......@@ -516,7 +546,7 @@ _vte_xft_set_text_font(struct _vte_draw *draw,
_vte_xft_font_close(data->font);
data->font = NULL;
}
data->font = _vte_xft_font_open(fontdesc);
data->font = _vte_xft_font_open(draw->widget, fontdesc);
draw->width = 1;
draw->height = 1;
......@@ -530,9 +560,9 @@ _vte_xft_set_text_font(struct _vte_draw *draw,
c = VTE_DRAW_SINGLE_WIDE_CHARACTERS[i];
font = _vte_xft_font_for_char(data->font, c);
if ((font != NULL) &&
(XftCharExists(GDK_DISPLAY(), font, c) == FcTrue)) {
(_vte_xft_char_exists(data->font, font, c))) {
memset(&extents, 0, sizeof(extents));
XftTextExtents32(GDK_DISPLAY(), font, &c, 1, &extents);
_vte_xft_text_extents(data->font, font, c, &extents);
n++;
width += extents.xOff;
}
......@@ -552,9 +582,9 @@ _vte_xft_set_text_font(struct _vte_draw *draw,
c = wide_chars[i];
font = _vte_xft_font_for_char(data->font, c);
if ((font != NULL) &&
(XftCharExists(GDK_DISPLAY(), font, c) == FcTrue)) {
(_vte_xft_char_exists(data->font, font, c))) {
memset(&extents, 0, sizeof(extents));
XftTextExtents32(GDK_DISPLAY(), font, &c, 1, &extents);
_vte_xft_text_extents(data->font, font, c, &extents);
n++;
width += extents.xOff;
}
......@@ -687,6 +717,21 @@ _vte_xft_draw_text(struct _vte_draw *draw,
}
}
static gboolean
_vte_xft_draw_char(struct _vte_draw *draw,
struct _vte_draw_text_request *request,
GdkColor *color, guchar alpha)
{
struct _vte_xft_data *data;
data = (struct _vte_xft_data*) draw->impl_data;
if (_vte_xft_font_for_char(data->font, request->c) != NULL) {
_vte_xft_draw_text(draw, request, 1, color, alpha);
return TRUE;
}
return FALSE;
}
static void
_vte_xft_draw_rectangle(struct _vte_draw *draw,
gint x, gint y, gint width, gint height,
......@@ -773,6 +818,7 @@ struct _vte_draw_impl _vte_draw_xft = {
_vte_xft_get_text_ascent,
_vte_xft_get_using_fontconfig,
_vte_xft_draw_text,
_vte_xft_draw_char,
_vte_xft_draw_rectangle,
_vte_xft_fill_rectangle,
_vte_xft_set_scroll,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment