diff --git a/src/hb-font.cc b/src/hb-font.cc index 3b1b6ca1729660b67772d5726010347c94df12f3..d0d58f1fbb2224bbcab53df87a22935c962dbe4e 100644 --- a/src/hb-font.cc +++ b/src/hb-font.cc @@ -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); diff --git a/src/hb-ot-layout-gdef-private.hh b/src/hb-ot-layout-gdef-private.hh index cc037a4d48e7b0ecccd4aef707851aa9e0735979..e85b578194ba2b3aff602ac8a84b542b9e4ba7f2 100644 --- a/src/hb-ot-layout-gdef-private.hh +++ b/src/hb-ot-layout-gdef-private.hh @@ -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) { diff --git a/src/hb-ot-layout-gpos-private.hh b/src/hb-ot-layout-gpos-private.hh index f3fb26596728b66a6d40aa093189949e186d101c..07c4117519484a0b06ec0426d69918cbb290132f 100644 --- a/src/hb-ot-layout-gpos-private.hh +++ b/src/hb-ot-layout-gpos-private.hh @@ -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) {