Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: third_party/harfbuzz-ng/src/hb-ot-shape-fallback.cc

Issue 12438036: Update harfbuzz-ng to 0.9.14 from 0.9.10 (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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.
11 * 11 *
12 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 12 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
13 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 13 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
14 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 14 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
15 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 15 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
16 * DAMAGE. 16 * DAMAGE.
17 * 17 *
18 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 18 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
19 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 19 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
20 * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 20 * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
21 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 21 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
22 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 22 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
23 * 23 *
24 * Google Author(s): Behdad Esfahbod 24 * Google Author(s): Behdad Esfahbod
25 */ 25 */
26 26
27 #include "hb-ot-shape-fallback-private.hh" 27 #include "hb-ot-shape-fallback-private.hh"
28 #include "hb-ot-layout-gsubgpos-private.hh"
28 29
29 static unsigned int 30 static unsigned int
30 recategorize_combining_class (hb_codepoint_t u, 31 recategorize_combining_class (hb_codepoint_t u,
31 unsigned int klass) 32 unsigned int klass)
32 { 33 {
33 if (klass >= 200) 34 if (klass >= 200)
34 return klass; 35 return klass;
35 36
36 /* Thai / Lao need some per-character work. */ 37 /* Thai / Lao need some per-character work. */
37 if ((u & ~0xFF) == 0x0E00) 38 if ((u & ~0xFF) == 0x0E00)
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 unsigned int last_cluster = buffer->info[0].cluster; 401 unsigned int last_cluster = buffer->info[0].cluster;
401 unsigned int count = buffer->len; 402 unsigned int count = buffer->len;
402 for (unsigned int i = 1; i < count; i++) 403 for (unsigned int i = 1; i < count; i++)
403 if (buffer->info[i].cluster != last_cluster) { 404 if (buffer->info[i].cluster != last_cluster) {
404 position_cluster (plan, font, buffer, start, i); 405 position_cluster (plan, font, buffer, start, i);
405 start = i; 406 start = i;
406 last_cluster = buffer->info[i].cluster; 407 last_cluster = buffer->info[i].cluster;
407 } 408 }
408 position_cluster (plan, font, buffer, start, count); 409 position_cluster (plan, font, buffer, start, count);
409 } 410 }
411
412
413 /* Performs old-style TrueType kerning. */
414 void
415 _hb_ot_shape_fallback_kern (const hb_ot_shape_plan_t *plan,
416 hb_font_t *font,
417 hb_buffer_t *buffer)
418 {
419 unsigned int count = buffer->len;
420 hb_mask_t kern_mask = plan->map.get_1_mask (HB_DIRECTION_IS_HORIZONTAL (buffer ->props.direction) ?
421 HB_TAG ('k','e','r','n') : HB_TAG ('v','k','r','n'));
422
423 OT::hb_apply_context_t c (1, font, buffer, kern_mask, true/*auto_zwj*/);
424 c.set_lookup_props (OT::LookupFlag::IgnoreMarks);
425
426 for (buffer->idx = 0; buffer->idx < count;)
427 {
428 OT::hb_apply_context_t::skipping_forward_iterator_t skippy_iter (&c, buffer- >idx, 1);
429 if (!skippy_iter.next ())
430 {
431 buffer->idx++;
432 continue;
433 }
434
435 hb_position_t x_kern, y_kern, kern1, kern2;
436 font->get_glyph_kerning_for_direction (buffer->info[buffer->idx].codepoint,
437 buffer->info[skippy_iter.idx].codepoi nt,
438 buffer->props.direction,
439 &x_kern, &y_kern);
440
441 kern1 = x_kern >> 1;
442 kern2 = x_kern - kern1;
443 buffer->pos[buffer->idx].x_advance += kern1;
444 buffer->pos[skippy_iter.idx].x_advance += kern2;
445 buffer->pos[skippy_iter.idx].x_offset += kern2;
446
447 kern1 = y_kern >> 1;
448 kern2 = y_kern - kern1;
449 buffer->pos[buffer->idx].y_advance += kern1;
450 buffer->pos[skippy_iter.idx].y_advance += kern2;
451 buffer->pos[skippy_iter.idx].y_offset += kern2;
452
453 buffer->idx = skippy_iter.idx;
454 }
455 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698