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-view.c b/src/hb-view.c
index 5c0c48c..b5fb670 100644
--- a/src/hb-view.c
+++ b/src/hb-view.c
@@ -184,8 +184,8 @@
hb_buffer_set_unicode_funcs (hb_buffer, hb_glib_get_unicode_funcs ());
hb_buffer_add_utf8 (hb_buffer, text, len, 0, len);
- /* hb_buffer_set_script (hb_buffer, HB_SCRIPT_LATIN); */
- /* hb_buffer_set_direction (hb_buffer, HB_DIRECTION_LTR); */
+ hb_buffer_set_script (hb_buffer, HB_SCRIPT_INVALID);
+ hb_buffer_set_direction (hb_buffer, HB_DIRECTION_INVALID);
hb_buffer_set_language (hb_buffer, hb_language_from_string (language));
hb_shape (hb_font, hb_face, hb_buffer, NULL, 0);