Re: [gtkmm] Custom drawing area and text layout



On Fre, 2004-02-20 at 12:45 +0000, Marcus Hanwell wrote:
> Hi,
> 
> Just starting out with Gtkmm, and having a few teething problems. I am 
> coding an application which needs to plot graphs in real time sampled 
> at  10 Hz. So I coded up a custom drawing area, and coded up something 
> that draws my graphs pretty well.
> 
> The problem I have is in labelling the axes of the graph, and drawing 
> the numbers. I have been using Pango to do this, but I need to center 
> the labels about a certain point.


the best way will be to let center pango the text for you. yust call
set_alignment(PANGO::ALIGN_CENTER); on your pango layout.

> 
> 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?


if you realy want to do it the hard way and calculate the offsets for
yourself you can get the size of your layout from get_pixel_size ();


>  Are there any good tutorials, or should I be using 
> something else for the text on my drawing area? Can I use symbols

what kind of symbols? pango is full unicode-aware. if you ie. want to
use special matimatical symbols there is a high risk that the user
doesnt has installed the right font to display these symbols.

>  and 
> superscript/subscript too?

you can use this by pango markup for a layout your_layout->set_markup
("<span><sub>Something in subscript</sub></span>");

cheers
detlef




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