Search code examples
gtk#pangokerningpangocairo

pango_cairo_layout_path method does not respect kerning


I'm using pango library to do some text layout and cairo backend for rendering. It seems to me that the pango_cairo_layout_path method does not respect kerning.

I'm using c# bindings for pango and cairo that are provided with the gtk# project. Also i'm using the pango-cairo runtimes that also provided with gtk# project.

Here is an image demonstrating the problem (Font: Arial)

First row is from Inkscape rendering and second row from pango-cairo

Is there any known bug in pango/cairo?... or i'm doing something wrong

Do you know any work around...

Thanks in advance


Solution

  • It seems that pango-cairo backend in Windows by default uses the Win32 font type. With this type I had problems with kerning.

    When I changed font type to be freetype everything worked as should.

    In order to change font type please use:

    PangoCairoFontMap * pango_cairo_font_map_new_for_font_type(cairo_font_type_t fonttype);
    

    And

    pango_cairo_font_map_set_default (PangoCairoFontMap *fontmap);
    

    More info here: https://developer.gnome.org/pango/stable/pango-Cairo-Rendering.html