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

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

Issue 16053004: Update harfbuzz-ng to 0.9.17 (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 6 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 © 2009,2010 Red Hat, Inc. 2 * Copyright © 2009,2010 Red Hat, Inc.
3 * Copyright © 2010,2011,2012 Google, Inc. 3 * Copyright © 2010,2011,2012 Google, Inc.
4 * 4 *
5 * This is part of HarfBuzz, a text shaping library. 5 * This is part of HarfBuzz, a text shaping library.
6 * 6 *
7 * Permission is hereby granted, without written agreement and without 7 * Permission is hereby granted, without written agreement and without
8 * license or royalty fees, to use, copy, modify, and distribute this 8 * license or royalty fees, to use, copy, modify, and distribute this
9 * software and its documentation for any purpose, provided that the 9 * software and its documentation for any purpose, provided that the
10 * above copyright notice and the following two paragraphs appear in 10 * above copyright notice and the following two paragraphs appear in
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 static inline void 394 static inline void
395 hb_ot_substitute (hb_ot_shape_context_t *c) 395 hb_ot_substitute (hb_ot_shape_context_t *c)
396 { 396 {
397 hb_ot_substitute_default (c); 397 hb_ot_substitute_default (c);
398 hb_ot_substitute_complex (c); 398 hb_ot_substitute_complex (c);
399 } 399 }
400 400
401 /* Position */ 401 /* Position */
402 402
403 static inline void 403 static inline void
404 zero_mark_widths_by_unicode (hb_buffer_t *buffer)
405 {
406 unsigned int count = buffer->len;
407 for (unsigned int i = 0; i < count; i++)
408 if (_hb_glyph_info_get_general_category (&buffer->info[i]) == HB_UNICODE_GEN ERAL_CATEGORY_NON_SPACING_MARK)
409 {
410 buffer->pos[i].x_advance = 0;
411 buffer->pos[i].y_advance = 0;
412 }
413 }
414
415 static inline void
416 zero_mark_widths_by_gdef (hb_buffer_t *buffer)
417 {
418 unsigned int count = buffer->len;
419 for (unsigned int i = 0; i < count; i++)
420 if ((buffer->info[i].glyph_props() & HB_OT_LAYOUT_GLYPH_PROPS_MARK))
421 {
422 buffer->pos[i].x_advance = 0;
423 buffer->pos[i].y_advance = 0;
424 }
425 }
426
427 static inline void
404 hb_ot_position_default (hb_ot_shape_context_t *c) 428 hb_ot_position_default (hb_ot_shape_context_t *c)
405 { 429 {
406 hb_ot_layout_position_start (c->font, c->buffer); 430 hb_ot_layout_position_start (c->font, c->buffer);
407 431
408 unsigned int count = c->buffer->len; 432 unsigned int count = c->buffer->len;
409 for (unsigned int i = 0; i < count; i++) 433 for (unsigned int i = 0; i < count; i++)
410 { 434 {
411 c->font->get_glyph_advance_for_direction (c->buffer->info[i].codepoint, 435 c->font->get_glyph_advance_for_direction (c->buffer->info[i].codepoint,
412 c->buffer->props.direction, 436 c->buffer->props.direction,
413 &c->buffer->pos[i].x_advance, 437 &c->buffer->pos[i].x_advance,
414 &c->buffer->pos[i].y_advance); 438 &c->buffer->pos[i].y_advance);
415 c->font->subtract_glyph_origin_for_direction (c->buffer->info[i].codepoint, 439 c->font->subtract_glyph_origin_for_direction (c->buffer->info[i].codepoint,
416 c->buffer->props.direction, 440 c->buffer->props.direction,
417 &c->buffer->pos[i].x_offset, 441 &c->buffer->pos[i].x_offset,
418 &c->buffer->pos[i].y_offset); 442 &c->buffer->pos[i].y_offset);
419 443
420 } 444 }
421 445
422 /* Zero'ing mark widths by GDEF (as used in Myanmar spec) happens
423 * *before* GPOS. */
424 switch (c->plan->shaper->zero_width_marks) 446 switch (c->plan->shaper->zero_width_marks)
425 { 447 {
426 case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF: 448 case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_EARLY:
427 for (unsigned int i = 0; i < count; i++) 449 zero_mark_widths_by_gdef (c->buffer);
428 » if ((c->buffer->info[i].glyph_props() & HB_OT_LAYOUT_GLYPH_PROPS_MARK))
429 » {
430 » c->buffer->pos[i].x_advance = 0;
431 » c->buffer->pos[i].y_advance = 0;
432 » }
433 break; 450 break;
434 451
452 /* Not currently used for any shaper:
453 case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_UNICODE_EARLY:
454 zero_mark_widths_by_unicode (c->buffer);
455 break;
456 */
457
435 default: 458 default:
436 case HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE: 459 case HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE:
437 case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_UNICODE: 460 case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_UNICODE_LATE:
461 case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE:
438 break; 462 break;
439 } 463 }
440 } 464 }
441 465
442 static inline bool 466 static inline bool
443 hb_ot_position_complex (hb_ot_shape_context_t *c) 467 hb_ot_position_complex (hb_ot_shape_context_t *c)
444 { 468 {
445 bool ret = false; 469 bool ret = false;
446 unsigned int count = c->buffer->len; 470 unsigned int count = c->buffer->len;
447 471
(...skipping 13 matching lines...) Expand all
461 for (unsigned int i = 0; i < count; i++) { 485 for (unsigned int i = 0; i < count; i++) {
462 c->font->subtract_glyph_origin_for_direction (c->buffer->info[i].codepoint , 486 c->font->subtract_glyph_origin_for_direction (c->buffer->info[i].codepoint ,
463 HB_DIRECTION_LTR, 487 HB_DIRECTION_LTR,
464 &c->buffer->pos[i].x_offset, 488 &c->buffer->pos[i].x_offset,
465 &c->buffer->pos[i].y_offset) ; 489 &c->buffer->pos[i].y_offset) ;
466 } 490 }
467 491
468 ret = true; 492 ret = true;
469 } 493 }
470 494
471 /* Zero'ing mark widths by Unicode happens
472 * *after* GPOS. */
473 switch (c->plan->shaper->zero_width_marks) 495 switch (c->plan->shaper->zero_width_marks)
474 { 496 {
475 case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_UNICODE: 497 case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_UNICODE_LATE:
476 for (unsigned int i = 0; i < count; i++) 498 zero_mark_widths_by_unicode (c->buffer);
477 » if (_hb_glyph_info_get_general_category (&c->buffer->info[i]) == HB_UNIC ODE_GENERAL_CATEGORY_NON_SPACING_MARK) 499 break;
478 » { 500
479 » c->buffer->pos[i].x_advance = 0; 501 case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE:
480 » c->buffer->pos[i].y_advance = 0; 502 zero_mark_widths_by_gdef (c->buffer);
481 » }
482 break; 503 break;
483 504
484 default: 505 default:
485 case HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE: 506 case HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE:
486 case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF: 507 //case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_UNICODE_EARLY:
508 case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_EARLY:
487 break; 509 break;
488 } 510 }
489 511
490 hb_ot_layout_position_finish (c->font, c->buffer); 512 hb_ot_layout_position_finish (c->font, c->buffer);
491 513
492 return ret; 514 return ret;
493 } 515 }
494 516
495 static inline void 517 static inline void
496 hb_ot_position (hb_ot_shape_context_t *c) 518 hb_ot_position (hb_ot_shape_context_t *c)
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 hb_set_t copy; 667 hb_set_t copy;
646 copy.init (); 668 copy.init ();
647 do { 669 do {
648 copy.set (glyphs); 670 copy.set (glyphs);
649 for (hb_codepoint_t lookup_index = -1; hb_set_next (&lookups, &lookup_index) ;) 671 for (hb_codepoint_t lookup_index = -1; hb_set_next (&lookups, &lookup_index) ;)
650 hb_ot_layout_lookup_substitute_closure (font->face, lookup_index, glyphs); 672 hb_ot_layout_lookup_substitute_closure (font->face, lookup_index, glyphs);
651 } while (!copy.is_equal (glyphs)); 673 } while (!copy.is_equal (glyphs));
652 674
653 hb_shape_plan_destroy (shape_plan); 675 hb_shape_plan_destroy (shape_plan);
654 } 676 }
OLDNEW
« no previous file with comments | « third_party/harfbuzz-ng/src/hb-ot-map-private.hh ('k') | third_party/harfbuzz-ng/src/hb-ot-shape-complex-arabic.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698