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



The font looks fine. Any chance pango can't find it's arabic module? Tor, do you compile the basic module in?

behdad

On 12/02/2009 03:54 AM, Nicolas Lacombe wrote:
Output of fc-match -v ':lang=ar' :

Pattern has 32 elts (size 48)
     family: "Andalus"(s)
     familylang: "en"(s)
     style: "Regular"(s)
     stylelang: "en"(s)
     fullname: "Andalus"(s)
     fullnamelang: "en"(s)
     slant: 0(i)(s)
     weight: 80(i)(s)
     width: 100(i)(s)
     size: 12(f)(s)
     pixelsize: 12.5(f)(s)
     foundry: "unknown"(s)
     antialias: FcTrue(w)
     hintstyle: 3(i)(w)
     hinting: FcTrue(w)
     verticallayout: FcFalse(s)
     autohint: FcFalse(s)
     globaladvance: FcTrue(s)
     file: "C:/WINDOWS/fonts/andlso.ttf"(s)
     index: 0(i)(s)
     outline: FcTrue(s)
     scalable: FcTrue(s)
     dpi: 75(f)(s)
     rgba: 1(i)(w)
     scale: 1(f)(s)
     charset:
     0000: 00000000 ffffffff ffffffff ffffffff 00000000 ffffffff
ffffffff ffffffff
     0001: 00000000 00020000 000c0000 61000003 00040000 00000000
00000000 00000000
     0002: 00000000 00000000 00000000 00000000 00000000 00000000
3c0000c0 00000000
     0003: 00000000 00000000 00000000 00000000 00000000 00000200
00000001 00000000
     0006: 88001000 07fffffe 0037ffff 401327ff 01000040 00008210
00201000 03ff0010
     0020: 7718f000 06010047 00000010 00000000 00000000 00001000
00000000 00000000
     0021: 00000000 00000004 00000000 00000000 00000000 00000000
00000000 00000000
     0022: 44028044 00000800 00000100 00000031 00000000 00000000
00000000 00000000
     0025: 00000000 00000000 00000000 00000000 00000000 00000000
00001400 00000000
     00f8: 00000000 00000000 00000000 00000000 00000000 00000000
00000000 80000000
     00fb: 00000006 00000000 03c30000 3c003c00 003fcc00 00000000
00000000 30000100
     00fc: 00000000 00000000 c0000000 00000007 00000000 00000000
00000000 001c0000
     00fd: 00000000 f0000000 00000000 00000000 00000000 00000000
00000000 10040000
     00fe: 00000000 00000000 00000000 ffd70000 ffffffff ffffffff
ffffffff 9fffffff
(s)
     lang:
aa|ar|ast|ay|az-ir|bi|br|ch|co|da|de|en|es|et|eu|fa|fi|fj|fo|fr|fur|fy|gd|gl|gv|ho|ia|id|ie|io|is|it|lb|mg|nb|nds|nl|nn|no|nr|nso|oc|om|pt|rm|sma|smj|so|sq|ss|st|sv|sw|tl|tn|ts|ug|uz|vo|vot|wa|xh|yap|zu|an|fil|ht|jv|kj|kwm|li|ms|ng|pap-an|pap-aw|rn|rw|sc|sg|sn|su|za(s)
     fontversion: 387973(i)(s)
     capability: "otlayout:arab otlayout:latn"(s)
     fontformat: "TrueType"(s)
     embeddedbitmap: FcTrue(s)
     decorative: FcFalse(s)




2009/12/1 Behdad Esfahbod <behdad behdad org <mailto:behdad behdad org>>

    Seems to me like your fontconfig can't find any decent Arabic fonts.
      Try running fc-match ':lang=ar' and see what you get...


    behdad


    On 12/01/2009 03:29 AM, Nicolas Lacombe wrote:

        Of course, sorry about that.

        I'm running pango on windows (with MSVC), using the binaries
        provided by
        GTK+ (http://www.gtk.org/download-windows.html).

        For the pango viewer, I just created a small visual studio
        project to
        see how it work, link it statically with the GTK+ binaries and
        run it.
        Pangocairo work as intended whereas pangoft2 does not interpret
        results.



        2009/12/1 Behdad Esfahbod <behdad behdad org
        <mailto:behdad behdad org> <mailto:behdad behdad org
        <mailto:behdad behdad org>>>


            You can at least tell us about your build environment?!!


            On 12/01/2009 02:09 AM, Nicolas Lacombe wrote:

                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
        <mailto:behdad behdad org>
        <mailto:behdad behdad org <mailto:behdad behdad org>>
        <mailto:behdad behdad org <mailto:behdad behdad org>

        <mailto:behdad behdad org <mailto: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 <mailto:gtk-i18n-list gnome org>
        <mailto:gtk-i18n-list gnome org <mailto:gtk-i18n-list gnome org>>
        <mailto:gtk-i18n-list gnome org <mailto:gtk-i18n-list gnome org>
        <mailto:gtk-i18n-list gnome org <mailto: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]