Re: printing gtktextview and text layout

2008-04-18 Thread Philippe Rouquier

Le mardi 15 avril 2008 à 15:05 -0400, Behdad Esfahbod a écrit :

 On Sat, 2008-04-12 at 11:08 +0200, Philippe Rouquier wrote:
  
  Could someone help me with that please?
 
 Just reorder your code to use pango_cairo_show_layout() for both display
 and print, then make sure you set font options on your PangoContext
 attached to the layout using pango_cairo_context_set_font_options() to
 turn metrics hinting off (cairo_font_options_set_hint_metrics()).
 

Hi,

Thanks for your answer.
I tried and indeed it works: I used a pangolayout (with hinting turned
off) for display in a widget to reflect what was written in the
GtkTextView. I noticed the same discrepancies of text layout as when I
printed. I then printed and the results matched the on screen
pangolayout.

Now the problem is I want to use and print the GtkTextView. How do I
turn off hinting in a GtkTextView?
But maybe I didn't understand you well?

Thanks again.

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: printing gtktextview and text layout

2008-04-18 Thread Behdad Esfahbod
On Fri, 2008-04-18 at 17:30 +0200, Philippe Rouquier wrote:
 
 Le mardi 15 avril 2008 à 15:05 -0400, Behdad Esfahbod a écrit : 
  On Sat, 2008-04-12 at 11:08 +0200, Philippe Rouquier wrote:
   
   Could someone help me with that please?
  
  Just reorder your code to use pango_cairo_show_layout() for both display
  and print, then make sure you set font options on your PangoContext
  attached to the layout using pango_cairo_context_set_font_options() to
  turn metrics hinting off (cairo_font_options_set_hint_metrics()).
  
 Hi,
 
 Thanks for your answer.
 I tried and indeed it works: I used a pangolayout (with hinting turned
 off) for display in a widget to reflect what was written in the
 GtkTextView. I noticed the same discrepancies of text layout as when I
 printed. I then printed and the results matched the on screen
 pangolayout.
 
 Now the problem is I want to use and print the GtkTextView. How do I
 turn off hinting in a GtkTextView?
 But maybe I didn't understand you well?

You understood me correctly.  I don't have answers to the rest of your
questions.

 Thanks again.
 
-- 
behdad
http://behdad.org/

Those who would give up Essential Liberty to purchase a little
 Temporary Safety, deserve neither Liberty nor Safety.
-- Benjamin Franklin, 1759

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: printing gtktextview and text layout

2008-04-15 Thread Behdad Esfahbod
On Sat, 2008-04-12 at 11:08 +0200, Philippe Rouquier wrote:
 
 Could someone help me with that please?

Just reorder your code to use pango_cairo_show_layout() for both display
and print, then make sure you set font options on your PangoContext
attached to the layout using pango_cairo_context_set_font_options() to
turn metrics hinting off (cairo_font_options_set_hint_metrics()).

-- 
behdad
http://behdad.org/

Those who would give up Essential Liberty to purchase a little
 Temporary Safety, deserve neither Liberty nor Safety.
-- Benjamin Franklin, 1759

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


printing gtktextview and text layout

2008-04-12 Thread Philippe Rouquier
Hi,

In brasero I recently started to work on a WYSIWYG cover editor. I ran
into a problem when I try to print something: the layout of the text is
not exactly similar to what is displayed on screen.
For example, if I make a line of a that goes from the left side to the
right side and if I try to print this line, then in the preview and on
the paper I have a shorter line of 'a' that starts at the right place
but that ends before the point it should reach.

On screen:
|  full line of x a   |

On paper:
|  smaller line of x a | 

For text editing I use a GtkTextView with WRAP_CHAR set. I allocate its
space by using the screen resolution (with gdk_screen_get_resolution ())
multiplied by the width and height (in inch) of a CD cover.
For printing, I use a PangoLayout (from
gtk_print_context_create_pango_layout ()) with WRAP_CHAR as well. I get
the sizes for the borders the same way (gtk_print_context_get_dpi_x *
cover_width, ...). These latter border sizes were correct when I
checked. 


Could someone help me with that please?

Regards,

Philippe Rouquier
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list