[ot-layout] Add central baselines

Add HB_OT_LAYOUT_BASELINE_TAG_IDEO_EMBOX_CENTRAL
and HB_OT_LAYOUT_BASELINE_TAG_IDEO_FACE_CENTRAL
which are the centers of the ideographic em-box
and face box.
This commit is contained in:
Matthias Clasen 2022-02-16 13:10:52 -06:00
parent f81578fd86
commit 95bb2ff719
2 changed files with 44 additions and 0 deletions

View File

@ -2241,6 +2241,46 @@ hb_ot_layout_get_baseline_with_fallback (hb_font_t *font,
*coord = font->x_scale * 6 / 10; // FIXME makes assumptions about origin
break;
case HB_OT_LAYOUT_BASELINE_TAG_IDEO_EMBOX_CENTRAL:
{
hb_position_t top, bottom;
hb_ot_layout_get_baseline_with_fallback (font,
HB_OT_LAYOUT_BASELINE_TAG_IDEO_EMBOX_TOP_OR_RIGHT,
direction,
script_tag,
language_tag,
&top);
hb_ot_layout_get_baseline_with_fallback (font,
HB_OT_LAYOUT_BASELINE_TAG_IDEO_EMBOX_BOTTOM_OR_LEFT,
direction,
script_tag,
language_tag,
&bottom);
*coord = (top + bottom) / 2;
}
break;
case HB_OT_LAYOUT_BASELINE_TAG_IDEO_FACE_CENTRAL:
{
hb_position_t top, bottom;
hb_ot_layout_get_baseline_with_fallback (font,
HB_OT_LAYOUT_BASELINE_TAG_IDEO_FACE_TOP_OR_RIGHT,
direction,
script_tag,
language_tag,
&top);
hb_ot_layout_get_baseline_with_fallback (font,
HB_OT_LAYOUT_BASELINE_TAG_IDEO_FACE_BOTTOM_OR_LEFT,
direction,
script_tag,
language_tag,
&bottom);
*coord = (top + bottom) / 2;
}
break;
case _HB_OT_LAYOUT_BASELINE_TAG_MAX_VALUE:
default:
*coord = 0;

View File

@ -487,9 +487,11 @@ hb_ot_layout_feature_get_characters (hb_face_t *face,
* if the direction is horizontal or vertical, respectively.
* @HB_OT_LAYOUT_BASELINE_TAG_IDEO_FACE_TOP_OR_RIGHT: Ideographic character face top or right edge,
* if the direction is horizontal or vertical, respectively.
* @HB_OT_LAYOUT_BASELINE_TAG_IDEO_FACE_CENTRAL: The center of the ideographic character face. Since: REPLACEME
* @HB_OT_LAYOUT_BASELINE_TAG_IDEO_EMBOX_BOTTOM_OR_LEFT: Ideographic em-box bottom or left edge,
* if the direction is horizontal or vertical, respectively.
* @HB_OT_LAYOUT_BASELINE_TAG_IDEO_EMBOX_TOP_OR_RIGHT: Ideographic em-box top or right edge baseline,
* @HB_OT_LAYOUT_BASELINE_TAG_IDEO_EMBOX_CENTRAL: The center of the ideographic em-box. Since: REPLACEME
* if the direction is horizontal or vertical, respectively.
* @HB_OT_LAYOUT_BASELINE_TAG_MATH: The baseline about which mathematical characters are centered.
* In vertical writing mode when mathematical characters rotated 90 degrees clockwise, are centered.
@ -503,8 +505,10 @@ typedef enum {
HB_OT_LAYOUT_BASELINE_TAG_HANGING = HB_TAG ('h','a','n','g'),
HB_OT_LAYOUT_BASELINE_TAG_IDEO_FACE_BOTTOM_OR_LEFT = HB_TAG ('i','c','f','b'),
HB_OT_LAYOUT_BASELINE_TAG_IDEO_FACE_TOP_OR_RIGHT = HB_TAG ('i','c','f','t'),
HB_OT_LAYOUT_BASELINE_TAG_IDEO_FACE_CENTRAL = HB_TAG ('I','c','f','c'),
HB_OT_LAYOUT_BASELINE_TAG_IDEO_EMBOX_BOTTOM_OR_LEFT = HB_TAG ('i','d','e','o'),
HB_OT_LAYOUT_BASELINE_TAG_IDEO_EMBOX_TOP_OR_RIGHT = HB_TAG ('i','d','t','p'),
HB_OT_LAYOUT_BASELINE_TAG_IDEO_EMBOX_CENTRAL = HB_TAG ('I','d','c','e'),
HB_OT_LAYOUT_BASELINE_TAG_MATH = HB_TAG ('m','a','t','h'),
/*< private >*/