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

zjuclarkm at 163.com zjuclarkm at 163.com
Fri Jun 6 02:33:50 PDT 2008


 Hi Carl,
     Thank you for your reply. I'm programming with Cairo and find it's very powerful.
     Can I use cairo in such a way below to achieve the "slant/bold" effect?
1. Call -  FreeType library to load a regular "FT_Face" with no "slant/bold".(I really expeced to load "regular" fonts, then use transformations to achieve the effect of "slant/bold").
2. Call -  cairo_ft_font_face_create_for_ft_font_face() create a "cairo_font_face_t*"
3. Call - cairo_set_font_face() to set the newly created "cairo_font_face_t*" into current "cairo_t*"
 4. Call - cairo_select_font_face(cairo_t*, FT_Face.family_name, SLANT flag,WEIGHT flag). Because cairo doesn't provide the enumeration of the font-family names it supports. So I get the font-family name from FT_Face in FreeType library.

Is this a correct way? I'm thinking it's not, but the renderring effect is not so bad.

Simply speaking, could "cairo_set_font_face()" and "cairo_select_font_face()" APIs be used together? Are they conflicted with each other?

I'm really a new-comer to open source project, so I may raise some silly problems. If that happened, please excuse for my ignorance.

Regards,
Clark
 
 
在2008-06-06,"Carl Worth" <cworth at cworth.org> 写道:
>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.
>
>> Moreover, does anyone know the efficiency of FreeType on Windows
>> platform compared to native WINDOWS api for font?
>
>I don't know anything about this performance comparison myself.
>
>One reason application authors prefer to use cairo with the native
>font system, (on any platform), is to provide a consistent experience,
>(available fonts, details of font rendering, etc.), with other
>applications on that platform.
>
>Have fun with cairo!
>
>-Carl
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cairographics.org/archives/cairo/attachments/20080606/a5714e2f/attachment.html 


More information about the cairo mailing list