Let hb_shape() guess script and direction... - Rename HB_SCRIPT_INVALID_CODE to HB_SCRIPT_INVALID - Add HB_DIRECTION_INVALID - Make hb_script_get_horizontal_direction() public - Make hb_shape() guess script from buffer text (first non-common non-inherit script) if buffer script is set to HB_SCRIPT_INVALID (this is NOT the default.) - Make hb_shape() guess direction from buffer script if buffer direction is set to HB_DIRECTION_INVALID (this is NOT the default.) - Make hb-view.c set INVALID script and direction on the buffer. The above changes are meant to make hb-view fairly useful for uni-script uni-direction text. The guessing behavior however is NOT the default of hb_shape() and must be asked for explicitly. This is intended, because the guess is not a suitable substitute to full-fledged bidi and script segmentation. It's just a testing tool.
diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc index 92c3925..e6b3f3e 100644 --- a/src/hb-ot-shape.cc +++ b/src/hb-ot-shape.cc
@@ -64,6 +64,7 @@ break; case HB_DIRECTION_TTB: case HB_DIRECTION_BTT: + case HB_DIRECTION_INVALID: default: break; } @@ -170,7 +171,7 @@ /* TODO vertical */ if (HB_DIRECTION_IS_HORIZONTAL (direction) && - direction != _hb_script_get_horizontal_direction (c->buffer->props.script)) + direction != hb_script_get_horizontal_direction (c->buffer->props.script)) { hb_buffer_reverse_clusters (c->buffer); c->buffer->props.direction = HB_DIRECTION_REVERSE (c->buffer->props.direction);