diff --git a/third_party/txt/src/minikin/LineBreaker.cpp b/third_party/txt/src/minikin/LineBreaker.cpp index adff2a1e7733bdfe35fc0df459380d666dbcfa07..7ecee7e2c1c27fc3f1a8bea7890eef08a7b785d0 100644 --- a/third_party/txt/src/minikin/LineBreaker.cpp +++ b/third_party/txt/src/minikin/LineBreaker.cpp @@ -32,8 +32,6 @@ using std::vector; namespace minikin { -const int CHAR_TAB = 0x0009; - // Large scores in a hierarchy; we prefer desperate breaks to an overfull line. // All these constants are larger than any reasonable actual width score. const float SCORE_INFTY = std::numeric_limits::max(); @@ -159,22 +157,14 @@ float LineBreaker::addStyleRun(MinikinPaint* paint, size_t postSpaceCount = mSpaceCount; for (size_t i = start; i < end; i++) { uint16_t c = mTextBuf[i]; - if (c == CHAR_TAB) { - mWidth = mPreBreak + mTabStops.nextTab(mWidth - mPreBreak); - if (mFirstTabIndex == INT_MAX) { - mFirstTabIndex = (int)i; - } - // fall back to greedy; other modes don't know how to deal with tabs - mStrategy = kBreakStrategy_Greedy; - } else { - if (isWordSpace(c)) - mSpaceCount += 1; - mWidth += mCharWidths[i]; - if (!isLineEndSpace(c)) { - postBreak = mWidth; - postSpaceCount = mSpaceCount; - afterWord = i + 1; - } + // libtxt: Tab handling was removed here. + if (isWordSpace(c)) + mSpaceCount += 1; + mWidth += mCharWidths[i]; + if (!isLineEndSpace(c)) { + postBreak = mWidth; + postSpaceCount = mSpaceCount; + afterWord = i + 1; } if (i + 1 == current) { size_t wordStart = mWordBreaker.wordStart(); diff --git a/third_party/txt/src/minikin/LineBreaker.h b/third_party/txt/src/minikin/LineBreaker.h index 4789850bb92fe91160123a6d0b75f0bf13b8e1e4..1dc88e1f1d7ce2aa67f74b3ba8b8411f6eb20dee 100644 --- a/third_party/txt/src/minikin/LineBreaker.h +++ b/third_party/txt/src/minikin/LineBreaker.h @@ -85,30 +85,6 @@ class LineWidths { std::vector mIndents; }; -class TabStops { - public: - void set(const int* stops, size_t nStops, int tabWidth) { - if (stops != nullptr) { - mStops.assign(stops, stops + nStops); - } else { - mStops.clear(); - } - mTabWidth = tabWidth; - } - float nextTab(float widthSoFar) const { - for (size_t i = 0; i < mStops.size(); i++) { - if (mStops[i] > widthSoFar) { - return mStops[i]; - } - } - return floor(widthSoFar / mTabWidth + 1) * mTabWidth; - } - - private: - std::vector mStops; - int mTabWidth; -}; - class LineBreaker { public: const static int kTab_Shift = @@ -143,10 +119,6 @@ class LineBreaker { void setIndents(const std::vector& indents); - void setTabStops(const int* stops, size_t nStops, int tabWidth) { - mTabStops.set(stops, nStops, tabWidth); - } - BreakStrategy getStrategy() const { return mStrategy; } void setStrategy(BreakStrategy strategy) { mStrategy = strategy; } @@ -246,7 +218,6 @@ class LineBreaker { HyphenationFrequency mHyphenationFrequency = kHyphenationFrequency_Normal; bool mJustified; LineWidths mLineWidths; - TabStops mTabStops; // result of line breaking std::vector mBreaks;