Strip out all Xft, FreeType, and pangoxft checking. Rewrite X checks to

2005-08-09  Owen Taylor  <otaylor@redhat.com>

        * configure.in: Strip out all Xft, FreeType, and pangoxft checking.
        Rewrite X checks to use pkg-config as much as possible.

        * gdk/win32/gdkfont-win32.c (gdk_font_from_description_for_display): Make
        this return Arial always to avoid using PangoWin32FontMap. (X11 backend
        has always been returned "fixed" for a long time)

        * gdk/linux-fb/gdkdrawable-fb2.c: Remove draw_glyphs() implementations,
        fall through to the default implementation in terms of Cairo.

        * gdk/linux-fb/gdkdrawable-fb2.c (gdk_fb_draw_text): Use gdk_draw_glyphs()
        on the wrapper rather than gdk_fb_draw_glyphs()
This commit is contained in:
Owen Taylor
2005-08-10 02:31:51 +00:00
committed by Owen Taylor
parent 5c7cba1803
commit bfd04045e5
6 changed files with 265 additions and 421 deletions

View File

@ -152,12 +152,6 @@ static void gdk_shadow_fb_draw_text_wc (GdkDrawable *drawable
gint y,
const GdkWChar *text,
gint text_length);
static void gdk_shadow_fb_draw_glyphs (GdkDrawable *drawable,
GdkGC *gc,
PangoFont *font,
gint x,
gint y,
PangoGlyphString *glyphs);
static void gdk_shadow_fb_draw_drawable (GdkDrawable *drawable,
GdkGC *gc,
GdkPixmap *src,
@ -224,7 +218,6 @@ gdk_drawable_impl_fb_class_init (GdkDrawableFBClass *klass)
drawable_class->draw_points = gdk_shadow_fb_draw_points;
drawable_class->draw_segments = gdk_shadow_fb_draw_segments;
drawable_class->draw_lines = gdk_shadow_fb_draw_lines;
drawable_class->draw_glyphs = gdk_shadow_fb_draw_glyphs;
drawable_class->draw_image = gdk_shadow_fb_draw_image;
#else
drawable_class->draw_rectangle = gdk_fb_draw_rectangle;
@ -236,7 +229,6 @@ gdk_drawable_impl_fb_class_init (GdkDrawableFBClass *klass)
drawable_class->draw_points = gdk_fb_draw_points;
drawable_class->draw_segments = gdk_fb_draw_segments;
drawable_class->draw_lines = gdk_fb_draw_lines;
drawable_class->draw_glyphs = gdk_fb_draw_glyphs;
drawable_class->draw_image = gdk_fb_draw_image;
#endif
@ -853,6 +845,7 @@ gdk_fb_draw_text(GdkDrawable *drawable,
gint text_length)
{
GdkFontPrivateFB *private;
GdkDrawableFBData *drawable_private;
guchar *utf8, *utf8_end;
PangoGlyphString *glyphs = pango_glyph_string_new ();
PangoEngineShape *shaper, *last_shaper;
@ -865,6 +858,7 @@ gdk_fb_draw_text(GdkDrawable *drawable,
g_return_if_fail (text != NULL);
private = (GdkFontPrivateFB*) font;
drawable_private = GDK_DRAWABLE_FBDATA (drawable);
utf8 = alloca (text_length*2);
@ -906,9 +900,10 @@ gdk_fb_draw_text(GdkDrawable *drawable,
pango_shape (start, p - start, &analysis, glyphs);
gdk_fb_draw_glyphs (drawable, gc, private->pango_font,
x + PANGO_PIXELS (x_offset), y,
glyphs);
gdk_draw_glyphs (drawable_private->wrapper,
gc, private->pango_font,
x + PANGO_PIXELS (x_offset), y,
glyphs);
for (i = 0; i < glyphs->num_glyphs; i++)
x_offset += glyphs->glyphs[i].geometry.width;
@ -928,9 +923,10 @@ gdk_fb_draw_text(GdkDrawable *drawable,
pango_shape (start, p - start, &analysis, glyphs);
gdk_fb_draw_glyphs (drawable, gc, private->pango_font,
x + PANGO_PIXELS (x_offset), y,
glyphs);
gdk_draw_glyphs (drawable_private->wrapper,
gc, private->pango_font,
x + PANGO_PIXELS (x_offset), y,
glyphs);
}
pango_glyph_string_free (glyphs);
@ -1204,93 +1200,6 @@ gdk_fb_drawable_clear (GdkDrawable *d)
_gdk_windowing_window_clear_area (d, 0, 0, GDK_DRAWABLE_IMPL_FBDATA (d)->width, GDK_DRAWABLE_IMPL_FBDATA (d)->height);
}
static void
_gdk_fb_draw_glyphs (GdkDrawable *drawable,
GdkGC *gc,
PangoFont *font,
gint x,
gint y,
PangoGlyphString *glyphs,
GdkRectangle *bbox)
{
GdkFBDrawingContext fbdc;
GdkPixmapFBData pixmap;
PangoGlyphInfo *gi;
FT_Face face;
FT_UInt glyph_index;
int i, xpos;
int maxy, miny;
int topy;
g_return_if_fail (font);
gdk_fb_drawing_context_init (&fbdc, drawable, gc, FALSE, TRUE);
/* Fake its existence as a pixmap */
((GTypeInstance *)&pixmap)->g_class = g_type_class_peek (_gdk_pixmap_impl_get_type ());
pixmap.drawable_data.abs_x = 0;
pixmap.drawable_data.abs_y = 0;
pixmap.drawable_data.depth = 78;
maxy = miny = 0;
gi = glyphs->glyphs;
for (i = 0, xpos = 0; i < glyphs->num_glyphs; i++, gi++)
{
if (gi->glyph)
{
glyph_index = gi->glyph;
face = pango_ft2_font_get_face (font);
if (face)
{
/* Draw glyph */
FT_Load_Glyph (face, glyph_index, FT_LOAD_DEFAULT);
if (face->glyph->format != ft_glyph_format_bitmap)
FT_Render_Glyph (face->glyph, ft_render_mode_normal);
pixmap.drawable_data.mem = face->glyph->bitmap.buffer;
pixmap.drawable_data.rowstride = face->glyph->bitmap.pitch;
pixmap.drawable_data.width = face->glyph->bitmap.width;
pixmap.drawable_data.height = face->glyph->bitmap.rows;
topy = y - face->glyph->bitmap_top + 1;
miny = MIN (miny, topy);
maxy = MAX (maxy, topy + face->glyph->bitmap.rows);
gdk_fb_draw_drawable_3 (drawable, gc, (GdkPixmap *)&pixmap,
&fbdc,
0, 0,
x + PANGO_PIXELS (xpos) + face->glyph->bitmap_left,
topy,
face->glyph->bitmap.width, face->glyph->bitmap.rows);
}
}
xpos += glyphs->glyphs[i].geometry.width;
}
gdk_fb_drawing_context_finalize (&fbdc);
if (bbox)
{
bbox->x = x;
bbox->y = miny;
bbox->width = xpos;
bbox->height = maxy - miny;
}
}
static void
gdk_fb_draw_glyphs (GdkDrawable *drawable,
GdkGC *gc,
PangoFont *font,
gint x,
gint y,
PangoGlyphString *glyphs)
{
_gdk_fb_draw_glyphs (drawable, gc, font, x, y, glyphs, NULL);
}
static void
gdk_fb_draw_image (GdkDrawable *drawable,
GdkGC *gc,
@ -1491,25 +1400,6 @@ gdk_shadow_fb_draw_text_wc (GdkDrawable *drawable,
gdk_fb_draw_text_wc (drawable, font, gc, x, y, text, text_length);
}
static void
gdk_shadow_fb_draw_glyphs (GdkDrawable *drawable,
GdkGC *gc,
PangoFont *font,
gint x,
gint y,
PangoGlyphString *glyphs)
{
GdkDrawableFBData *private;
GdkRectangle bbox;
_gdk_fb_draw_glyphs (drawable, gc, font, x, y, glyphs, &bbox);
private = GDK_DRAWABLE_FBDATA (drawable);
if (GDK_IS_WINDOW (private->wrapper))
gdk_shadow_fb_update (bbox.x + private->abs_x, bbox.y + private->abs_y,
bbox.x + private->abs_x + bbox.width, bbox.y + private->abs_y + bbox.height);
}
static void
gdk_shadow_fb_draw_drawable (GdkDrawable *drawable,
GdkGC *gc,

View File

@ -30,8 +30,6 @@
#include <stdlib.h>
#include <ctype.h>
#include <pango/pangowin32.h>
#include "gdkfont.h"
#include "gdkpango.h" /* gdk_pango_context_get() */
#include "gdkdisplay.h"
@ -1239,27 +1237,31 @@ GdkFont*
gdk_font_from_description_for_display (GdkDisplay *display,
PangoFontDescription *font_desc)
{
PangoFontMap *font_map;
PangoFont *font;
GdkFont *result = NULL;
LOGFONT logfont;
int size;
g_return_val_if_fail (font_desc != NULL, NULL);
g_return_val_if_fail (display == gdk_display_get_default (), NULL);
font_map = pango_win32_font_map_for_display ();
font = pango_font_map_load_font (font_map, gdk_pango_context_get (), font_desc);
size = PANGO_PIXELS (pango_font_description_get_size (font_desc));
if (font)
{
LOGFONT *lfp =
pango_win32_font_logfont (font);
result = gdk_font_from_one_singlefont (gdk_font_load_logfont (lfp));
g_free (lfp);
logfont.lfHeight = - MulDiv (PointSize, GetDeviceCaps (hDC, LOGPIXELSY), 72);
logfont.lfWidth = 0;
logfont.lfEscapement = 0;
logfont.lfOrientation = 0;
logfont.lfWeight = FW_DONTCARE;
logfont.lfItalic = FALSE;
logfont.lfUnderline = FALSE;
logfont.lfStrikeOut = FALSE;
logfont.lfCharSet = ANSI_CHARSET;
logfont.lfOutPrecision = OUT_TT_ONLY_PRECIS;
logfont.lfClipPrecision = CLIP_DEFAULT_PRECIS;
logfont.lfQuality = PROOF_QUALITY;
logfont.lfPitchAndFamily = DEFAULT_PITCH;
strcpy (logfont.lfFaceName, "Arial");
g_object_unref (font);
}
return result;
return gdk_font_from_one_singlefont (gdk_font_load_logfont (&logfont));
}
GdkFont*