[cairo] font face in cairo-wrapper for php

Fan Zhang fz at chinasoft.dk
Wed Mar 18 18:17:22 PDT 2009


Thanks,

How do I get the font family name on my system? Python wrapper has this 
creat_cairo_font_face_for_file building. Why is PHP support so badly.

Behdad Esfahbod wrote:
> On 03/18/2009 05:28 AM, Fan Zhang wrote:
>> Hi,
>>
>> Does anyone know how to use
>> void *cairo_select_font_face* ( resource cr, string fontname, int slant,
>> int weight )
>> for loading local fonts?
>>
>> i've tried to do
>> cairo_select_font_face ($this->cr, arialbold.ttf,
>>              CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
>>
>> and arialbold.ttf is in the same path of the php file, but it won't 
>> work.
>>
>> If cairo-wrapper only use the system font, where can i add new fonts?
>> I'm using fedora and cairo is installed from YUM.
>
> The PHP binding has the wrong parameter name.  The fontname parameter 
> is actually a family name.  That is, a string like "Arial", or "DejaVu 
> Sans".  If you want to use a font file, you'd need to use either 
> fontconfig or freetype API directly to create a FcPattern or FT_Face 
> and use the API in cairo-ft.h to use those with cairo.  Not sure if 
> those are bound in the PHP bindings.
>
> behdad
>
>> Thanks
>


More information about the cairo mailing list