More contour point use

This commit is contained in:
Behdad Esfahbod 2010-04-29 03:59:06 -04:00
parent 3840b6b505
commit 6f729b45b0
3 changed files with 15 additions and 7 deletions

View File

@ -196,6 +196,7 @@ hb_font_get_contour_point (hb_font_t *font, hb_face_t *face,
unsigned int point_index,
hb_codepoint_t glyph, hb_position_t *x, hb_position_t *y)
{
*x = 0; *y = 0;
return font->klass->get_contour_point (font, face, font->user_data,
point_index,
glyph, x, y);

View File

@ -116,9 +116,11 @@ struct CaretValueFormat2
inline int get_caret_value (hb_ot_layout_context_t *context, hb_codepoint_t glyph_id) const
{
/* TODO vertical */
hb_position_t x = 0, y = 0;
hb_font_get_contour_point (context->font, context->face, caretValuePoint, glyph_id, &x, &y);
return x;
hb_position_t x, y;
if (hb_font_get_contour_point (context->font, context->face, caretValuePoint, glyph_id, &x, &y))
return x;
else
return 0;
}
inline bool sanitize (SANITIZE_ARG_DEF) {

View File

@ -221,10 +221,15 @@ struct AnchorFormat2
inline void get_anchor (hb_ot_layout_context_t *layout_context, hb_codepoint_t glyph_id,
hb_position_t *x, hb_position_t *y) const
{
/* TODO Contour
* NOTE only adjust directions with nonzero ppem */
*x = _hb_16dot16_mul_round (layout_context->font->x_scale, xCoordinate);
*y = _hb_16dot16_mul_round (layout_context->font->y_scale, yCoordinate);
unsigned int x_ppem = layout_context->font->x_ppem;
unsigned int y_ppem = layout_context->font->y_ppem;
hb_position_t cx, cy;
hb_bool_t ret;
if (x_ppem || y_ppem)
ret = hb_font_get_contour_point (layout_context->font, layout_context->face, anchorPoint, glyph_id, &cx, &cy);
*x = x_ppem && ret ? cx : _hb_16dot16_mul_round (layout_context->font->x_scale, xCoordinate);
*y = y_ppem && ret ? cy : _hb_16dot16_mul_round (layout_context->font->y_scale, yCoordinate);
}
inline bool sanitize (SANITIZE_ARG_DEF) {