| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright © 2012,2013 Mozilla Foundation. | 2 * Copyright © 2012,2013 Mozilla Foundation. |
| 3 * Copyright © 2012,2013 Google, Inc. | 3 * Copyright © 2012,2013 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 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 781 FAIL ("CTTypesetterCreateLine failed"); | 781 FAIL ("CTTypesetterCreateLine failed"); |
| 782 } | 782 } |
| 783 | 783 |
| 784 CFArrayRef glyph_runs = CTLineGetGlyphRuns (line); | 784 CFArrayRef glyph_runs = CTLineGetGlyphRuns (line); |
| 785 unsigned int num_runs = CFArrayGetCount (glyph_runs); | 785 unsigned int num_runs = CFArrayGetCount (glyph_runs); |
| 786 DEBUG_MSG (CORETEXT, NULL, "Num runs: %d", num_runs); | 786 DEBUG_MSG (CORETEXT, NULL, "Num runs: %d", num_runs); |
| 787 | 787 |
| 788 buffer->len = 0; | 788 buffer->len = 0; |
| 789 uint32_t status_and = ~0, status_or = 0; | 789 uint32_t status_and = ~0, status_or = 0; |
| 790 double advances_so_far = 0; | 790 double advances_so_far = 0; |
| 791 /* For right-to-left runs, CoreText returns the glyphs positioned such that |
| 792 * any trailing whitespace is to the left of (0,0). Adjust coordinate syste
m |
| 793 * to fix for that. Test with any RTL string with trailing spaces. |
| 794 * https://code.google.com/p/chromium/issues/detail?id=476913 |
| 795 */ |
| 796 if (HB_DIRECTION_IS_BACKWARD (buffer->props.direction)) |
| 797 { |
| 798 advances_so_far -= CTLineGetTrailingWhitespaceWidth (line); |
| 799 if (HB_DIRECTION_IS_VERTICAL (buffer->props.direction)) |
| 800 advances_so_far = -advances_so_far; |
| 801 } |
| 791 | 802 |
| 792 const CFRange range_all = CFRangeMake (0, 0); | 803 const CFRange range_all = CFRangeMake (0, 0); |
| 793 | 804 |
| 794 for (unsigned int i = 0; i < num_runs; i++) | 805 for (unsigned int i = 0; i < num_runs; i++) |
| 795 { | 806 { |
| 796 CTRunRef run = static_cast<CTRunRef>(CFArrayGetValueAtIndex (glyph_runs, i
)); | 807 CTRunRef run = static_cast<CTRunRef>(CFArrayGetValueAtIndex (glyph_runs, i
)); |
| 797 CTRunStatus run_status = CTRunGetStatus (run); | 808 CTRunStatus run_status = CTRunGetStatus (run); |
| 798 status_or |= run_status; | 809 status_or |= run_status; |
| 799 status_and &= run_status; | 810 status_and &= run_status; |
| 800 DEBUG_MSG (CORETEXT, run, "CTRunStatus: %x", run_status); | 811 DEBUG_MSG (CORETEXT, run, "CTRunStatus: %x", run_status); |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1185 | 1196 |
| 1186 hb_bool_t | 1197 hb_bool_t |
| 1187 _hb_coretext_aat_shape (hb_shape_plan_t *shape_plan, | 1198 _hb_coretext_aat_shape (hb_shape_plan_t *shape_plan, |
| 1188 hb_font_t *font, | 1199 hb_font_t *font, |
| 1189 hb_buffer_t *buffer, | 1200 hb_buffer_t *buffer, |
| 1190 const hb_feature_t *features, | 1201 const hb_feature_t *features, |
| 1191 unsigned int num_features) | 1202 unsigned int num_features) |
| 1192 { | 1203 { |
| 1193 return _hb_coretext_shape (shape_plan, font, buffer, features, num_features); | 1204 return _hb_coretext_shape (shape_plan, font, buffer, features, num_features); |
| 1194 } | 1205 } |
| OLD | NEW |