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 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 } | 551 } |
552 } | 552 } |
553 | 553 |
554 PassRefPtr<ShapeResult> HarfBuzzShaper::shapeResult() | 554 PassRefPtr<ShapeResult> HarfBuzzShaper::shapeResult() |
555 { | 555 { |
556 RefPtr<ShapeResult> result = ShapeResult::create(m_font, | 556 RefPtr<ShapeResult> result = ShapeResult::create(m_font, |
557 m_normalizedBufferLength, m_textRun.direction()); | 557 m_normalizedBufferLength, m_textRun.direction()); |
558 HarfBuzzScopedPtr<hb_buffer_t> harfBuzzBuffer(hb_buffer_create(), hb_buffer_
destroy); | 558 HarfBuzzScopedPtr<hb_buffer_t> harfBuzzBuffer(hb_buffer_create(), hb_buffer_
destroy); |
559 | 559 |
560 const FontDescription& fontDescription = m_font->getFontDescription(); | 560 const FontDescription& fontDescription = m_font->getFontDescription(); |
561 const String& localeString = fontDescription.locale(); | 561 const hb_language_t language = fontDescription.localeOrDefault().harfbuzzLan
guage(); |
562 CString locale = localeString.latin1(); | |
563 const hb_language_t language = hb_language_from_string(locale.data(), locale
.length()); | |
564 | 562 |
565 bool needsCapsHandling = fontDescription.variantCaps() != FontDescription::C
apsNormal; | 563 bool needsCapsHandling = fontDescription.variantCaps() != FontDescription::C
apsNormal; |
566 OpenTypeCapsSupport capsSupport; | 564 OpenTypeCapsSupport capsSupport; |
567 | 565 |
568 RunSegmenter::RunSegmenterRange segmentRange = { | 566 RunSegmenter::RunSegmenterRange segmentRange = { |
569 0, | 567 0, |
570 0, | 568 0, |
571 USCRIPT_INVALID_CODE, | 569 USCRIPT_INVALID_CODE, |
572 OrientationIterator::OrientationInvalid, | 570 OrientationIterator::OrientationInvalid, |
573 FontFallbackPriority::Invalid }; | 571 FontFallbackPriority::Invalid }; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
642 m_font->getFontDescription().orientation(), | 640 m_font->getFontDescription().orientation(), |
643 segmentRange.renderOrientation); | 641 segmentRange.renderOrientation); |
644 | 642 |
645 CaseMapIntend caseMapIntend = CaseMapIntend::KeepSameCase; | 643 CaseMapIntend caseMapIntend = CaseMapIntend::KeepSameCase; |
646 if (needsCapsHandling) { | 644 if (needsCapsHandling) { |
647 caseMapIntend = capsSupport.needsCaseChange(smallCapsBehavior); | 645 caseMapIntend = capsSupport.needsCaseChange(smallCapsBehavior); |
648 } | 646 } |
649 | 647 |
650 CaseMappingHarfBuzzBufferFiller( | 648 CaseMappingHarfBuzzBufferFiller( |
651 caseMapIntend, | 649 caseMapIntend, |
652 fontDescription.locale(), | 650 fontDescription.localeOrDefault(), |
653 harfBuzzBuffer.get(), | 651 harfBuzzBuffer.get(), |
654 m_normalizedBuffer.get(), | 652 m_normalizedBuffer.get(), |
655 m_normalizedBufferLength, | 653 m_normalizedBufferLength, |
656 currentQueueItem.m_startIndex, | 654 currentQueueItem.m_startIndex, |
657 currentQueueItem.m_numCharacters); | 655 currentQueueItem.m_numCharacters); |
658 | 656 |
659 CapsFeatureSettingsScopedOverlay capsOverlay(m_features, capsSupport
.fontFeatureToUse(smallCapsBehavior)); | 657 CapsFeatureSettingsScopedOverlay capsOverlay(m_features, capsSupport
.fontFeatureToUse(smallCapsBehavior)); |
660 | 658 |
661 if (!shapeRange(harfBuzzBuffer.get(), | 659 if (!shapeRange(harfBuzzBuffer.get(), |
662 currentQueueItem.m_startIndex, | 660 currentQueueItem.m_startIndex, |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
704 result->m_width = run->m_width; | 702 result->m_width = run->m_width; |
705 result->m_numGlyphs = count; | 703 result->m_numGlyphs = count; |
706 ASSERT(result->m_numGlyphs == count); // no overflow | 704 ASSERT(result->m_numGlyphs == count); // no overflow |
707 result->m_hasVerticalOffsets = fontData->platformData().isVerticalAnyUpright
(); | 705 result->m_hasVerticalOffsets = fontData->platformData().isVerticalAnyUpright
(); |
708 result->m_runs.append(std::move(run)); | 706 result->m_runs.append(std::move(run)); |
709 return result.release(); | 707 return result.release(); |
710 } | 708 } |
711 | 709 |
712 | 710 |
713 } // namespace blink | 711 } // namespace blink |
OLD | NEW |