diff options
author | Youngbok Shin <youngb.shin@samsung.com> | 2016-08-22 11:23:44 +0900 |
---|---|---|
committer | Youngbok Shin <youngb.shin@samsung.com> | 2016-08-22 11:23:44 +0900 |
commit | e684182ac634596bace621b0e84dfc98d2bc82c5 (patch) | |
tree | e6ce432188d6fe2b0b4bee6ddad34e7977c26a44 /src/hb-graphite2.cc | |
parent | 087e8c5d58be057cb77192932cd7fa8f7aacf1a5 (diff) | |
download | harfbuzz-e684182ac634596bace621b0e84dfc98d2bc82c5.tar.gz harfbuzz-e684182ac634596bace621b0e84dfc98d2bc82c5.tar.bz2 harfbuzz-e684182ac634596bace621b0e84dfc98d2bc82c5.zip |
Revert "Imported Upstream version 1.2.7"
This reverts commit 087e8c5d58be057cb77192932cd7fa8f7aacf1a5.
Diffstat (limited to 'src/hb-graphite2.cc')
-rw-r--r-- | src/hb-graphite2.cc | 107 |
1 files changed, 29 insertions, 78 deletions
diff --git a/src/hb-graphite2.cc b/src/hb-graphite2.cc index c32318d..807c330 100644 --- a/src/hb-graphite2.cc +++ b/src/hb-graphite2.cc @@ -138,9 +138,6 @@ _hb_graphite2_shaper_face_data_destroy (hb_graphite2_shaper_face_data_t *data) free (data); } -/* - * Since: 0.9.10 - */ gr_face * hb_graphite2_face_get_gr_face (hb_face_t *face) { @@ -175,9 +172,6 @@ _hb_graphite2_shaper_font_data_destroy (hb_graphite2_shaper_font_data_t *data) gr_font_destroy (data); } -/* - * Since: 0.9.10 - */ gr_font * hb_graphite2_font_get_gr_font (hb_font_t *font) { @@ -216,7 +210,6 @@ struct hb_graphite2_cluster_t { unsigned int base_glyph; unsigned int num_glyphs; unsigned int cluster; - float advance; }; hb_bool_t @@ -235,11 +228,12 @@ _hb_graphite2_shape (hb_shape_plan_t *shape_plan, int lang_len = lang_end ? lang_end - lang : -1; gr_feature_val *feats = gr_face_featureval_for_lang (grface, lang ? hb_tag_from_string (lang, lang_len) : 0); - for (unsigned int i = 0; i < num_features; i++) + while (num_features--) { - const gr_feature_ref *fref = gr_face_find_fref (grface, features[i].tag); + const gr_feature_ref *fref = gr_face_find_fref (grface, features->tag); if (fref) - gr_fref_set_feature_value (fref, features[i].value, feats); + gr_fref_set_feature_value (fref, features->value, feats); + features++; } gr_segment *seg = NULL; @@ -255,8 +249,6 @@ _hb_graphite2_shape (hb_shape_plan_t *shape_plan, for (unsigned int i = 0; i < buffer->len; ++i) chars[i] = buffer->info[i].codepoint; - /* TODO ensure_native_direction. */ - hb_tag_t script_tag[2]; hb_ot_tags_from_script (hb_buffer_get_script (buffer), &script_tag[0], &script_tag[1]); @@ -275,11 +267,9 @@ _hb_graphite2_shape (hb_shape_plan_t *shape_plan, if (unlikely (!glyph_count)) { if (feats) gr_featureval_destroy (feats); gr_seg_destroy (seg); - buffer->len = 0; - return true; + return false; } - buffer->ensure (glyph_count); scratch = buffer->get_scratch_buffer (&scratch_size); while ((DIV_CEIL (sizeof (hb_graphite2_cluster_t) * buffer->len, sizeof (*scratch)) + DIV_CEIL (sizeof (hb_codepoint_t) * glyph_count, sizeof (*scratch))) > scratch_size) @@ -311,12 +301,6 @@ _hb_graphite2_shape (hb_shape_plan_t *shape_plan, hb_codepoint_t *pg = gids; clusters[0].cluster = buffer->info[0].cluster; - float curradv = HB_DIRECTION_IS_BACKWARD(buffer->props.direction) ? gr_slot_origin_X(gr_seg_first_slot(seg)) : 0.; - if (HB_DIRECTION_IS_BACKWARD(buffer->props.direction)) - { - curradv = gr_slot_origin_X(gr_seg_first_slot(seg)); - clusters[0].advance = gr_seg_advance_X(seg) - curradv; - } for (is = gr_seg_first_slot (seg), ic = 0; is; is = gr_slot_next_in_segment (is), ic++) { unsigned int before = gr_slot_before (is); @@ -327,7 +311,6 @@ _hb_graphite2_shape (hb_shape_plan_t *shape_plan, { clusters[ci-1].num_chars += clusters[ci].num_chars; clusters[ci-1].num_glyphs += clusters[ci].num_glyphs; - clusters[ci-1].advance += clusters[ci].advance; ci--; } @@ -339,26 +322,16 @@ _hb_graphite2_shape (hb_shape_plan_t *shape_plan, c->num_chars = before - c->base_char; c->base_glyph = ic; c->num_glyphs = 0; - if (HB_DIRECTION_IS_BACKWARD(buffer->props.direction)) - { - ci++; - clusters[ci].advance = curradv - gr_slot_origin_X(is); - } else { - clusters[ci].advance = gr_slot_origin_X(is) - curradv; - ci++; - } - curradv = gr_slot_origin_X(is); + ci++; } clusters[ci].num_glyphs++; if (clusters[ci].base_char + clusters[ci].num_chars < after + 1) clusters[ci].num_chars = after + 1 - clusters[ci].base_char; } - - if (!HB_DIRECTION_IS_BACKWARD(buffer->props.direction)) - clusters[ci].advance = gr_seg_advance_X(seg) - curradv; ci++; + //buffer->clear_output (); for (unsigned int i = 0; i < ci; ++i) { for (unsigned int j = 0; j < clusters[i].num_glyphs; ++j) @@ -366,57 +339,35 @@ _hb_graphite2_shape (hb_shape_plan_t *shape_plan, hb_glyph_info_t *info = &buffer->info[clusters[i].base_glyph + j]; info->codepoint = gids[clusters[i].base_glyph + j]; info->cluster = clusters[i].cluster; - info->var1.i32 = clusters[i].advance; // all glyphs in the cluster get the same advance } } buffer->len = glyph_count; + //buffer->swap_buffers (); - float yscale = font->y_scale / font->x_scale; - /* Positioning. */ - if (!HB_DIRECTION_IS_BACKWARD(buffer->props.direction)) + if (HB_DIRECTION_IS_BACKWARD(buffer->props.direction)) + curradvx = gr_seg_advance_X(seg); + + hb_glyph_position_t *pPos; + for (pPos = hb_buffer_get_glyph_positions (buffer, NULL), is = gr_seg_first_slot (seg); + is; pPos++, is = gr_slot_next_in_segment (is)) { - int currclus = -1; - const hb_glyph_info_t *info = buffer->info; - hb_glyph_position_t *pPos = hb_buffer_get_glyph_positions (buffer, NULL); - curradvx = 0; - for (is = gr_seg_first_slot (seg); is; pPos++, ++info, is = gr_slot_next_in_segment (is)) - { - pPos->x_offset = gr_slot_origin_X (is) - curradvx; - pPos->y_offset = gr_slot_origin_Y (is) * yscale - curradvy; - if (info->cluster != currclus) { - pPos->x_advance = info->var1.i32; - curradvx += pPos->x_advance; - currclus = info->cluster; - } else - pPos->x_advance = 0.; - - pPos->y_advance = gr_slot_advance_Y (is, grface, grfont) * yscale; - curradvy += pPos->y_advance; - } + pPos->x_offset = gr_slot_origin_X (is) - curradvx; + pPos->y_offset = gr_slot_origin_Y (is) - curradvy; + pPos->x_advance = gr_slot_advance_X (is, grface, grfont); + pPos->y_advance = gr_slot_advance_Y (is, grface, grfont); + if (HB_DIRECTION_IS_BACKWARD (buffer->props.direction)) + curradvx -= pPos->x_advance; + pPos->x_offset = gr_slot_origin_X (is) - curradvx; + if (!HB_DIRECTION_IS_BACKWARD (buffer->props.direction)) + curradvx += pPos->x_advance; + pPos->y_offset = gr_slot_origin_Y (is) - curradvy; + curradvy += pPos->y_advance; } - else - { - int currclus = -1; - const hb_glyph_info_t *info = buffer->info; - hb_glyph_position_t *pPos = hb_buffer_get_glyph_positions (buffer, NULL); - curradvx = gr_seg_advance_X(seg); - for (is = gr_seg_first_slot (seg); is; pPos++, info++, is = gr_slot_next_in_segment (is)) - { - if (info->cluster != currclus) - { - pPos->x_advance = info->var1.i32; - if (currclus != -1) curradvx -= info[-1].var1.i32; - currclus = info->cluster; - } else - pPos->x_advance = 0.; - - pPos->y_advance = gr_slot_advance_Y (is, grface, grfont) * yscale; - curradvy -= pPos->y_advance; - pPos->x_offset = gr_slot_origin_X (is) - curradvx + pPos->x_advance; - pPos->y_offset = gr_slot_origin_Y (is) * yscale - curradvy; - } + if (!HB_DIRECTION_IS_BACKWARD (buffer->props.direction)) + pPos[-1].x_advance += gr_seg_advance_X(seg) - curradvx; + + if (HB_DIRECTION_IS_BACKWARD (buffer->props.direction)) hb_buffer_reverse_clusters (buffer); - } if (feats) gr_featureval_destroy (feats); gr_seg_destroy (seg); |