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

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

Issue 1242213002: Add tab characters support in complex path (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fast/text/drawBidiText.html NeedsRebaseline Created 5 years, 4 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
« no previous file with comments | « Source/platform/fonts/shaping/HarfBuzzShaper.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/fonts/shaping/HarfBuzzShaper.cpp
diff --git a/Source/platform/fonts/shaping/HarfBuzzShaper.cpp b/Source/platform/fonts/shaping/HarfBuzzShaper.cpp
index 310eca5f3dec129348e01b46e1f6d3dc5d5f3686..5c6fe1d4923247cbac1fe38ca9163b5958896975 100644
--- a/Source/platform/fonts/shaping/HarfBuzzShaper.cpp
+++ b/Source/platform/fonts/shaping/HarfBuzzShaper.cpp
@@ -1140,6 +1140,31 @@ void HarfBuzzShaper::shapeResult(ShapeResult* result, unsigned index,
result->m_runs[index] = run.release();
}
+PassRefPtr<ShapeResult> ShapeResult::createForTabulationCharacters(const Font* font,
+ const TextRun& textRun, float positionOffset, unsigned count)
+{
+ const SimpleFontData* fontData = font->primaryFont();
+ OwnPtr<ShapeResult::RunInfo> run = adoptPtr(new ShapeResult::RunInfo(fontData,
+ // Tab characters are always LTR or RTL, not TTB, even when isVerticalAnyUpright().
+ textRun.rtl() ? HB_DIRECTION_RTL : HB_DIRECTION_LTR,
+ HB_SCRIPT_COMMON, 0, count, count));
+ float position = textRun.xPos() + positionOffset;
+ float startPosition = position;
+ for (unsigned i = 0; i < count; i++) {
+ float advance = font->tabWidth(*fontData, textRun.tabSize(), position);
+ run->m_glyphData[i].characterIndex = i;
+ run->setGlyphAndPositions(i, fontData->spaceGlyph(), advance, 0, 0);
+ position += advance;
+ }
+ run->m_width = position - startPosition;
+
+ RefPtr<ShapeResult> result = ShapeResult::create(font, count, textRun.direction());
+ result->m_width = run->m_width;
+ result->m_numGlyphs = count;
+ result->m_runs.append(run.release());
+ return result.release();
+}
+
float HarfBuzzShaper::adjustSpacing(ShapeResult::RunInfo* run, size_t glyphIndex, unsigned currentCharacterIndex, float& offset, float& totalAdvance)
{
float spacing = 0;
« no previous file with comments | « Source/platform/fonts/shaping/HarfBuzzShaper.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698