How to create a narrow pango font?



Hi,

Is a way to create a narrow font?
If the font size is 16, I suppose the width and height are both 16. Let's
say I need a 8X16 font. I did it as follow:

layout = gtk_widget_create_pango_layout (widget, "");

fontdesc = pango_font_description_copy(widget->style->font_desc);
pango_font_description_set_family (fontdesc, "Sans Bold Italic");
pango_font_description_set_size (fontdesc, 16 * PANGO_SCALE);
pango_font_description_set_stretch (fontdesc,
PANGO_STRETCH_ULTRA_CONDENSED);

pango_layout_set_font_description (layout, fontdesc);
gdk_draw_layout ( pixmap,...);

The set_size works well. But the set_stretch does not. Whatever I use
PANGO_STRETCH_ULTRA_CONDENSED or PANGO_STRETCH_ULTRA_EXPANDED, it makes no
defference.

So the question is, how to change the font width while keeping the height
unchanged.

Regards,

Michael







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