| Index: sky/engine/platform/fonts/harfbuzz/HarfBuzzShaper.cpp
|
| diff --git a/sky/engine/platform/fonts/harfbuzz/HarfBuzzShaper.cpp b/sky/engine/platform/fonts/harfbuzz/HarfBuzzShaper.cpp
|
| index 34fc737235e5218eb7a5f5a7d550f93a25a8068e..1a3da207aef2a10fcb47a5b98a8825c5bf4523a1 100644
|
| --- a/sky/engine/platform/fonts/harfbuzz/HarfBuzzShaper.cpp
|
| +++ b/sky/engine/platform/fonts/harfbuzz/HarfBuzzShaper.cpp
|
| @@ -278,7 +278,7 @@ inline void HarfBuzzShaper::HarfBuzzRun::setGlyphAndPositions(unsigned index, ui
|
| {
|
| m_glyphs[index] = glyphId;
|
| m_advances[index] = advance;
|
| - m_offsets[index] = FloatPoint(offsetX, offsetY);
|
| + m_offsets[index] = FloatSize(offsetX, offsetY);
|
| }
|
|
|
| int HarfBuzzShaper::HarfBuzzRun::characterIndexForXPosition(float targetX)
|
| @@ -571,11 +571,6 @@ bool HarfBuzzShaper::shape(GlyphBuffer* glyphBuffer)
|
| return true;
|
| }
|
|
|
| -FloatPoint HarfBuzzShaper::adjustStartPoint(const FloatPoint& point)
|
| -{
|
| - return point + m_startOffset;
|
| -}
|
| -
|
| static inline int handleMultipleUChar(
|
| UChar32 character,
|
| unsigned clusterLength,
|
| @@ -950,29 +945,35 @@ void HarfBuzzShaper::setGlyphPositionsForHarfBuzzRun(HarfBuzzRun* currentRun, hb
|
| m_totalWidth += currentRun->width();
|
| }
|
|
|
| -void HarfBuzzShaper::fillGlyphBufferFromHarfBuzzRun(GlyphBuffer* glyphBuffer, HarfBuzzRun* currentRun, FloatPoint& firstOffsetOfNextRun)
|
| +void HarfBuzzShaper::fillGlyphBufferFromHarfBuzzRun(GlyphBuffer* glyphBuffer, HarfBuzzRun* currentRun, float& carryAdvance)
|
| {
|
| - FloatPoint* offsets = currentRun->offsets();
|
| + FloatSize* offsets = currentRun->offsets();
|
| uint16_t* glyphs = currentRun->glyphs();
|
| float* advances = currentRun->advances();
|
| unsigned numGlyphs = currentRun->numGlyphs();
|
| uint16_t* glyphToCharacterIndexes = currentRun->glyphToCharacterIndexes();
|
| - for (unsigned i = 0; i < numGlyphs; ++i) {
|
| - uint16_t currentCharacterIndex = currentRun->startIndex() + glyphToCharacterIndexes[i];
|
| - FloatPoint& currentOffset = offsets[i];
|
| - FloatPoint& nextOffset = (i == numGlyphs - 1) ? firstOffsetOfNextRun : offsets[i + 1];
|
| - float glyphAdvanceX = advances[i] + nextOffset.x() - currentOffset.x();
|
| - float glyphAdvanceY = nextOffset.y() - currentOffset.y();
|
| - if (m_run.rtl()) {
|
| - if (currentCharacterIndex >= m_toIndex)
|
| - m_startOffset.move(glyphAdvanceX, glyphAdvanceY);
|
| - else if (currentCharacterIndex >= m_fromIndex)
|
| - glyphBuffer->add(glyphs[i], currentRun->fontData(), FloatSize(glyphAdvanceX, glyphAdvanceY));
|
| - } else {
|
| - if (currentCharacterIndex < m_fromIndex)
|
| - m_startOffset.move(glyphAdvanceX, glyphAdvanceY);
|
| - else if (currentCharacterIndex < m_toIndex)
|
| - glyphBuffer->add(glyphs[i], currentRun->fontData(), FloatSize(glyphAdvanceX, glyphAdvanceY));
|
| + FloatSize runStartOffset = FloatSize();
|
| + if (m_run.rtl()) {
|
| + for (unsigned i = 0; i < numGlyphs; ++i) {
|
| + uint16_t currentCharacterIndex = currentRun->startIndex() + glyphToCharacterIndexes[i];
|
| + if (currentCharacterIndex >= m_toIndex) {
|
| + carryAdvance += advances[i];
|
| + } else if (currentCharacterIndex >= m_fromIndex) {
|
| + runStartOffset = HB_DIRECTION_IS_HORIZONTAL(currentRun->direction()) ? FloatSize(carryAdvance, 0) : FloatSize(0, carryAdvance);
|
| + glyphBuffer->add(glyphs[i], currentRun->fontData(), runStartOffset + offsets[i], carryAdvance + advances[i]);
|
| + carryAdvance = 0;
|
| + }
|
| + }
|
| + } else {
|
| + for (unsigned i = 0; i < numGlyphs; ++i) {
|
| + uint16_t currentCharacterIndex = currentRun->startIndex() + glyphToCharacterIndexes[i];
|
| + if (currentCharacterIndex < m_fromIndex) {
|
| + carryAdvance += advances[i];
|
| + } else if (currentCharacterIndex < m_toIndex) {
|
| + runStartOffset = HB_DIRECTION_IS_HORIZONTAL(currentRun->direction()) ? FloatSize(carryAdvance, 0) : FloatSize(0, carryAdvance);
|
| + glyphBuffer->add(glyphs[i], currentRun->fontData(), runStartOffset + offsets[i], carryAdvance + advances[i]);
|
| + carryAdvance = 0;
|
| + }
|
| }
|
| }
|
| }
|
| @@ -1034,33 +1035,30 @@ void HarfBuzzShaper::fillGlyphBufferForTextEmphasis(GlyphBuffer* glyphBuffer, Ha
|
| bool HarfBuzzShaper::fillGlyphBuffer(GlyphBuffer* glyphBuffer)
|
| {
|
| unsigned numRuns = m_harfBuzzRuns.size();
|
| + float carryAdvance = 0;
|
| if (m_run.rtl()) {
|
| - m_startOffset = m_harfBuzzRuns.last()->offsets()[0];
|
| for (int runIndex = numRuns - 1; runIndex >= 0; --runIndex) {
|
| HarfBuzzRun* currentRun = m_harfBuzzRuns[runIndex].get();
|
| if (!currentRun->hasGlyphToCharacterIndexes()) {
|
| // FIXME: bug 337886, 359664
|
| continue;
|
| }
|
| - FloatPoint firstOffsetOfNextRun = !runIndex ? FloatPoint() : m_harfBuzzRuns[runIndex - 1]->offsets()[0];
|
| if (m_forTextEmphasis == ForTextEmphasis)
|
| fillGlyphBufferForTextEmphasis(glyphBuffer, currentRun);
|
| else
|
| - fillGlyphBufferFromHarfBuzzRun(glyphBuffer, currentRun, firstOffsetOfNextRun);
|
| + fillGlyphBufferFromHarfBuzzRun(glyphBuffer, currentRun, carryAdvance);
|
| }
|
| } else {
|
| - m_startOffset = m_harfBuzzRuns.first()->offsets()[0];
|
| for (unsigned runIndex = 0; runIndex < numRuns; ++runIndex) {
|
| HarfBuzzRun* currentRun = m_harfBuzzRuns[runIndex].get();
|
| if (!currentRun->hasGlyphToCharacterIndexes()) {
|
| // FIXME: bug 337886, 359664
|
| continue;
|
| }
|
| - FloatPoint firstOffsetOfNextRun = runIndex == numRuns - 1 ? FloatPoint() : m_harfBuzzRuns[runIndex + 1]->offsets()[0];
|
| if (m_forTextEmphasis == ForTextEmphasis)
|
| fillGlyphBufferForTextEmphasis(glyphBuffer, currentRun);
|
| else
|
| - fillGlyphBufferFromHarfBuzzRun(glyphBuffer, currentRun, firstOffsetOfNextRun);
|
| + fillGlyphBufferFromHarfBuzzRun(glyphBuffer, currentRun, carryAdvance);
|
| }
|
| }
|
| return glyphBuffer->size();
|
|
|