Linear Scaling of fonts with FreeType on Cairo



I'm trying to find a way to scale fonts linearly.  As far as I can tell, the
way to do it is to use a freetype font and turn hinting off.  Using the API,
I tried to pull some code together that would try to do that, but
unfortunately, the font is still scaling non-linearly.

 

 

    cairo_font_options_t *options;

    PangoFontMap            *fm;

    PangoContext            *context;

 

    fm = pango_cairo_font_map_new_for_font_type (CAIRO_FONT_TYPE_FT);

    pango_cairo_font_map_set_resolution (PANGO_CAIRO_FONT_MAP(fm), 96);

    context = pango_cairo_font_map_create_context
(PANGO_CAIRO_FONT_MAP(fm));

 

    options = cairo_font_options_create ();

    cairo_font_options_set_hint_style (options, CAIRO_HINT_STYLE_NONE);

    pango_cairo_context_set_font_options (context, options);

 

    .

 

During runtime I receive the following error:

 

Pango-CRITICAL **: pango_cairo_font_map_create_context: assertion
`PANGO_IS_CAIRO_FONT_MAP (fontmap)' failed

 

Specifically, how can I use a PangoCairoFontMap in such a scenario?  The
documentation states that I should be getting such a structure upon calling
pango_cairo_font_map_new_for_font_type.  However, all I get is a
PangoFontMap.  I'm not sure what the difference is between these two
structures and/or if one can be type cast onto another.

 

More generally, how can I scale fonts linearly using the Pango, Cairo API?
Tutorials, guides would be very helpful.

 

Thanks,

 

Karl

 

 

 




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