Synthesizing fonts using Cairo/Pango



Hi all,

I am writing text to a Cairo RGB24 ImageSurface using code along the lines
of

FcConfigAppFontAddFile (..., "Arial.ttf");

auto surface = Cairo::ImageSurface::create (...);
auto context = Cairo::Context::create (surface);
auto layout = Pango::Layout::create (context);
Pango::FontDescription font ("Arial");
layout->set_font_description (font);
layout->set_markup ("<span style=\"italic\">Hello world</span>");
layout->add_to_cairo_context (context);

Is there any way I can get Pango/Cairo/whoever to synthesize italic/bold
fonts for me if I only supply a "regular" font file?

As a complete punt I tried:

auto ff = context->get_font_face();
cairo_ft_font_face_set_synthesize (ff->cobj(), CAIRO_FT_SYNTHESIZE_OBLIQUE | CAIRO_FT_SYNTHESIZE_BOLD);

but no joy.  Any tips?

Thanks very much,
Carl


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