提交 4f4b114a 编写于 作者: B Behdad Esfahbod

[util] Move code around

上级 46d86a73
......@@ -61,16 +61,10 @@ _hb_cr_text_glyphs (cairo_t *cr,
hb_buffer = hb_buffer_create ();
if (shape_opts->direction)
hb_buffer_set_direction (hb_buffer, hb_direction_from_string (shape_opts->direction, -1));
if (shape_opts->script)
hb_buffer_set_script (hb_buffer, hb_script_from_string (shape_opts->script, -1));
if (shape_opts->language)
hb_buffer_set_language (hb_buffer, hb_language_from_string (shape_opts->language, -1));
hb_buffer_add_utf8 (hb_buffer, utf8, len, 0, len);
if (!hb_shape_full (hb_font, hb_buffer, shape_opts->features, shape_opts->num_features, NULL, shape_opts->shapers))
if (!shape_opts->shape (hb_font, hb_buffer))
fail ("All shapers failed");
num_glyphs = hb_buffer_get_length (hb_buffer);
......
......@@ -63,6 +63,20 @@ extern struct shape_options_t
g_free (shapers);
}
void setup_buffer (hb_buffer_t *buffer) {
if (direction)
hb_buffer_set_direction (buffer, hb_direction_from_string (direction, -1));
if (script)
hb_buffer_set_script (buffer, hb_script_from_string (script, -1));
if (language)
hb_buffer_set_language (buffer, hb_language_from_string (language, -1));
}
bool shape (hb_font_t *font, hb_buffer_t *buffer) {
setup_buffer (buffer);
return hb_shape_full (font, buffer, features, num_features, NULL, shapers);
}
const char *text;
const char *direction;
const char *language;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册