| 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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 } else { | 245 } else { |
| 246 numCharacters = glyphInfo[lastChangePosition - 1].cluster - | 246 numCharacters = glyphInfo[lastChangePosition - 1].cluster - |
| 247 glyphInfo[glyphIndex - 1].cluster; | 247 glyphInfo[glyphIndex - 1].cluster; |
| 248 } | 248 } |
| 249 numGlyphsToInsert = glyphIndex - lastChangePosition; | 249 numGlyphsToInsert = glyphIndex - lastChangePosition; |
| 250 } | 250 } |
| 251 | 251 |
| 252 if (currentClusterResult == Shaped && !isLastResort) { | 252 if (currentClusterResult == Shaped && !isLastResort) { |
| 253 // Now it's clear that we need to continue processing. | 253 // Now it's clear that we need to continue processing. |
| 254 if (!fontCycleQueued) { | 254 if (!fontCycleQueued) { |
| 255 rangeData->holesQueue.append(HolesQueueItem(HolesQueueNextFont, 0, 0)); | 255 rangeData->holesQueue.push_back( |
| 256 HolesQueueItem(HolesQueueNextFont, 0, 0)); |
| 256 fontCycleQueued = true; | 257 fontCycleQueued = true; |
| 257 } | 258 } |
| 258 | 259 |
| 259 // Here we need to put character positions. | 260 // Here we need to put character positions. |
| 260 ASSERT(numCharacters); | 261 ASSERT(numCharacters); |
| 261 rangeData->holesQueue.append( | 262 rangeData->holesQueue.push_back( |
| 262 HolesQueueItem(HolesQueueRange, startIndex, numCharacters)); | 263 HolesQueueItem(HolesQueueRange, startIndex, numCharacters)); |
| 263 } | 264 } |
| 264 | 265 |
| 265 // If numCharacters is 0, that means we hit a NotDef before shaping the | 266 // If numCharacters is 0, that means we hit a NotDef before shaping the |
| 266 // whole grapheme. We do not append it here. For the next glyph we | 267 // whole grapheme. We do not append it here. For the next glyph we |
| 267 // encounter, atChange will be true, and the characters corresponding to | 268 // encounter, atChange will be true, and the characters corresponding to |
| 268 // the grapheme will be added to the TODO queue again, attempting to | 269 // the grapheme will be added to the TODO queue again, attempting to |
| 269 // shape the whole grapheme with the next font. | 270 // shape the whole grapheme with the next font. |
| 270 // When we're getting here with the last resort font, we have no other | 271 // When we're getting here with the last resort font, we have no other |
| 271 // choice than adding boxes to the ShapeResult. | 272 // choice than adding boxes to the ShapeResult. |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 const hb_language_t language = | 563 const hb_language_t language = |
| 563 fontDescription.localeOrDefault().harfbuzzLanguage(); | 564 fontDescription.localeOrDefault().harfbuzzLanguage(); |
| 564 bool needsCapsHandling = | 565 bool needsCapsHandling = |
| 565 fontDescription.variantCaps() != FontDescription::CapsNormal; | 566 fontDescription.variantCaps() != FontDescription::CapsNormal; |
| 566 OpenTypeCapsSupport capsSupport; | 567 OpenTypeCapsSupport capsSupport; |
| 567 | 568 |
| 568 FontOrientation orientation = font->getFontDescription().orientation(); | 569 FontOrientation orientation = font->getFontDescription().orientation(); |
| 569 RefPtr<FontFallbackIterator> fallbackIterator = | 570 RefPtr<FontFallbackIterator> fallbackIterator = |
| 570 font->createFontFallbackIterator(segment.fontFallbackPriority); | 571 font->createFontFallbackIterator(segment.fontFallbackPriority); |
| 571 | 572 |
| 572 rangeData->holesQueue.append(HolesQueueItem(HolesQueueNextFont, 0, 0)); | 573 rangeData->holesQueue.push_back(HolesQueueItem(HolesQueueNextFont, 0, 0)); |
| 573 rangeData->holesQueue.append(HolesQueueItem(HolesQueueRange, segment.start, | 574 rangeData->holesQueue.push_back(HolesQueueItem(HolesQueueRange, segment.start, |
| 574 segment.end - segment.start)); | 575 segment.end - segment.start)); |
| 575 | 576 |
| 576 bool fontCycleQueued = false; | 577 bool fontCycleQueued = false; |
| 577 Vector<UChar32> fallbackCharsHint; | 578 Vector<UChar32> fallbackCharsHint; |
| 578 RefPtr<FontDataForRangeSet> currentFontDataForRangeSet; | 579 RefPtr<FontDataForRangeSet> currentFontDataForRangeSet; |
| 579 while (rangeData->holesQueue.size()) { | 580 while (rangeData->holesQueue.size()) { |
| 580 HolesQueueItem currentQueueItem = rangeData->holesQueue.takeFirst(); | 581 HolesQueueItem currentQueueItem = rangeData->holesQueue.takeFirst(); |
| 581 | 582 |
| 582 if (currentQueueItem.m_action == HolesQueueNextFont) { | 583 if (currentQueueItem.m_action == HolesQueueNextFont) { |
| 583 // For now, we're building a character list with which we probe | 584 // For now, we're building a character list with which we probe |
| 584 // for needed fonts depending on the declared unicode-range of a | 585 // for needed fonts depending on the declared unicode-range of a |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 701 shapeSegment(&rangeData, segmentRange, result.get()); | 702 shapeSegment(&rangeData, segmentRange, result.get()); |
| 702 } | 703 } |
| 703 return result.release(); | 704 return result.release(); |
| 704 } | 705 } |
| 705 | 706 |
| 706 PassRefPtr<ShapeResult> HarfBuzzShaper::shape(const Font* font, | 707 PassRefPtr<ShapeResult> HarfBuzzShaper::shape(const Font* font, |
| 707 TextDirection direction) const { | 708 TextDirection direction) const { |
| 708 return shape(font, direction, 0, m_textLength); | 709 return shape(font, direction, 0, m_textLength); |
| 709 } | 710 } |
| 710 } // namespace blink | 711 } // namespace blink |
| OLD | NEW |