Re: Rendering Arabic text with Pango & Cairo VS Pango & FreeType



Thx for your answear.

I don't know wich fonts are using the pagocairo backend... how can I know this informations?

I tested the pango viewer included in the source under windows yesterday, and the pangoft2 test gave me wrong results again, so it looks like I'm not doing anything wrong in my code.

Problem is I really need to use freetype, so I guess I'll have to write the arabic module myself.

Nico.

2009/11/30 Behdad Esfahbod <behdad behdad org>
Hi,

I'm not sure why it doesn't work for you.  Is the pangocairo backend using FreeType fonts or win32?  At any rate, the pangoft2 backend has been deprecated for years.  I suggest you use pangocairo instead.

behdad


On 11/30/2009 09:48 AM, Nicolas Lacombe wrote:
Hi,

I want to use Pango high level functionnality to render arabic tex in a
FreeType environnement.

Using Pango with Cairo, it works perfectly, the text is correctly
rendered with ligatures typographic ligature.

However, in a freetype environnement, ligature disapear! I can still see
the text, but only the original form of each glyph, thus without any
contextual interpretation.

Am I doing anything wrong?


PANGO & CAIRO RENDERING (WORKING AS INTENDED)

cairo_surface_t *surface;
cairo_t *cr;


PangoLayout *layout;


surface = cairo_image_surface_create(CAIRO_FORMAT_A8, 512, 512);
cr = cairo_create(surface);
cairo_set_source_rgba(cr, 1., 1., 1., 0.0);
cairo_paint(cr);

layout = pango_cairo_create_layout(cr);
PangoFontDescription *desc;
desc = pango_font_description_from_string("Arial, 20");
pango_layout_set_font_description  (layout, desc);
pango_font_description_free(desc);

pango_layout_set_text(layout, txt, -1);
cairo_set_line_width(cr, 0.5);
cairo_set_source_rgba(cr, 0.0, 0.0, 0.0, 1.0);

pango_cairo_update_layout(cr, layout);
pango_cairo_show_layout(cr, layout);



PANGO & FREETYPE RENDERING (no contextual analysis of the arabic text)


PangoContext *context;

PangoFontMap* PFM = pango_ft2_font_map_new();
pango_ft2_font_map_set_resolution(PANGO_FT2_FONT_MAP(PFM), width, height);
context = pango_font_map_create_context(PANGO_FONT_MAP(PFM));


FT_Bitmap* bm;
bm = g_slice_new(FT_Bitmap);
bm->rows = height;
bm->width = width;
bm->pitch = width;
bm->num_grays = 256;
bm->pixel_mode = FT_PIXEL_MODE_GRAY;

bm->buffer = (unsigned char*)g_malloc (bm->pitch * bm->rows);
memset(bm->buffer, 0x00, bm->pitch * bm->rows);

layout = pango_layout_new(context);
static PangoFontDescription *desc;

desc = pango_font_description_from_string("Arial, 20");
pango_layout_set_font_description(layout, desc);
pango_font_description_free(desc);

pango_layout_set_auto_dir (layout, 1);
pango_layout_set_text(layout, txt, -1);

pango_layout_context_changed(layout);
pango_ft2_render_layout(bm, layout, 0, 0);







_______________________________________________
gtk-i18n-list mailing list
gtk-i18n-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-i18n-list



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