Problem with Pango size text when printing
- From: Joaquín Goicoechea <joaquingoicoechea iesotura es>
- To: gtkmm-list gnome org
- Subject: Problem with Pango size text when printing
- Date: Wed, 8 Aug 2012 02:49:46 +0200
Hi,
I have the next code to adapt the text size, it works fine in my custom widget:
Pango::FontDescription fuente ("Purisa");
m_refLayout->set_font_description (fuente); // m_refLayout is a Glib::RefPtr<Pango::Layout>
fuente.set_size (x_f * Pango::SCALE); // int x_f = 32
m_refLayout->set_text(msg);
m_refLayout->get_pixel_size(x_m,y_m); // int x_m, y_m
x_f=((ancho)*x_f)/x_m; // ancho = width, I want to use.
fuente.set_size (x_f*Pango::SCALE);
...
m_refLayout->update_from_cairo_context(cr);
m_refLayout->add_to_cairo_context(cr);
But when I try to print, fuente.set_size doesn't work and all the text has de same size. To do that I want, I have to set the size with FontDescription constructor:
...
char h[10];
sprintf (h, "%d",x_f);
fuente_string ="Purisa "+ Glib::ustring(h);
m_refLayout->set_font_description (Pango::FontDescription(fuente_string));
...
Why?
Do you know a good Pango tutorial for beginners ?
Thanks and sorry for my English
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]