Re: [gtkmm] Custom drawing area and text layout



Igor Gorbounov wrote:

Marcus Hanwell wrote:

So finally to my question! Is there anyway for me to tell Pango what I want to write, fonts etc, and then to ask it how big the occupied rectangle would be?

[...]
Well, I use the get_size(int width, int height) method of Pango::Layout,
then do
    width/Pango::SCALE to get the screen pixels size.
For a center alighnment you can use the
    set_alignment(Pango::ALIGN_CENTER) method of Pango::Layout.
There must be a lot of other useful things for Pango::Layout objects.
    Igor Gorbounov

Thanks for the two suggestions. The Pango::Alignment method doesn't work - as I am trying to align the text labels to specific points on the screen. I did use it too - to be sure. The best method I found after your suggestion was,

void get_pixel_size(int& width, int& height) const

This gives me the dimensions of my Pango::Layout before drawing it to the screen - I can use these two dimensions to calculate the best positions for my text labels. Many thanks for pointing these functions out.

I just need to figure the symbols out now - it is a scientific application. Probably of no use to many people outside of my research group and so I can ensure the Symbol font is installed on the systems the software will be installed on :)

Thanks for the help,

Marcus



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