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

Behdad Esfahbod behdad at behdad.org
Wed Jun 25 08:56:59 PDT 2008

On Tue, 2008-06-24 at 10:55 +0800, zjuclarkm at 163.com wrote:
>        I tried your method.But I find it doesn't work.
>        In my local font directory, I have one "impact.ttf" file(regular fac=
> e), I then created a FT_Face with this file, then I created a FcPattern, se=
> t the FC_FT_Face on it and enabled FC_Embolden to true, after calling FcFon=
> tMatch, I found the matched pattern is a "Verdana regular face". The versio=
> n of Cairo dll is 1.2.6 which I got from GTK installation.Is it because the=
>  lower version of cairo doesn't support this feature? What version of cairo=
>  will support this feature?

This is only in cairo git repo and will be in cairo 1.8.  Though it may
also be put in cairo 1.6.6 due out this week or next.

> I've tested when opening a FT_Face, the APIs(FT_Set_Char_Size, FT_Outline_E=
> mbolden, etc.) provided by FreeType will not be in effect, conversely, cair=
> o_set_font_size still works.I don't know why this happens. What's the relat=
> ion between the APIs provided by Cairo on Font part and other Font backend(=
> FreeType,Windows,etc.). Could they be used together?

Cairo sets all the options on FT_Face.  You should use cairo font
options and font matrix for all settings.

> Also, if we only have some regular font face and we want to support "Italic=
> /Bold" effect with cairo,what's the possible way? Here I means the level on=
>  which we can operate, Cairo or FreeType or FontConfig?

For synthetic italic just add some shear to the font matrix.  Synthetic
bold, same story as before.  No clean way right now.

I may go ahead and add a cairo_ft_face_set_embolden() method.


"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