Top |
hb_face_t * | hb_ft_face_create () |
hb_face_t * | hb_ft_face_create_cached () |
hb_face_t * | hb_ft_face_create_referenced () |
hb_face_t * | hb_ft_face_create_from_file_or_fail () |
hb_font_t * | hb_ft_font_create () |
hb_font_t * | hb_ft_font_create_referenced () |
void | hb_ft_font_changed () |
FT_Face | hb_ft_font_get_face () |
FT_Face | hb_ft_font_lock_face () |
void | hb_ft_font_unlock_face () |
void | hb_ft_font_set_load_flags () |
int | hb_ft_font_get_load_flags () |
void | hb_ft_font_set_funcs () |
hb_bool_t | hb_ft_hb_font_changed () |
Functions for using HarfBuzz with the FreeType library.
HarfBuzz supports using FreeType to provide face and font data.
hb_face_t * hb_ft_face_create (FT_Face ft_face
,hb_destroy_func_t destroy
);
Creates an hb_face_t face object from the specified FT_Face.
Note that this is using the FT_Face object just to get at the underlying
font data, and fonts created from the returned hb_face_t will use the native
HarfBuzz font implementation, unless you call hb_ft_font_set_funcs()
on them.
This variant of the function does not provide any life-cycle management.
Most client programs should use hb_ft_face_create_referenced()
(or, perhaps, hb_ft_face_create_cached()
) instead.
If you know you have valid reasons not to use hb_ft_face_create_referenced()
,
then it is the client program's responsibility to destroy ft_face
after the hb_face_t face object has been destroyed.
ft_face |
FT_Face to work upon. |
[destroy destroy][scope notified] |
destroy |
A callback to call when the face object is not needed anymore. |
[nullable] |
Since: 0.9.2
hb_face_t *
hb_ft_face_create_cached (FT_Face ft_face
);
Creates an hb_face_t face object from the specified FT_Face.
Note that this is using the FT_Face object just to get at the underlying
font data, and fonts created from the returned hb_face_t will use the native
HarfBuzz font implementation, unless you call hb_ft_font_set_funcs()
on them.
This variant of the function caches the newly created hb_face_t
face object, using the generic
pointer of ft_face
. Subsequent function
calls that are passed the same ft_face
parameter will have the same
hb_face_t returned to them, and that hb_face_t will be correctly
reference counted.
However, client programs are still responsible for destroying
ft_face
after the last hb_face_t face object has been destroyed.
Since: 0.9.2
hb_face_t *
hb_ft_face_create_referenced (FT_Face ft_face
);
Creates an hb_face_t face object from the specified FT_Face.
Note that this is using the FT_Face object just to get at the underlying
font data, and fonts created from the returned hb_face_t will use the native
HarfBuzz font implementation, unless you call hb_ft_font_set_funcs()
on them.
This is the preferred variant of the hb_ft_face_create*
function family, because it calls FT_Reference_Face()
on ft_face
,
ensuring that ft_face
remains alive as long as the resulting
hb_face_t face object remains alive. Also calls FT_Done_Face()
when the hb_face_t face object is destroyed.
Use this version unless you know you have good reasons not to.
Since: 0.9.38
hb_face_t * hb_ft_face_create_from_file_or_fail (const char *file_name
,unsigned int index
);
Creates an hb_face_t face object from the specified font file and face index.
This is similar in functionality to hb_face_create_from_file_or_fail()
,
but uses the FreeType library for loading the font file.
The new face object, or NULL
if
no face is found at the specified index or the file cannot be read.
[transfer full]
Since: 10.1.0
hb_font_t * hb_ft_font_create (FT_Face ft_face
,hb_destroy_func_t destroy
);
Creates an hb_font_t font object from the specified FT_Face.
ft_face
before calling
hb_ft_font_create()
on it. HarfBuzz assumes size is always set and will
access `size` member of FT_Face unconditionally.This variant of the function does not provide any life-cycle management.
Most client programs should use hb_ft_font_create_referenced()
instead.
If you know you have valid reasons not to use hb_ft_font_create_referenced()
,
then it is the client program's responsibility to destroy ft_face
after the hb_font_t font object has been destroyed.
HarfBuzz will use the destroy
callback on the hb_font_t font object
if it is supplied when you use this function. However, even if destroy
is provided, it is the client program's responsibility to destroy ft_face
,
and it is the client program's responsibility to ensure that ft_face
is
destroyed only after the hb_font_t font object has been destroyed.
ft_face |
FT_Face to work upon. |
[destroy destroy][scope notified] |
destroy |
A callback to call when the font object is not needed anymore. |
[nullable] |
Since: 0.9.2
hb_font_t *
hb_ft_font_create_referenced (FT_Face ft_face
);
Creates an hb_font_t font object from the specified FT_Face.
ft_face
before calling
hb_ft_font_create_referenced()
on it. HarfBuzz assumes size is always set
and will access `size` member of FT_Face unconditionally.This is the preferred variant of the hb_ft_font_create*
function family, because it calls FT_Reference_Face()
on ft_face
,
ensuring that ft_face
remains alive as long as the resulting
hb_font_t font object remains alive.
Use this version unless you know you have good reasons not to.
Since: 0.9.38
void
hb_ft_font_changed (hb_font_t *font
);
Refreshes the state of font
when the underlying FT_Face has changed.
This function should be called after changing the size or
variation-axis settings on the FT_Face.
Since: 1.0.5
FT_Face
hb_ft_font_get_face (hb_font_t *font
);
Fetches the FT_Face associated with the specified hb_font_t font object.
This function works with hb_font_t objects created by
hb_ft_font_create()
or hb_ft_font_create_referenced()
.
[skip]
Since: 0.9.2
FT_Face
hb_ft_font_lock_face (hb_font_t *font
);
Gets the FT_Face associated with font
.
This face will be kept around and access to the FT_Face object
from other HarfBuzz API wil be blocked until you call hb_ft_font_unlock_face()
.
This function works with hb_font_t objects created by
hb_ft_font_create()
or hb_ft_font_create_referenced()
.
[skip]
Since: 2.6.5
void
hb_ft_font_unlock_face (hb_font_t *font
);
Releases an FT_Face previously obtained with hb_ft_font_lock_face()
.
[skip]
Since: 2.6.5
void hb_ft_font_set_load_flags (hb_font_t *font
,int load_flags
);
Sets the FT_Load_Glyph load flags for the specified hb_font_t.
For more information, see https://freetype.org/freetype2/docs/reference/ft2-glyph_retrieval.html#ft_load_xxx
This function works with hb_font_t objects created by
hb_ft_font_create()
or hb_ft_font_create_referenced()
.
Since: 1.0.5
int
hb_ft_font_get_load_flags (hb_font_t *font
);
Fetches the FT_Load_Glyph load flags of the specified hb_font_t.
For more information, see https://freetype.org/freetype2/docs/reference/ft2-glyph_retrieval.html#ft_load_xxx
This function works with hb_font_t objects created by
hb_ft_font_create()
or hb_ft_font_create_referenced()
.
Since: 1.0.5
void
hb_ft_font_set_funcs (hb_font_t *font
);
Configures the font-functions structure of the specified hb_font_t font object to use FreeType font functions.
In particular, you can use this function to configure an
existing hb_face_t face object for use with FreeType font
functions even if that hb_face_t face object was initially
created with hb_face_create()
, and therefore was not
initially configured to use FreeType font functions.
An hb_font_t object created with hb_ft_font_create()
is preconfigured for FreeType font functions and does not
require this function to be used.
Note that if you modify the underlying hb_font_t after
calling this function, you need to call hb_ft_hb_font_changed()
to update the underlying FT_Face.
Since: 1.0.5
hb_bool_t
hb_ft_hb_font_changed (hb_font_t *font
);
Refreshes the state of the underlying FT_Face of font
when the hb_font_t
font
has changed.
This function should be called after changing the size or
variation-axis settings on the font
.
This call is fast if nothing has changed on font
.
Since: 4.4.0