Exemple #1
0
static void print_glyph_list(gboolean is_newline)
{
    if (is_newline)
        move_pen_to_newline();
    gnome_print_glyphlist(gpx, gl);
    page_x += gl_width;
    gnome_print_moveto(gpx, page_x, page_y);
    gl = gnome_glyphlist_from_text_dumb(font, 0x000000ff, 0, 0, (guchar *)"");
    gl_width = 0;
}
/**
 * gnome_print_pango_glyph_string:
 * @gpc: a #GnomePrintContext
 * @font: the #PangoFont that the glyphs in @glyphs are from
 * @glyphs: a #PangoGlyphString
 * 
 * Draws the glyphs in @glyphs into the specified #GnomePrintContext.
 * Positioning information in @glyphs is transformed by the current
 * transformation matrix, the glyphs are drawn in the current color,
 * and the glyphs are positioned so that the left edge of the baseline
 * is at the current point.
 **/
void
gnome_print_pango_glyph_string (GnomePrintContext *gpc, PangoFont *font, PangoGlyphString  *glyphs)
{
	GnomeGlyphList *glyph_list;
	GnomeFont *gnome_font;
	gint x_off = 0;
	gint i;

	g_return_if_fail (GNOME_IS_PRINT_CONTEXT (gpc));
	g_return_if_fail (PANGO_IS_FONT (font));
	g_return_if_fail (glyphs != NULL);
	
	gnome_font = font_from_pango_font (font);
	if (!gnome_font)
		return;

	glyph_list = gnome_glyphlist_new ();

	gnome_glyphlist_font (glyph_list, gnome_font);
	g_object_unref (gnome_font);
	
	gnome_glyphlist_color (glyph_list, gp_gc_get_rgba (gpc->gc));
	
	for (i = 0; i < glyphs->num_glyphs; i++) {
		PangoGlyphInfo *gi = &glyphs->glyphs[i];

		if (gi->glyph != PANGO_GLYPH_EMPTY) {
			int x = x_off + gi->geometry.x_offset;
			int y = gi->geometry.y_offset;
			
			gnome_glyphlist_moveto (glyph_list,
						(gdouble) x / PANGO_SCALE, (gdouble) -y / PANGO_SCALE);
			gnome_glyphlist_glyph (glyph_list, gi->glyph);
		}
			
		x_off += glyphs->glyphs[i].geometry.width;
	}

	gnome_print_glyphlist (gpc, glyph_list);
	gnome_glyphlist_unref (glyph_list);
}