On Sat, 2004-11-27 at 21:04 +0100, Jean Bréfort wrote: > Le samedi 27 novembre 2004 à 10:53 -0500, Owen Taylor a écrit : > > On Fri, 2004-11-19 at 13:40 +0100, Jean Bréfort wrote: > > > Hi, > > > > > > I saw that gnome_print_pango_layout_print has been deprecated and has > > > been kept for compatibility. The big problem with that is that it is not > > > compatible with the original version. So either we fix that adding the > > > following line: > > > gnome-print_scale (gpc, 1., -1.); > > > or we just remove it. > > > > I didn't test, but you are saying that it prints upside down??? > > Yes. So, with the old gnome_print_pango_layout_print(), the page was vertically mirrored with the default coordinate system? Is that so that the global coordinate system matches that of Pango once you swap the coordinate system so that the origin is at the top left? > > > Another solution is to write en enhanced version > > > (gnome_print_pango_layout) is not an equivalent). > > > > How not? gnome_print_show_pango_layout() and friends are, as far as > > I know, basically completely flexible. > > There are several differences at first sight. My problem was to print > the contents of a PangoLayout retrieved from a GtkTextLayout. > It seems (I might be wrong) that GtkTextLayout does not use > PANGO_ATTR_STRIKETHROUGH but some field in GtkTextAppearance to obtain > the same effect. I did not find a simple method to pass that to > gnome_print_pang_layout. How would you pass that to the old gnome_print_pango_layout_print()? You could write a custom layout renderer using gnome_print_pango_glyph_string(); this is essentially what gtktextdisplay.c used to do using gdk_draw_glyphs(). Unfortunately, you'd have to duplicate the underline and strikethrough drawing code from gnome-print-pango.c. With devel version of Pango in CVS, I introduced PangoRenderer, which is makes writing custom renderers considerably easier, and now gtktextdisplay.c just derives GtkTextRenderer from GdkPangoRenderer and provides custom 'prepare_run' and 'draw_shape' methods. gnome-print-pango.c hasn't yet been switched over to this new system, but it probably would be about 100-200 lines shorter that way, and also easier to customize if deriving from GnomePrintPangoRenderer was allowed. It's not completely clear to me that using the semi-public APIs of GtkTextView to implement printing is a good idea. There isn't even a strong guarantee of API stability. The "value" of GtkTextLayout is mostly in the editing and incremental layout capabilities. GtkSourceView just extracts the text/attributes from the layouts and recreates new layouts to print. > Another detail is that pango slants some fonts as Vera Serif for which > no slanted variant exist, but gnome_print_pango_layout does not. gnome_print_pango_layout() is just as much "Pango" as gdk_draw_layout(). Any slanting done by pango is just fontconfig/Xft based on the contents of your fonts.conf. I wonder if what's going on is that the matrix being set in fonts.conf is overridden by the matrix Pango is getting from gnome-print. If you want to investigate, I'd look at pango_fc_font_map_new_font() and see if it needs to be multiplying any matrix in the font already with 'pango_matrix'. Regards, Owen
Attachment:
signature.asc
Description: This is a digitally signed message part