Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Unified Diff: Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzShaper.cpp

Issue 11293219: Merge 133983 - [Chromium] Arabic digits should appear left-to-right (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1312/
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzShaper.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzShaper.cpp
===================================================================
--- Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzShaper.cpp (revision 134171)
+++ Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzShaper.cpp (working copy)
@@ -72,11 +72,12 @@
return static_cast<float>(value) / (1 << 16);
}
-HarfBuzzShaper::HarfBuzzRun::HarfBuzzRun(const SimpleFontData* fontData, unsigned startIndex, unsigned numCharacters, TextDirection direction)
+HarfBuzzShaper::HarfBuzzRun::HarfBuzzRun(const SimpleFontData* fontData, unsigned startIndex, unsigned numCharacters, TextDirection direction, hb_script_t script)
: m_fontData(fontData)
, m_startIndex(startIndex)
, m_numCharacters(numCharacters)
, m_direction(direction)
+ , m_script(script)
{
}
@@ -230,7 +231,9 @@
return false;
m_totalWidth = 0;
- if (!shapeHarfBuzzRuns())
+ // WebKit doesn't set direction when calulating widths. Leave the direction setting to
+ // HarfBuzz when we are calculating widths (except when directionalOverride() is set).
+ if (!shapeHarfBuzzRuns(glyphBuffer || m_run.directionalOverride()))
return false;
m_totalWidth = roundf(m_totalWidth);
@@ -301,7 +304,8 @@
currentCharacterPosition = iterator.characters();
}
unsigned numCharactersOfCurrentRun = iterator.currentCharacter() - startIndexOfCurrentRun;
- m_harfbuzzRuns.append(HarfBuzzRun::create(currentFontData, startIndexOfCurrentRun, numCharactersOfCurrentRun, m_run.direction()));
+ hb_script_t script = hb_icu_script_to_script(currentScript);
+ m_harfbuzzRuns.append(HarfBuzzRun::create(currentFontData, startIndexOfCurrentRun, numCharactersOfCurrentRun, m_run.direction(), script));
currentFontData = nextFontData;
startIndexOfCurrentRun = iterator.currentCharacter();
} while (iterator.consume(character, clusterLength));
@@ -309,19 +313,21 @@
return !m_harfbuzzRuns.isEmpty();
}
-bool HarfBuzzShaper::shapeHarfBuzzRuns()
+bool HarfBuzzShaper::shapeHarfBuzzRuns(bool shouldSetDirection)
{
HarfBuzzScopedPtr<hb_buffer_t> harfbuzzBuffer(hb_buffer_create(), hb_buffer_destroy);
hb_buffer_set_unicode_funcs(harfbuzzBuffer.get(), hb_icu_get_unicode_funcs());
- if (m_run.rtl() || m_run.directionalOverride())
- hb_buffer_set_direction(harfbuzzBuffer.get(), m_run.rtl() ? HB_DIRECTION_RTL : HB_DIRECTION_LTR);
for (unsigned i = 0; i < m_harfbuzzRuns.size(); ++i) {
unsigned runIndex = m_run.rtl() ? m_harfbuzzRuns.size() - i - 1 : i;
HarfBuzzRun* currentRun = m_harfbuzzRuns[runIndex].get();
const SimpleFontData* currentFontData = currentRun->fontData();
+ hb_buffer_set_script(harfbuzzBuffer.get(), currentRun->script());
+ if (shouldSetDirection)
+ hb_buffer_set_direction(harfbuzzBuffer.get(), currentRun->rtl() ? HB_DIRECTION_RTL : HB_DIRECTION_LTR);
+
// Add a space as pre-context to the buffer. This prevents showing dotted-circle
// for combining marks at the beginning of runs.
static const uint16_t preContext = ' ';
@@ -351,8 +357,6 @@
setGlyphPositionsForHarfBuzzRun(currentRun, harfbuzzBuffer.get());
hb_buffer_reset(harfbuzzBuffer.get());
- if (m_run.rtl() || m_run.directionalOverride())
- hb_buffer_set_direction(harfbuzzBuffer.get(), m_run.rtl() ? HB_DIRECTION_RTL : HB_DIRECTION_LTR);
}
return true;
« no previous file with comments | « Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzShaper.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698