Add hb_font_make/is_immutable()
This commit is contained in:
parent
8c7a100a4d
commit
74f1d896f2
|
@ -80,6 +80,8 @@ struct _hb_face_t {
|
||||||
struct _hb_font_t {
|
struct _hb_font_t {
|
||||||
hb_object_header_t header;
|
hb_object_header_t header;
|
||||||
|
|
||||||
|
hb_bool_t immutable;
|
||||||
|
|
||||||
hb_face_t *face;
|
hb_face_t *face;
|
||||||
|
|
||||||
unsigned int x_scale;
|
unsigned int x_scale;
|
||||||
|
|
|
@ -448,6 +448,8 @@ hb_face_get_upem (hb_face_t *face)
|
||||||
static hb_font_t _hb_font_nil = {
|
static hb_font_t _hb_font_nil = {
|
||||||
HB_OBJECT_HEADER_STATIC,
|
HB_OBJECT_HEADER_STATIC,
|
||||||
|
|
||||||
|
TRUE, /* immutable */
|
||||||
|
|
||||||
&_hb_face_nil,
|
&_hb_face_nil,
|
||||||
|
|
||||||
0, /* x_scale */
|
0, /* x_scale */
|
||||||
|
@ -514,6 +516,21 @@ hb_font_get_user_data (hb_font_t *font,
|
||||||
return hb_object_get_user_data (font, key);
|
return hb_object_get_user_data (font, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
hb_font_make_immutable (hb_font_t *font)
|
||||||
|
{
|
||||||
|
if (hb_object_is_inert (font))
|
||||||
|
return;
|
||||||
|
|
||||||
|
font->immutable = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
hb_bool_t
|
||||||
|
hb_font_is_immutable (hb_font_t *font)
|
||||||
|
{
|
||||||
|
return font->immutable;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
hb_face_t *
|
hb_face_t *
|
||||||
hb_font_get_face (hb_font_t *font)
|
hb_font_get_face (hb_font_t *font)
|
||||||
|
@ -528,7 +545,7 @@ hb_font_set_funcs (hb_font_t *font,
|
||||||
void *user_data,
|
void *user_data,
|
||||||
hb_destroy_func_t destroy)
|
hb_destroy_func_t destroy)
|
||||||
{
|
{
|
||||||
if (hb_object_is_inert (font))
|
if (font->immutable)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (font->destroy)
|
if (font->destroy)
|
||||||
|
@ -550,6 +567,9 @@ hb_font_unset_funcs (hb_font_t *font,
|
||||||
void **user_data,
|
void **user_data,
|
||||||
hb_destroy_func_t *destroy)
|
hb_destroy_func_t *destroy)
|
||||||
{
|
{
|
||||||
|
if (font->immutable)
|
||||||
|
return;
|
||||||
|
|
||||||
/* None of the input arguments can be NULL. */
|
/* None of the input arguments can be NULL. */
|
||||||
|
|
||||||
*klass = font->klass;
|
*klass = font->klass;
|
||||||
|
@ -569,7 +589,7 @@ hb_font_set_scale (hb_font_t *font,
|
||||||
int x_scale,
|
int x_scale,
|
||||||
int y_scale)
|
int y_scale)
|
||||||
{
|
{
|
||||||
if (hb_object_is_inert (font))
|
if (font->immutable)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
font->x_scale = x_scale;
|
font->x_scale = x_scale;
|
||||||
|
@ -590,7 +610,7 @@ hb_font_set_ppem (hb_font_t *font,
|
||||||
unsigned int x_ppem,
|
unsigned int x_ppem,
|
||||||
unsigned int y_ppem)
|
unsigned int y_ppem)
|
||||||
{
|
{
|
||||||
if (hb_object_is_inert (font))
|
if (font->immutable)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
font->x_ppem = x_ppem;
|
font->x_ppem = x_ppem;
|
||||||
|
|
|
@ -225,6 +225,12 @@ void *
|
||||||
hb_font_get_user_data (hb_font_t *font,
|
hb_font_get_user_data (hb_font_t *font,
|
||||||
hb_user_data_key_t *key);
|
hb_user_data_key_t *key);
|
||||||
|
|
||||||
|
void
|
||||||
|
hb_font_make_immutable (hb_font_t *font);
|
||||||
|
|
||||||
|
hb_bool_t
|
||||||
|
hb_font_is_immutable (hb_font_t *font);
|
||||||
|
|
||||||
|
|
||||||
hb_face_t *
|
hb_face_t *
|
||||||
hb_font_get_face (hb_font_t *font);
|
hb_font_get_face (hb_font_t *font);
|
||||||
|
|
|
@ -161,8 +161,8 @@ static const object_t objects[] =
|
||||||
{
|
{
|
||||||
OBJECT_WITHOUT_IMMUTABILITY (buffer),
|
OBJECT_WITHOUT_IMMUTABILITY (buffer),
|
||||||
OBJECT_WITHOUT_IMMUTABILITY (face),
|
OBJECT_WITHOUT_IMMUTABILITY (face),
|
||||||
OBJECT_WITHOUT_IMMUTABILITY (font),
|
|
||||||
OBJECT_WITH_IMMUTABILITY (blob),
|
OBJECT_WITH_IMMUTABILITY (blob),
|
||||||
|
OBJECT_WITH_IMMUTABILITY (font),
|
||||||
OBJECT_WITH_IMMUTABILITY (font_funcs),
|
OBJECT_WITH_IMMUTABILITY (font_funcs),
|
||||||
OBJECT_WITH_IMMUTABILITY (unicode_funcs)
|
OBJECT_WITH_IMMUTABILITY (unicode_funcs)
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue