OLD | NEW |
1 /* | 1 /* |
2 * Copyright © 2011,2012 Google, Inc. | 2 * Copyright © 2011,2012 Google, Inc. |
3 * | 3 * |
4 * This is part of HarfBuzz, a text shaping library. | 4 * This is part of HarfBuzz, a text shaping library. |
5 * | 5 * |
6 * Permission is hereby granted, without written agreement and without | 6 * Permission is hereby granted, without written agreement and without |
7 * license or royalty fees, to use, copy, modify, and distribute this | 7 * license or royalty fees, to use, copy, modify, and distribute this |
8 * software and its documentation for any purpose, provided that the | 8 * software and its documentation for any purpose, provided that the |
9 * above copyright notice and the following two paragraphs appear in | 9 * above copyright notice and the following two paragraphs appear in |
10 * all copies of this software. | 10 * all copies of this software. |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 void | 434 void |
435 _hb_ot_shape_fallback_kern (const hb_ot_shape_plan_t *plan, | 435 _hb_ot_shape_fallback_kern (const hb_ot_shape_plan_t *plan, |
436 hb_font_t *font, | 436 hb_font_t *font, |
437 hb_buffer_t *buffer) | 437 hb_buffer_t *buffer) |
438 { | 438 { |
439 if (!plan->has_kern) return; | 439 if (!plan->has_kern) return; |
440 | 440 |
441 OT::hb_apply_context_t c (1, font, buffer); | 441 OT::hb_apply_context_t c (1, font, buffer); |
442 c.set_lookup_mask (plan->kern_mask); | 442 c.set_lookup_mask (plan->kern_mask); |
443 c.set_lookup_props (OT::LookupFlag::IgnoreMarks); | 443 c.set_lookup_props (OT::LookupFlag::IgnoreMarks); |
| 444 OT::hb_apply_context_t::skipping_iterator_t &skippy_iter = c.iter_input; |
| 445 skippy_iter.init (&c); |
444 | 446 |
445 unsigned int count = buffer->len; | 447 unsigned int count = buffer->len; |
446 hb_glyph_info_t *info = buffer->info; | 448 hb_glyph_info_t *info = buffer->info; |
447 hb_glyph_position_t *pos = buffer->pos; | 449 hb_glyph_position_t *pos = buffer->pos; |
448 for (unsigned int idx = 0; idx < count;) | 450 for (unsigned int idx = 0; idx < count;) |
449 { | 451 { |
450 OT::hb_apply_context_t::skipping_forward_iterator_t skippy_iter (&c, idx, 1)
; | 452 skippy_iter.reset (idx, 1); |
451 if (!skippy_iter.next ()) | 453 if (!skippy_iter.next ()) |
452 { | 454 { |
453 idx++; | 455 idx++; |
454 continue; | 456 continue; |
455 } | 457 } |
456 | 458 |
457 hb_position_t x_kern, y_kern; | 459 hb_position_t x_kern, y_kern; |
458 font->get_glyph_kerning_for_direction (info[idx].codepoint, | 460 font->get_glyph_kerning_for_direction (info[idx].codepoint, |
459 info[skippy_iter.idx].codepoint, | 461 info[skippy_iter.idx].codepoint, |
460 buffer->props.direction, | 462 buffer->props.direction, |
(...skipping 13 matching lines...) Expand all Loading... |
474 hb_position_t kern1 = y_kern >> 1; | 476 hb_position_t kern1 = y_kern >> 1; |
475 hb_position_t kern2 = y_kern - kern1; | 477 hb_position_t kern2 = y_kern - kern1; |
476 pos[idx].y_advance += kern1; | 478 pos[idx].y_advance += kern1; |
477 pos[skippy_iter.idx].y_advance += kern2; | 479 pos[skippy_iter.idx].y_advance += kern2; |
478 pos[skippy_iter.idx].y_offset += kern2; | 480 pos[skippy_iter.idx].y_offset += kern2; |
479 } | 481 } |
480 | 482 |
481 idx = skippy_iter.idx; | 483 idx = skippy_iter.idx; |
482 } | 484 } |
483 } | 485 } |
OLD | NEW |