OLD | NEW |
1 /* | 1 /* |
2 * Copyright © 2010,2012 Google, Inc. | 2 * Copyright © 2010,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 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 /* Number of additional times to repeat each repeating tile. */ | 533 /* Number of additional times to repeat each repeating tile. */ |
534 int n_copies = 0; | 534 int n_copies = 0; |
535 | 535 |
536 hb_position_t w_remaining = w_total - w_fixed; | 536 hb_position_t w_remaining = w_total - w_fixed; |
537 if (sign * w_remaining > sign * w_repeating && sign * w_repeating > 0) | 537 if (sign * w_remaining > sign * w_repeating && sign * w_repeating > 0) |
538 n_copies = (sign * w_remaining) / (sign * w_repeating) - 1; | 538 n_copies = (sign * w_remaining) / (sign * w_repeating) - 1; |
539 | 539 |
540 /* See if we can improve the fit by adding an extra repeat and squeezing t
hem together a bit. */ | 540 /* See if we can improve the fit by adding an extra repeat and squeezing t
hem together a bit. */ |
541 hb_position_t extra_repeat_overlap = 0; | 541 hb_position_t extra_repeat_overlap = 0; |
542 hb_position_t shortfall = sign * w_remaining - sign * w_repeating * (n_cop
ies + 1); | 542 hb_position_t shortfall = sign * w_remaining - sign * w_repeating * (n_cop
ies + 1); |
543 if (shortfall > 0) | 543 if (shortfall > 0 && n_repeating > 0) |
544 { | 544 { |
545 ++n_copies; | 545 ++n_copies; |
546 hb_position_t excess = (n_copies + 1) * sign * w_repeating - sign * w_re
maining; | 546 hb_position_t excess = (n_copies + 1) * sign * w_repeating - sign * w_re
maining; |
547 if (excess > 0) | 547 if (excess > 0) |
548 extra_repeat_overlap = excess / (n_copies * n_repeating); | 548 extra_repeat_overlap = excess / (n_copies * n_repeating); |
549 } | 549 } |
550 | 550 |
551 if (step == MEASURE) | 551 if (step == MEASURE) |
552 { | 552 { |
553 extra_glyphs_needed += n_copies * n_repeating; | 553 extra_glyphs_needed += n_copies * n_repeating; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 NULL, /* preprocess_text */ | 615 NULL, /* preprocess_text */ |
616 postprocess_glyphs_arabic, | 616 postprocess_glyphs_arabic, |
617 HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT, | 617 HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT, |
618 NULL, /* decompose */ | 618 NULL, /* decompose */ |
619 NULL, /* compose */ | 619 NULL, /* compose */ |
620 setup_masks_arabic, | 620 setup_masks_arabic, |
621 NULL, /* disable_otl */ | 621 NULL, /* disable_otl */ |
622 HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE, | 622 HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE, |
623 true, /* fallback_position */ | 623 true, /* fallback_position */ |
624 }; | 624 }; |
OLD | NEW |