| Top |
FreeType FontsFreeType Fonts — Font support for FreeType |
#define CAIRO_HAS_FT_FONT cairo_font_face_t* cairo_ft_font_face_create_for_ft_face (FT_Face face,int load_flags); cairo_font_face_t* cairo_ft_font_face_create_for_pattern (FcPattern *pattern);void cairo_ft_font_options_substitute (const cairo_font_options_t *options,FcPattern *pattern);FT_Face cairo_ft_scaled_font_lock_face (cairo_scaled_font_t *scaled_font);void cairo_ft_scaled_font_unlock_face (cairo_scaled_font_t *scaled_font);
The FreeType font backend is primarily used to render text on GNU/Linux systems, but can be used on other platforms too.
cairo_font_face_t* cairo_ft_font_face_create_for_ft_face (FT_Face face,int load_flags);
Creates a new font face for the FreeType font backend from a
pre-opened FreeType face. This font can then be used with
cairo_set_font_face() or cairo_scaled_font_create(). The
cairo_scaled_font_t returned from cairo_scaled_font_create() is
also for the FreeType backend and can be used with functions such
as cairo_ft_font_lock_face()
|
A FreeType face object, already opened. This must
be kept around until the face's ref_count drops to
zero and it is freed. Since the face may be referenced
internally to Cairo, the best way to determine when it
is safe to free the face is to pass a
cairo_destroy_func_t to cairo_font_face_set_user_data()
|
|
flags to pass to FT_Load_Glyph when loading
glyphs from the font. These flags are OR'ed together with
the flags derived from the cairo_font_options_t passed
to cairo_scaled_font_create(), so only a few values such
as FT_LOAD_VERTICAL_LAYOUTFT_LOAD_FORCE_AUTOHINTFT_LOAD_TARGET_LIGHT |
Returns : |
a newly created cairo_font_face_t. Free with
cairo_font_face_destroy() when you are done using it.
|
cairo_font_face_t* cairo_ft_font_face_create_for_pattern (FcPattern *pattern);
Creates a new font face for the FreeType font backend based on a
fontconfig pattern. This font can then be used with
cairo_set_font_face() or cairo_scaled_font_create(). The
cairo_scaled_font_t returned from cairo_scaled_font_create() is
also for the FreeType backend and can be used with functions such
as cairo_ft_font_lock_face()
Font rendering options are represented both here and when you
call cairo_scaled_font_create(). Font options that have a representation
in a cairo_ft_font_options_substitute().
|
A fully resolved fontconfig
pattern. A pattern can be resolved, by, among other things, calling
FcConfigSubstitute()FcDefaultSubstitute()FcFontMatch()FcPatternReference()FcPatternDestroy() |
Returns : |
a newly created cairo_font_face_t. Free with
cairo_font_face_destroy() when you are done using it.
|
void cairo_ft_font_options_substitute (const cairo_font_options_t *options,FcPattern *pattern);
Add options to a FcConfigSubstitute()FcDefaultSubstitute()
|
a cairo_font_options_t object |
|
an existing |
FT_Face cairo_ft_scaled_font_lock_face (cairo_scaled_font_t *scaled_font);
cairo_ft_font_lock_face()cairo_ft_font_unlock_face()cairo_ft_font_lock_face()cairo_ft_font_unlock_face()
You must be careful when using this function in a library or in a threaded application, because freetype's design makes it unsafe to call freetype functions simultaneously from multiple threads, (even if using distinct FT_Face objects). Because of this, application code that acquires an FT_Face object with this call must add it's own locking to protect any use of that object, (and which also must protect any other calls into cairo as almost any cairo function might result in a call into the freetype library).
|
A cairo_scaled_font_t from the FreeType font backend. Such an
object can be created by calling cairo_scaled_font_create() on a
FreeType backend font face (see cairo_ft_font_face_create_for_pattern(),
cairo_ft_font_face_create_for_face() |
Returns : |
The font, scaled appropriately,
or NULLscaled_font is in an error state (see
cairo_scaled_font_status()) or there is insufficient memory.
|
void cairo_ft_scaled_font_unlock_face (cairo_scaled_font_t *scaled_font);
Releases a face obtained with cairo_ft_scaled_font_lock_face().
|
A cairo_scaled_font_t from the FreeType font backend. Such an
object can be created by calling cairo_scaled_font_create() on a
FreeType backend font face (see cairo_ft_font_face_create_for_pattern(),
cairo_ft_font_face_create_for_ft_face()).
|