*/
static hb_bool_t
-hb_font_get_font_h_extents_nil (hb_font_t *font,
+hb_font_get_font_h_extents_nil (hb_font_t *font HB_UNUSED,
void *font_data HB_UNUSED,
hb_font_extents_t *metrics,
void *user_data HB_UNUSED)
}
static hb_bool_t
-hb_font_get_font_v_extents_nil (hb_font_t *font,
+hb_font_get_font_v_extents_nil (hb_font_t *font HB_UNUSED,
void *font_data HB_UNUSED,
hb_font_extents_t *metrics,
void *user_data HB_UNUSED)
true, /* immutable */
{
-#define HB_FONT_FUNC_IMPLEMENT(name) NULL,
+#define HB_FONT_FUNC_IMPLEMENT(name) nullptr,
HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
#undef HB_FONT_FUNC_IMPLEMENT
},
{
-#define HB_FONT_FUNC_IMPLEMENT(name) NULL,
+#define HB_FONT_FUNC_IMPLEMENT(name) nullptr,
HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
#undef HB_FONT_FUNC_IMPLEMENT
},
true, /* immutable */
{
-#define HB_FONT_FUNC_IMPLEMENT(name) NULL,
+#define HB_FONT_FUNC_IMPLEMENT(name) nullptr,
HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
#undef HB_FONT_FUNC_IMPLEMENT
},
{
-#define HB_FONT_FUNC_IMPLEMENT(name) NULL,
+#define HB_FONT_FUNC_IMPLEMENT(name) nullptr,
HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
#undef HB_FONT_FUNC_IMPLEMENT
},
ffuncs->destroy.name = destroy; \
} else { \
ffuncs->get.f.name = hb_font_get_##name##_parent; \
- ffuncs->user_data.name = NULL; \
- ffuncs->destroy.name = NULL; \
+ ffuncs->user_data.name = nullptr; \
+ ffuncs->destroy.name = nullptr; \
} \
}
font->y_scale = parent->y_scale;
font->x_ppem = parent->x_ppem;
font->y_ppem = parent->y_ppem;
+ font->ptem = parent->ptem;
- /* TODO: copy variation coordinates. */
+ font->num_coords = parent->num_coords;
+ if (!font->num_coords)
+ font->coords = nullptr;
+ else
+ {
+ unsigned int size = parent->num_coords * sizeof (parent->coords[0]);
+ font->coords = (int *) malloc (size);
+ if (unlikely (!font->coords))
+ font->num_coords = 0;
+ else
+ memcpy (font->coords, parent->coords, size);
+ }
return font;
}
true, /* immutable */
- NULL, /* parent */
+ nullptr, /* parent */
const_cast<hb_face_t *> (&_hb_face_nil),
1000, /* x_scale */
0, /* x_ppem */
0, /* y_ppem */
+ 0, /* ptem */
0, /* num_coords */
- NULL, /* coords */
+ nullptr, /* coords */
const_cast<hb_font_funcs_t *> (&_hb_font_funcs_nil), /* klass */
- NULL, /* user_data */
- NULL, /* destroy */
-
- hb_font_t::NOTHING, /* dirty */
+ nullptr, /* user_data */
+ nullptr, /* destroy */
{
#define HB_SHAPER_IMPLEMENT(shaper) HB_SHAPER_DATA_INVALID,
if (!parent)
parent = hb_font_get_empty ();
- if (parent == font->parent)
- return;
-
- font->dirty |= font->PARENT;
-
hb_font_t *old = font->parent;
font->parent = hb_font_reference (parent);
if (unlikely (!face))
face = hb_face_get_empty ();
- if (font->face == face)
- return;
-
- font->dirty |= font->FACE;
-
hb_face_t *old = font->face;
font->face = hb_face_reference (face);
if (!klass)
klass = hb_font_funcs_get_empty ();
- font->dirty |= font->FUNCS;
-
hb_font_funcs_reference (klass);
hb_font_funcs_destroy (font->klass);
font->klass = klass;
if (font->immutable)
return;
- if (font->x_scale == x_scale && font->y_scale == y_scale)
- return;
-
- font->dirty |= font->SCALE;
-
font->x_scale = x_scale;
font->y_scale = y_scale;
}
if (font->immutable)
return;
- if (font->x_ppem == x_ppem && font->y_ppem == y_ppem)
- return;
-
- font->dirty |= font->PPEM;
-
font->x_ppem = x_ppem;
font->y_ppem = y_ppem;
}
if (y_ppem) *y_ppem = font->y_ppem;
}
+/**
+ * hb_font_set_ptem:
+ * @font: a font.
+ * @ptem:
+ *
+ * Sets "point size" of the font.
+ *
+ * Since: 1.6.0
+ **/
+void
+hb_font_set_ptem (hb_font_t *font, float ptem)
+{
+ if (font->immutable)
+ return;
+
+ font->ptem = ptem;
+}
+
+/**
+ * hb_font_get_ptem:
+ * @font: a font.
+ *
+ * Gets the "point size" of the font. A value of 0 means unset.
+ *
+ * Return value: Point size.
+ *
+ * Since: 0.9.2
+ **/
+float
+hb_font_get_ptem (hb_font_t *font)
+{
+ return font->ptem;
+}
+
/*
* Variations
*/
int *coords, /* 2.14 normalized */
unsigned int coords_length)
{
- if (font->num_coords == coords_length &&
- (coords_length == 0 ||
- 0 == memcmp (font->coords, coords, coords_length * sizeof (coords[0]))))
- {
- free (coords);
- return;
- }
-
- font->dirty |= font->VARIATIONS;
-
free (font->coords);
font->coords = coords;
if (!variations_length)
{
- hb_font_set_var_coords_normalized (font, NULL, 0);
+ hb_font_set_var_coords_normalized (font, nullptr, 0);
return;
}
unsigned int coords_length = hb_ot_var_get_axis_count (font->face);
- int *normalized = coords_length ? (int *) calloc (coords_length, sizeof (int)) : NULL;
+ int *normalized = coords_length ? (int *) calloc (coords_length, sizeof (int)) : nullptr;
if (unlikely (coords_length && !normalized))
return;
if (font->immutable)
return;
- int *normalized = coords_length ? (int *) calloc (coords_length, sizeof (int)) : NULL;
+ int *normalized = coords_length ? (int *) calloc (coords_length, sizeof (int)) : nullptr;
if (unlikely (coords_length && !normalized))
return;
if (font->immutable)
return;
- int *copy = coords_length ? (int *) calloc (coords_length, sizeof (coords[0])) : NULL;
+ int *copy = coords_length ? (int *) calloc (coords_length, sizeof (coords[0])) : nullptr;
if (unlikely (coords_length && !copy))
return;
trampoline_t *trampoline = (trampoline_t *) calloc (1, sizeof (trampoline_t));
if (unlikely (!trampoline))
- return NULL;
+ return nullptr;
trampoline->closure.user_data = user_data;
trampoline->closure.destroy = destroy;