text bold doesn't work with chinese and japanese in Pango

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

 



Hi All:

I am using pangoft2(pango_ft2_render_layout) to render text.
I want to get the bold effect by using pango_font_description_set_weight(desc, PANGO_WEIGHT_BOLD)
It works well when the text are letters or numbers,but it doesn't work with Chinese or Japanese.
Does anyone know the reason? Please help me!
Any suggestion will be ok, thanks!

Pango version:1.30 
Ubuntu : 12.04

================my code as below=========================== 
#define FONT "Nimbus Sans L 16px"
char text[] = "Test";

PangoFontMap * fontmap = pango_ft2_font_map_new (); PangoContext *context = pangoft2_get_context(fontmap); PangoFontDescription *font_desc = pango_font_description_from_string(FONT);
pango_font_description_set_weight(font_desc, PANGO_WEIGHT_BOLD); ★

//create pango layout
PangoLayout *layout = pango_layout_new(context); pango_layout_set_font_description (layout, font_desc); pango_layout_set_text(layout, text, -1);

PangoRectangle ink_rect;
PangoRectangle logical_rect;
pango_layout_get_pixel_extents(layout, &ink_rect, &logical_rect);

int width = logical_rect.width;
int height = logical_rect.height;

//create ft_bitmap with width and height

pango_ft2_render_layout(ft_bitmap, layout, 0, 0);

//save ft_bitmap to png image using imagemagic (just as in pango-view)

以上、よろしくお願いいたします。
--------------------------------------------------
Zhang Da Wei
Development Dept.Ⅲ
Nanjing Fujitsu Nanda Software Tech. Co., Ltd.(FNST)
No. 6 Wenzhu Road, Nanjing, 210012, China,
Nanjing, 210012, China
TEL: +86+25-79988633-9476
COINS: 79955-8227
MAIL: zhangdw@xxxxxxxxxxxxxx


_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-list





[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux