| 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 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 position_cluster (plan, font, buffer, start, count); | 423 position_cluster (plan, font, buffer, start, count); |
| 424 } | 424 } |
| 425 | 425 |
| 426 | 426 |
| 427 /* Performs old-style TrueType kerning. */ | 427 /* Performs old-style TrueType kerning. */ |
| 428 void | 428 void |
| 429 _hb_ot_shape_fallback_kern (const hb_ot_shape_plan_t *plan, | 429 _hb_ot_shape_fallback_kern (const hb_ot_shape_plan_t *plan, |
| 430 hb_font_t *font, | 430 hb_font_t *font, |
| 431 hb_buffer_t *buffer) | 431 hb_buffer_t *buffer) |
| 432 { | 432 { |
| 433 hb_mask_t kern_mask = plan->map.get_1_mask (HB_DIRECTION_IS_HORIZONTAL (buffer
->props.direction) ? | 433 if (!plan->has_kern) return; |
| 434 » » » » » HB_TAG ('k','e','r','n') : HB_TAG
('v','k','r','n')); | |
| 435 if (!kern_mask) return; | |
| 436 | 434 |
| 437 unsigned int count = buffer->len; | 435 unsigned int count = buffer->len; |
| 438 | 436 |
| 439 OT::hb_apply_context_t c (1, font, buffer); | 437 OT::hb_apply_context_t c (1, font, buffer); |
| 440 c.set_lookup_mask (kern_mask); | 438 c.set_lookup_mask (plan->kern_mask); |
| 441 c.set_lookup_props (OT::LookupFlag::IgnoreMarks); | 439 c.set_lookup_props (OT::LookupFlag::IgnoreMarks); |
| 442 | 440 |
| 443 hb_glyph_info_t *info = buffer->info; | 441 hb_glyph_info_t *info = buffer->info; |
| 444 hb_glyph_position_t *pos = buffer->pos; | 442 hb_glyph_position_t *pos = buffer->pos; |
| 445 | 443 |
| 446 for (unsigned int idx = 0; idx < count;) | 444 for (unsigned int idx = 0; idx < count;) |
| 447 { | 445 { |
| 448 OT::hb_apply_context_t::skipping_forward_iterator_t skippy_iter (&c, idx, 1)
; | 446 OT::hb_apply_context_t::skipping_forward_iterator_t skippy_iter (&c, idx, 1)
; |
| 449 if (!skippy_iter.next ()) | 447 if (!skippy_iter.next ()) |
| 450 { | 448 { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 472 hb_position_t kern1 = y_kern >> 1; | 470 hb_position_t kern1 = y_kern >> 1; |
| 473 hb_position_t kern2 = y_kern - kern1; | 471 hb_position_t kern2 = y_kern - kern1; |
| 474 pos[idx].y_advance += kern1; | 472 pos[idx].y_advance += kern1; |
| 475 pos[skippy_iter.idx].y_advance += kern2; | 473 pos[skippy_iter.idx].y_advance += kern2; |
| 476 pos[skippy_iter.idx].y_offset += kern2; | 474 pos[skippy_iter.idx].y_offset += kern2; |
| 477 } | 475 } |
| 478 | 476 |
| 479 idx = skippy_iter.idx; | 477 idx = skippy_iter.idx; |
| 480 } | 478 } |
| 481 } | 479 } |
| OLD | NEW |