Steps to reproduce: 1. With any QtWebkit-based browser or example (tested with Arora+Qt4.5.2 and Browser demo from the same Qt) browse to http://www.cs.tut.fi/~jkorpela/shytest.html 2. Resize browser window. 3. Observe that words are hyphenated/broken, but no hyphens are visible. Works OK with: Safari, Konqueror, Firefox
Confirmed in WebKit trunk (r48110), against Qt 4.6 (77fd77d6), on Mac OS 10.5
*** Bug 29576 has been marked as a duplicate of this bug. ***
*** Bug 29573 has been marked as a duplicate of this bug. ***
*** Bug 35838 has been marked as a duplicate of this bug. ***
Reproduced on Snow Leopard with Qt 4.7 trunk (HEAD 03f8f1df0d88f5ffe0b3120cffce614cbeefdb70) and WebKit trunk (r59155).
https://bugs.webkit.org/show_bug.cgi?id=27593 3. 27593 Nor P2 All webkit-unassigned@lists.web... NEW [Qt] Hyphenation is broken (no hyphens visible) for QtWebkit From what I can tell the Qt line text breaking code does not honor the soft hypen (&Shy;). Below is a edited call stack. I replaced soft hyphen char with "\xAD". Basically, it shows the WebCore line breaking calling into the Qt TextBreakIterator and then into Qt QTextBoundaryFinder::toNextBoundary(), #0 WebCore::textBreakFollowing (bi=0x340bfe0, pos=19) /Source/WebCore/platform/text/qt/TextBreakIteratorQt.cpp:12 int textBreakFollowing(TextBreakIterator* bi, int pos) { bi->setPosition(pos); int newpos = bi->toNextBoundary(); DEBUG() << "textBreakFollowing" << pos << newpos; return newpos; } #1 WebCore::lineBreakIterator /Source/WebCore/platform/text/qt/TextBreakIteratorQt.cpp:95 #2 WebCore::nextBreakablePosition #3 WebCore::isBreakable /Source/WebCore/rendering/break_lines.h:33 #4 WebCore::RenderBlock::findNextLineBreak /Source/WebCore/rendering/RenderBlockLineLayout.cpp:1725 #5 WebCore::RenderBlock::layoutInlineChildren /Source/WebCore/rendering/RenderBlockLineLayout.cpp:681 #6 WebCore::RenderBlock::layoutBlock /Source/WebCore/rendering/RenderBlock.cpp:1222 Since I don't have Qt enabled for debugging, I traced that by looking at the source. The QTextBoundaryFinder::toNextBoundary() for Line skips anything < HB_Break which means it will only return the position for HB_Break or HB_ForcedBreak. HB_SoftHyphen is ignored. This routine returns when it encounters the next whitespace ignoring any soft hyphens. int QTextBoundaryFinder::toNextBoundary() { ... case Line: Q_ASSERT(pos); while (pos < length && d->attributes[pos-1].lineBreakType < HB_Break) ++pos; break; toNextBoundary uses harfbuzz. ./3rdparty/harfbuzz/src/harfbuzz-shaper.h: typedef enum { HB_NoBreak, HB_SoftHyphen, HB_Break, HB_ForcedBreak } HB_LineBreakType; So is this as simple as changing the condition to < HB_SoftHyphen or is there a deeper problem. Need to investigate.
When I enable ICU in WebKit with the following, the test case passes. build-webkit --qt --debug --qmakearg=CONFIG+=text_breaking_with_icu This further points to this code ./src/corelib/tools/qtextboundaryfinder.cpp int QTextBoundaryFinder::toNextBoundary() which is not called when ICU is enabled. There is a corresponding Qt error https://qtrequirements.europe.nokia.com/browse/QT-4657 which I need to get reopened. I think we closed the wrong error.
This seems to work well these days. Could be a side effect of fixing QTextBoundaryFinder. :)