Re: Synthesizing fonts using Cairo/Pango



On Wed, Jul 19, 2017 at 2:13 AM, Carl Hetherington <lists carlh net> wrote:
Hi Behdad,

[snip]

> Try calling FcInitLoadConfigAndFonts first for example...

Many, many thanks: using FcInitLoadConfig() instead of FcConfigCreate()
appears to have fixed it!

See!  You didn't include the FcConfigCreate() in your snippet; that's why I found it strange ;).
 
All the best,
Carl


>  
>       Thank you,
>       Carl
>
>       On Tue, 18 Jul 2017, Behdad Esfahbod wrote:
>
>       > pangocairo is supposed to do that automatically.  Is this on Windows / Mac by any chance?
>       >
>       > On Mon, Jul 17, 2017 at 3:46 PM, Carl Hetherington <lists carlh net> wrote:
>       >       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
>       >       _______________________________________________
>       >       gtk-i18n-list mailing list
>       >       gtk-i18n-list gnome org
>       >       https://mail.gnome.org/mailman/listinfo/gtk-i18n-list
>       >
>       >
>       >
>       >
>       > --
>       > behdad
>       > http://behdad.org/
>       >
>       >
>
> _______________________________________________
> gtk-i18n-list mailing list
> gtk-i18n-list gnome org
> https://mail.gnome.org/mailman/listinfo/gtk-i18n-list
>
>
>
>
> --
> behdad
> http://behdad.org/
>
>

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




--


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