diff --git a/engine/src/flutter/third_party/txt/src/minikin/LineBreaker.cpp b/engine/src/flutter/third_party/txt/src/minikin/LineBreaker.cpp index 7ecee7e2c1c..35f7d9da2bd 100644 --- a/engine/src/flutter/third_party/txt/src/minikin/LineBreaker.cpp +++ b/engine/src/flutter/third_party/txt/src/minikin/LineBreaker.cpp @@ -238,7 +238,10 @@ void LineBreaker::addWordBreak(size_t offset, HyphenationType hyph) { Candidate cand; ParaWidth width = mCandidates.back().preBreak; - if (postBreak - width > currentLineWidth()) { + // libtxt: add a fudge factor to this comparison. The currentLineWidth passed + // by the framework is based on maxIntrinsicWidth/Layout::measureText + // calculations that may not precisely match the postBreak width. + if (postBreak - width > currentLineWidth() + 0.00001) { // Add desperate breaks. // Note: these breaks are based on the shaping of the (non-broken) original // text; they are imprecise especially in the presence of kerning,