font->x_ppem = parent->x_ppem;
font->y_ppem = parent->y_ppem;
+ /* TODO: copy variation coordinates. */
+
return font;
}
0, /* x_ppem */
0, /* y_ppem */
- NULL, /* coords */
- 0, /* coord_count */
+ 0, /* num_coords */
+ NULL, /* x_coords */
+ NULL, /* y_coords */
const_cast<hb_font_funcs_t *> (&_hb_font_funcs_nil), /* klass */
NULL, /* user_data */
hb_face_destroy (font->face);
hb_font_funcs_destroy (font->klass);
+ /* TODO: destroy variation coordinates. */
+
free (font);
}
{
inline hb_position_t get_x_delta (hb_font_t *font) const
- { return font->em_scalef_x (get_delta (font->coords, font->coord_count)); }
+ { return font->em_scalef_x (get_delta (font->x_coords, font->num_coords)); }
inline hb_position_t get_y_delta (hb_font_t *font) const
- { return font->em_scalef_y (get_delta (font->coords, font->coord_count)); }
+ { return font->em_scalef_y (get_delta (font->y_coords, font->num_coords)); }
inline bool sanitize (hb_sanitize_context_t *c) const
{
const Value *values,
hb_glyph_position_t &glyph_pos) const
{
- unsigned int x_ppem, y_ppem;
unsigned int format = *this;
hb_bool_t horizontal = HB_DIRECTION_IS_HORIZONTAL (direction);
if (!has_device ()) return;
- x_ppem = font->x_ppem;
- y_ppem = font->y_ppem;
+ bool use_x_device = font->x_ppem || font->num_coords;
+ bool use_y_device = font->y_ppem || font->num_coords;
- if (!x_ppem && !y_ppem) return;
+
+ if (!use_x_device && !use_y_device) return;
/* pixel -> fractional pixel */
if (format & xPlaDevice) {
- if (x_ppem) glyph_pos.x_offset += (base + get_device (values)).get_x_delta (font);
+ if (use_x_device) glyph_pos.x_offset += (base + get_device (values)).get_x_delta (font);
values++;
}
if (format & yPlaDevice) {
- if (y_ppem) glyph_pos.y_offset += (base + get_device (values)).get_y_delta (font);
+ if (use_y_device) glyph_pos.y_offset += (base + get_device (values)).get_y_delta (font);
values++;
}
if (format & xAdvDevice) {
- if (horizontal && x_ppem) glyph_pos.x_advance += (base + get_device (values)).get_x_delta (font);
+ if (horizontal && use_x_device) glyph_pos.x_advance += (base + get_device (values)).get_x_delta (font);
values++;
}
if (format & yAdvDevice) {
/* y_advance values grow downward but font-space grows upward, hence negation */
- if (!horizontal && y_ppem) glyph_pos.y_advance -= (base + get_device (values)).get_y_delta (font);
+ if (!horizontal && use_y_device) glyph_pos.y_advance -= (base + get_device (values)).get_y_delta (font);
values++;
}
}
*x = font->em_scale_x (xCoordinate);
*y = font->em_scale_y (yCoordinate);
- if (font->x_ppem)
+ if (font->x_ppem || font->num_coords)
*x += (this+xDeviceTable).get_x_delta (font);
- if (font->y_ppem)
+ if (font->y_ppem || font->num_coords)
*y += (this+yDeviceTable).get_x_delta (font);
}