OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 Google Inc. All rights reserved. | 2 * Copyright (c) 2012 Google Inc. All rights reserved. |
3 * Copyright (C) 2013 BlackBerry Limited. All rights reserved. | 3 * Copyright (C) 2013 BlackBerry Limited. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 segment.renderOrientation); | 630 segment.renderOrientation); |
631 | 631 |
632 CaseMapIntend caseMapIntend = CaseMapIntend::KeepSameCase; | 632 CaseMapIntend caseMapIntend = CaseMapIntend::KeepSameCase; |
633 if (needsCapsHandling) | 633 if (needsCapsHandling) |
634 caseMapIntend = capsSupport.needsCaseChange(smallCapsBehavior); | 634 caseMapIntend = capsSupport.needsCaseChange(smallCapsBehavior); |
635 | 635 |
636 // Clamp the start and end offsets of the queue item to the offsets | 636 // Clamp the start and end offsets of the queue item to the offsets |
637 // representing the shaping window. | 637 // representing the shaping window. |
638 unsigned shapeStart = | 638 unsigned shapeStart = |
639 std::max(rangeData->start, currentQueueItem.m_startIndex); | 639 std::max(rangeData->start, currentQueueItem.m_startIndex); |
640 unsigned shapeEnd = | 640 unsigned shapeEnd = std::min( |
641 std::min(rangeData->end, currentQueueItem.m_startIndex + | 641 rangeData->end, |
642 currentQueueItem.m_numCharacters); | 642 currentQueueItem.m_startIndex + currentQueueItem.m_numCharacters); |
643 | 643 |
644 CaseMappingHarfBuzzBufferFiller( | 644 CaseMappingHarfBuzzBufferFiller( |
645 caseMapIntend, fontDescription.localeOrDefault(), rangeData->buffer, | 645 caseMapIntend, fontDescription.localeOrDefault(), rangeData->buffer, |
646 m_text, m_textLength, shapeStart, shapeEnd - shapeStart); | 646 m_text, m_textLength, shapeStart, shapeEnd - shapeStart); |
647 | 647 |
648 CapsFeatureSettingsScopedOverlay capsOverlay( | 648 CapsFeatureSettingsScopedOverlay capsOverlay( |
649 &rangeData->fontFeatures, | 649 &rangeData->fontFeatures, |
650 capsSupport.fontFeatureToUse(smallCapsBehavior)); | 650 capsSupport.fontFeatureToUse(smallCapsBehavior)); |
651 hb_direction_t direction = | 651 hb_direction_t direction = |
652 rangeData->harfBuzzDirection(directionAndSmallCapsAdjustedFont); | 652 rangeData->harfBuzzDirection(directionAndSmallCapsAdjustedFont); |
653 | 653 |
654 if (!shapeRange(rangeData->buffer, rangeData->fontFeatures.isEmpty() | 654 if (!shapeRange( |
655 ? 0 | 655 rangeData->buffer, |
656 : rangeData->fontFeatures.data(), | 656 rangeData->fontFeatures.isEmpty() ? 0 |
657 rangeData->fontFeatures.size(), | 657 : rangeData->fontFeatures.data(), |
658 directionAndSmallCapsAdjustedFont, | 658 rangeData->fontFeatures.size(), directionAndSmallCapsAdjustedFont, |
659 currentFontDataForRangeSet->ranges(), segment.script, | 659 currentFontDataForRangeSet->ranges(), segment.script, direction, |
660 direction, language)) | 660 language)) |
661 DLOG(ERROR) << "Shaping range failed."; | 661 DLOG(ERROR) << "Shaping range failed."; |
662 | 662 |
663 if (!extractShapeResults(rangeData, fontCycleQueued, currentQueueItem, | 663 if (!extractShapeResults(rangeData, fontCycleQueued, currentQueueItem, |
664 directionAndSmallCapsAdjustedFont, segment.script, | 664 directionAndSmallCapsAdjustedFont, segment.script, |
665 !fallbackIterator->hasNext(), result)) | 665 !fallbackIterator->hasNext(), result)) |
666 DLOG(ERROR) << "Shape result extraction failed."; | 666 DLOG(ERROR) << "Shape result extraction failed."; |
667 | 667 |
668 hb_buffer_reset(rangeData->buffer); | 668 hb_buffer_reset(rangeData->buffer); |
669 } | 669 } |
670 } | 670 } |
(...skipping 30 matching lines...) Expand all Loading... |
701 shapeSegment(&rangeData, segmentRange, result.get()); | 701 shapeSegment(&rangeData, segmentRange, result.get()); |
702 } | 702 } |
703 return result.release(); | 703 return result.release(); |
704 } | 704 } |
705 | 705 |
706 PassRefPtr<ShapeResult> HarfBuzzShaper::shape(const Font* font, | 706 PassRefPtr<ShapeResult> HarfBuzzShaper::shape(const Font* font, |
707 TextDirection direction) const { | 707 TextDirection direction) const { |
708 return shape(font, direction, 0, m_textLength); | 708 return shape(font, direction, 0, m_textLength); |
709 } | 709 } |
710 } // namespace blink | 710 } // namespace blink |
OLD | NEW |