Re: [Evolution-hackers] GnuCash print problem patch



On Mon, 2007-04-16 at 22:14 +1000, Paul Andreassen wrote:
> On Friday 13 April 2007 16:54, Paul Andreassen wrote:
> > On Friday 13 April 2007 03:13, Srinivasa Ragavan wrote:
> > > Paul,
> > >
> > > Yes. Before getting into the patch, can you let us know the issue the
> > > patch is addressing? It would be helpful while reviewing the patch.
> > >
> > > -Srini
> > >
> > > On Thu, 2007-04-12 at 21:41 +1000, Paul Andreassen wrote:
> > > > Hello,
> > > >
> > > > Is this where gtkhtml is maintained?  If so could someone look at this
> > > > patch and tell me if it acceptable for inclusion.  I'm not sure I
> > > > understand how all the library code goes together.
> >
> > Thanks for the reply.
> >
> > When printing or print previewing of a GnuCash report the font changes from
> > the screen font to an unset and unchangeable one.  In my case it changes
> > from the screen font of "San Regular 10" to "Serf Regular 12".  This
> > results in very large printed reports.
Quoting your previous patch.
> --- gtkhtml-3.10.3/src/htmltext.c.old   2007-04-12 21:09:20.259210176
> +1000
> +++ gtkhtml-3.10.3/src/htmltext.c       2007-04-12 21:20:36.621387496
> +1000
> @@ -1214,12 +1214,16 @@ html_text_prepare_attrs (HTMLText *text,
>                         pango_attr_list_insert (attrs, attr);
>                 }
>         } else {
> -               if (fabs (painter->font_manager.magnification - 1.0) >
> 0.001) {
> -                       attr = pango_attr_size_new
> (painter->font_manager.var_size*painter->font_manager.magnification);
> +               if (painter->font_manager.variable.face != NULL) {
> +                       attr = pango_attr_family_new
> (painter->font_manager.variable.face);
>                         attr->start_index = 0;
>                         attr->end_index = text->text_bytes;
>                         pango_attr_list_insert (attrs, attr);
>                 }
> 
Im not clear why you you have to insert another attribute here. Also you
dont check for fabs as it was doing earlier. 

> +               attr = pango_attr_size_new
> (painter->font_manager.var_size*painter->font_manager.magnification);
> +               attr->start_index = 0;
> +               attr->end_index = text->text_bytes;
> +               pango_attr_list_insert (attrs, attr);
>                 pango_attr_list_splice (attrs, text->attr_list, 0, 0);
>         }
> >
> > This patch sets the font for text areas during printing but I don't
> > understand why it already does the right thing for the screen.  My patch
> > still has a placement problem for some characters.  The C and T in the
> > follow pngs show the problem.
> >
> > Thanks again,
> > Paul
> 
> The GnuCash report print bug is listed at 
> http://bugzilla.gnome.org/show_bug.cgi?id=350408
> 
> After looking further into the problem, it appears that GnomePrint doesn't 
> have a setable default font.  And because the pango attrs don't set a font 
> face or size if the required font is the default, the result is the items are 
> printed in GnomePrint default of "Serf Regular 12".  My patch changes this to 
> explicitly set the pango attrs resulting with the items printed in that font.
> 
> As for the character placement problem, it appears to be a problem only with 
> the [Dejavu] Sans and [Dejavu] Serf fonts at point sizes 9 and 10 when 
> printing.  This maybe a Ubuntu 6.06 problem.
> 
> Looking at gtkhtml-3.14.0/src/htmlprinter.c from the most recent source, it 
> appears that the new gtk_print allows the setting of a default font.  Please 
> make this user accessable even if its in a gconf file.
> HTMLPainter *
> html_printer_new (GtkWidget *widget, GtkPrintContext *context)
> {
>         const PangoFontDescription *desc;
>         HTMLPrinter *printer;
>         HTMLPainter *painter;
> 
>         printer = g_object_new (HTML_TYPE_PRINTER, NULL);
>         printer->context = g_object_ref (context);
> 
>         painter = HTML_PAINTER (printer);
>         html_painter_set_widget (painter, widget);
>         desc = pango_font_description_from_string ("sans 8");/* FIXME font 
> hardcoded*/

IIRC the widget is the GtkHTML widget. It can be easy to get the widget
style / font description from GtkHTML widget and set it here instead of
GCONF something else. That way, it may be consistent from what is shown
also. Does that suffice you?

-Srini.
>         painter->pango_context = gtk_print_context_create_pango_context 
> (context);
>         pango_context_set_font_description (painter->pango_context, desc);
>         return painter;
> 
> }
> 
> My web page on this problem with fixes is at 
> http://members.iinet.com.au/~paulone/gnucash/
> 
> Thanks,
> Paul




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]