[cairo] cairo_font_face_create_from_file/data()

Jinghua Luo sunmoon1997 at gmail.com
Sat Sep 15 03:15:41 PDT 2007


Behdad Esfahbod 写道:
> Hi,
>
> So, while writing the last comment in:
>
>   http://bugzilla.gnome.org/show_bug.cgi?id=347237
>
> It occurred to me that it would be useful to all cairo users if we had:
>
> cairo_font_face_t
> cairo_font_face_create_from_file (const char *filename);
>
> cairo_font_face_t
> cairo_font_face_create_from_data (const char *data,
>                                   int         len);
>
> Is that possible with ATSUI and win32 font backends?
>
> One issue that can be improved is the from_data() function that in cairo
> design should be from_stream(), but FreeType for example doesn't have a
> from_stream() API so ft implementation would have to read in the font
> data first which is not optimal.
>   
FT_Open_Face[1] should do what you want.
> This also nicely fixes the fact that cairo.h doesn't have any font_face
> constructors other than the toy API.
>
> Comments?  Patches?
>
>
>   
[1]
http://freetype.sourceforge.net/freetype2/docs/reference/ft2-base_interface.html#FT_Open_Face


More information about the cairo mailing list