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

Unified Diff: Source/platform/fonts/harfbuzz/HarfBuzzShaper.cpp

Issue 617103003: Replace ENABLE_OPENTYPE_VERTICAL implementation with HarfBuzz (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@removeOpenTypeVertical
Patch Set: Created 6 years, 3 months 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
Index: Source/platform/fonts/harfbuzz/HarfBuzzShaper.cpp
diff --git a/Source/platform/fonts/harfbuzz/HarfBuzzShaper.cpp b/Source/platform/fonts/harfbuzz/HarfBuzzShaper.cpp
index 9869c5c081b9a9faa24b6a667c06ffe3bfe94d93..9b4dcdd20446b609e86495f6ccf8d974612f42aa 100644
--- a/Source/platform/fonts/harfbuzz/HarfBuzzShaper.cpp
+++ b/Source/platform/fonts/harfbuzz/HarfBuzzShaper.cpp
@@ -455,12 +455,6 @@ void HarfBuzzShaper::setDrawRange(int from, int to)
void HarfBuzzShaper::setFontFeatures()
{
const FontDescription& description = m_font->fontDescription();
- if (description.orientation() == Vertical) {
- static hb_feature_t vert = { HarfBuzzFace::vertTag, 1, 0, static_cast<unsigned>(-1) };
- static hb_feature_t vrt2 = { HarfBuzzFace::vrt2Tag, 1, 0, static_cast<unsigned>(-1) };
- m_features.append(vert);
- m_features.append(vrt2);
- }
static hb_feature_t noKern = { HB_TAG('k', 'e', 'r', 'n'), 0, 0, static_cast<unsigned>(-1) };
static hb_feature_t noVkrn = { HB_TAG('v', 'k', 'r', 'n'), 0, 0, static_cast<unsigned>(-1) };
@@ -783,9 +777,10 @@ static inline hb_script_t ICUScriptToHBScript(UScriptCode script)
return hb_script_from_string(uscript_getShortName(script), -1);
}
-static inline hb_direction_t TextDirectionToHBDirection(TextDirection dir)
+static inline hb_direction_t TextDirectionToHBDirection(TextDirection dir, FontOrientation orientation, const SimpleFontData* fontData)
{
- return dir == RTL ? HB_DIRECTION_RTL : HB_DIRECTION_LTR;
+ hb_direction_t harfBuzzDirection = orientation == Vertical && !fontData->isTextOrientationFallback() ? HB_DIRECTION_TTB : HB_DIRECTION_LTR;
+ return dir == RTL ? HB_DIRECTION_REVERSE(harfBuzzDirection) : harfBuzzDirection;
}
@@ -799,7 +794,7 @@ void HarfBuzzShaper::addHarfBuzzRun(unsigned startCharacter,
m_fallbackFonts->add(fontData);
return m_harfBuzzRuns.append(HarfBuzzRun::create(fontData,
startCharacter, endCharacter - startCharacter,
- TextDirectionToHBDirection(m_run.direction()),
+ TextDirectionToHBDirection(m_run.direction(), m_font->fontDescription().orientation(), fontData),
ICUScriptToHBScript(script)));
}
@@ -908,7 +903,9 @@ void HarfBuzzShaper::setGlyphPositionsForHarfBuzzRun(HarfBuzzRun* currentRun, hb
uint16_t glyph = glyphInfos[i].codepoint;
float offsetX = harfBuzzPositionToFloat(glyphPositions[i].x_offset);
float offsetY = -harfBuzzPositionToFloat(glyphPositions[i].y_offset);
- float advance = harfBuzzPositionToFloat(glyphPositions[i].x_advance);
+ // One out of x_advance and y_advance is zero, depending on
+ // whether the buffer direction is horizontal or vertical.
+ float advance = harfBuzzPositionToFloat(glyphPositions[i].x_advance + glyphPositions[i].y_advance);
unsigned currentCharacterIndex = currentRun->startIndex() + glyphInfos[i].cluster;
bool isClusterEnd = runEnd || glyphInfos[i].cluster != glyphInfos[i + 1].cluster;

Powered by Google App Engine
This is Rietveld 408576698