Fixed sized font on Win32



Hi,

I have a background image with a fixed size and need to display some
text on it in a way that it fits to features of the background image.
Due to the nature of the image, I don't want to resize it.
Therefore, the text to be displayed must have a certain size in pixles
(and not in points).

My approach was to use GTK_FIXED to be able to position the text
accurately, but so far I failed to find a way to tell GTK/Pango to use a fixed pixel size. Well, on my computer it works fine, but not on any other (with a different screen size or user defined setting for text size).


#define FONT_TTP   "<span font_desc=\"Arial 18\" weight=\"heavy\">%s</span>"

...

frame  = gtk_fixed_new   ();
image  = gtk_image_new_from_file (ipath);
gtk_fixed_put            (GTK_FIXED (frame), image, 0, 0);

label  = gtk_label_new   ("");
sprintf (marked, FONT_TTP, "some text");
gtk_label_set_use_markup (GTK_LABEL  (label), TRUE);
gtk_label_set_markup     (GTK_LABEL  (label), marked);
gtk_label_set_justify    (GTK_LABEL  (label), GTK_JUSTIFY_RIGHT);
...
gtk_fixed_put            (GTK_FIXED (frame), label, x_pos, y_pos);


Any help is greatly appreciated.

Alois







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