Re: About gnome_print_pango_layout_print
- From: Jean Bréfort <jean brefort normalesup org>
- To: Owen Taylor <otaylor redhat com>
- Cc: "gnome-print-list gnome org" <gnome-print-list gnome org>
- Subject: Re: About gnome_print_pango_layout_print
- Date: Sun, 28 Nov 2004 17:26:07 +0100
Le dimanche 28 novembre 2004 �2:01 -0500, Owen Taylor a �it :
> On Sat, 2004-11-27 at 21:04 +0100, Jean Br�rt wrote:
> > Le samedi 27 novembre 2004 �0:53 -0500, Owen Taylor a �it :
> > > On Fri, 2004-11-19 at 13:40 +0100, Jean Br�rt 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?
Yes, there was somewhere a call to gnome_print_scale with -1 as the
y-scale argument.
> 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?
I am not sure I understand exactly what you mean, but I feel the answer
is yes.
> > > > 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()?
It was not necessary to pass it. The GtkTextAppearance could be
retrieved from the PangoAttrList.
> 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.
The reason there is that I try to get wysiwyg printing of a modified
GnomeCanvasRichText item. I know I should rewrite all that stuff.
> > 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'.
I'll have a look if I find time. Anyway, I found another problem which
is critical for me. Characters widths are different on screen and on
paper. Long chains can have significantly different lengths and in
GChemPaint, coordinates of some characters are critical when they
represent a bounded atom. So I think I have to write a custom function
instead of using gnome_print_pango_layout.
Regards,
Jean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]