[cairo] How could Cairo with FreeType support "slant/bold"
zjuclarkm at 163.com
zjuclarkm at 163.com
Mon Jun 23 19:55:08 PDT 2008
effect?
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="----=_Part_178996_24520060.1214276108250"
X-Originating-IP: [192.168.208.49 (220.191.185.155)]
X-Priority: 3
X-Mailer: Coremail Webmail Server Version XT_Ux_snapshot build
080521(5485.1718.1717) Copyright (c) 2002-2008 www.mailtech.cn 163com
------=_Part_178996_24520060.1214276108250
Content-Type: text/plain; charset=gbk
Content-Transfer-Encoding: quoted-printable
Hi Behdad,
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?
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?
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?
Thanks,
Clark =20
=20
=D4=DA2008-06-06=A3=AC"Behdad Esfahbod" <behdad at behdad.org> =D0=B4=B5=C0=A3=
=BA >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 F=
reeType font backend on Windows. But I >> > find one question: if I have op=
ened 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" ap=
i of >> > cairo_select_font_face()? >> >> Hi Clark, >> >> For this, you sho=
uld open an FT_Face that has the slant and weight >> that you want. Many fo=
nts provide separate faces for these. For those >> that don't, I believe th=
at freetype provides flags you can use to get >> artificial emboldening, et=
c. 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 i=
talic you can simply shear the font matrix yourself. >For emboldening, ther=
e's a small gap in cairo's API and implementation >preventing that right no=
w. See: > >http://lists.cairographics.org/archives/cairo/2008-April/013844.=
html > >In fact, I went ahead and pushed the part about respecting FC_FT_FA=
CE. >So, to achieve what you want you can create a FcPattern, set the >FC_F=
T_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 ca=
iro master now. > >-- >behdad >http://behdad.org/ > >"Those who would give =
up Essential Liberty to purchase a little > Temporary Safety, deserve neith=
er Liberty nor Safety." > -- Benjamin Franklin, 1759 >
------=_Part_178996_24520060.1214276108250
Content-Type: text/html; charset=gbk
Content-Transfer-Encoding: quoted-printable
<div> Hi Behdad,<br><br> I tried your =
method.But I find it doesn't work.<br> =
In my local font directory, I have one "impact.ttf" file(regular face), I t=
hen created a FT_Face with this file, then I created a FcPattern, set the F=
C_FT_Face on it and enabled FC_Embolden to true, after calling FcFontMatch,=
I found the matched pattern is a "Verdana regular face". The version of Ca=
iro 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 s=
upport this feature?<br><br>I've tested when opening a FT_Face, the APIs(FT=
_Set_Char_Size, FT_Outline_Embolden, etc.) provided by FreeType will not be=
in effect, conversely, cairo_set_font_size still works.I don't know why th=
is happens. What's the relation between the APIs provided by Cairo on Font =
part and other Font backend(FreeType,Windows,etc.). Could they be used toge=
ther?<br><br>Also, if we only have some regular font face and we want to su=
pport "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?<br><br=
>Thanks,<br>Clark <br></div><div> </div><div></div>=D4=DA2008-06=
-06=A3=AC"Behdad Esfahbod" <behdad at behdad.org> =D0=B4=B5=C0=A3=BA
>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. Bu=
t 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/obl=
ique"
>> > and "bold" text just as I simply calling the "toy" api of
>> > cairo_select_font_face()?
>>=20
>> Hi Clark,
>>=20
>> 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 th=
ose
>> that don't, I believe that freetype provides flags you can use to =
get
>> artificial emboldening, etc. But I'm definitely talking about feat=
ures
>> 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 misinforma=
tion
>> 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:
>
>http://lists.cairographics.org/archives/cairo/2008-April/013844.html
>
>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.
>
>--=20
>behdad
>http://behdad.org/
>
>"Those who would give up Essential Liberty to purchase a little
> Temporary Safety, deserve neither Liberty nor Safety."
> -- Benjamin Franklin, 1759
>
<br><!-- footer --><br>=20
<hr>
<font style=3D"font-size:12px;line-height:15px;">=C9=CF=B7=BF=C0=CF=B4=F3=
=C2=F2=B6=FE=CA=D6=B7=BF=A3=AC=BF=B4=CA=B5=BE=B0=D5=D5=C6=AC=A3=AC</font><a=
style=3D"font-size:12px;line-height:15px; color:blue; text-decoration:unde=
rline;" href=3D"http://pro.163.com/event.ng/Type=3Dclick&FlightID=3D108452&=
AdID=3D109911&TargetID=3D635&Values=3D31,43,51,60,72,85,91,100,110,150,312,=
316,330,332,457,499,586,702,733,734,774,775,788,942,943,944,948,949,950,951=
,1004&Redirect=3Dhttp://www.foloda.com">=CC=F4=D7=A8=D2=B5=BE=AD=BC=CD=C8=
=CB</a>
------=_Part_178996_24520060.1214276108250--
More information about the cairo
mailing list