fonts and pango (strange characters)



Why, if I try to insert a text using pango in a drawing_area (or in a text 
buffer) with some fonts, result is not the string that I want, but character 
like:
___ ___ ___
|00| |00| |00|
|50| |6F| |72| ..............etc...
---- ---- ----

The font that I use are truetype font (maestro.ttf  imported from windows) and 
represents musical simbol (note or pause). With other fonts there is no 
problem. This is my code:
...
layout = pango_layout_new(gtk_widget_get_pango_context(widget));
pango_layout_set_text(layout, "This is my text", -1);
font = pango_font_description_from_string("maestro 40");  // maestro.ttf
pango_layout_set_font_description(layout, font);
pango_layout_set_width(layout, width);
pango_layout_set_spacing(layout, spacing);
pango_layout_set_justify(layout, justify);
pango_layout_set_alignment(layout, align);
gdk_draw_layout(pixmap, ret, x, y, layout);    /* this is not important  */
gtk_widget_queue_draw_area.....             

Note that if I use deprecated function gdk_font_load() instead of pango as 
follow, result is OK:
font = gdk_font_load 
("-unknown-maestro-medium-r-normal--29-280-75-75-p-120-adobe-fontspecific");
gc = gdk_gc_new(widget->window);
gdk_draw_string(pixmap, font, gc, x, y, "my text");

Have you any advice?
Thank you very much,
Marco Mussini



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