[cairo] How could Cairo with FreeType support "slant/bold" effect?

Behdad Esfahbod behdad at behdad.org
Thu Jun 5 12:45:03 PDT 2008

On Thu, 2008-06-05 at 09:33 -0700, Carl Worth wrote:
> On Thu, 5 Jun 2008 16:09:29 +0800 (CST), zjuclarkm wrote:
> > I want to use Cairo with FreeType font backend on Windows. But I
> > find one question: if I have opened a FT_Face and created a
> > corresponding cairo_font_face_t*, set it to cairo by calling
> > cairo_set_font_face(), how can I get the effect of "slant/oblique"
> > and "bold" text just as I simply calling the "toy" api of
> > cairo_select_font_face()?
> Hi Clark,
> For this, you should open an FT_Face that has the slant and weight
> that you want. Many fonts provide separate faces for these. For those
> that don't, I believe that freetype provides flags you can use to get
> artificial emboldening, etc. But I'm definitely talking about features
> here that I don't actually know how to use myself. So I trust that
> Behdad or someone else will step forward to correct any misinformation
> I'm spreading.

For synthetic italic  you can simply shear the font matrix yourself.
For emboldening, there's a small gap in cairo's API and implementation
preventing that right now.  See:


In fact, I went ahead and pushed the part about respecting FC_FT_FACE.
So, to achieve what you want you can create a FcPattern, set the
FC_FT_FACE on it to point to your FT_Face, and set FC_EMBOLDEN on it to
true, then use cairo_ft_font_face_create_for_pattern().  This should
work with cairo master now.


"Those who would give up Essential Liberty to purchase a little
 Temporary Safety, deserve neither Liberty nor Safety."
        -- Benjamin Franklin, 1759

More information about the cairo mailing list