[Interest] QML WebView font cache problems

Антон Филимонов anton.filimonov at gmail.com
Thu Nov 1 15:05:20 CET 2012


Hi,

I've discovered rather strange behaviour of QML WebView component when
loading sites that define custom font-faces using css @font-face.

We are using Qt 4.8.

Out main application window is QDeclarativeView displaing some QML. On
button click we show QML WebView in modal dialog using
another QDeclarativeView that loads a web-page from internet (one example
of such page is http://www.adidas.com/us/micoach/). Page loads
successfully. However, when the dialog is closed, whole application crashes
on paintEvent with stack trace:

qtgui4!QRasterPaintEngine::supportsTransformations+0x21
qtgui4!QRasterPaintEngine::drawTextItem+0x3c
qtgui4!QPainter::drawTextItem+0x525
qtgui4!QTextLine::draw+0xbf2
qtgui4!QTextLayout::draw+0x8be
QtDeclarative4!QDeclarativeTextLayout::draw+0x273

....


A problem is that QMultiFontEngine::engine method returns zero pointer that
is then passed to QTextItemInt and ends up being dereferenced in
QRasterPaintEngine::supportsTransformations.


I've double checked that before showing web-page a non null QFontEngine is
returned for the same text item.


As far as I understand, loading web page with custom fonts causes WebKit to
create those fonts, add them to QFontDatabase, which calls
QFontCache::clear. Can it be that clearing font cache somehow corrupts
fontengines used in our main QDeclarativeView?


There is very simialr bug
https://bugreports.qt-project.org/browse/QTBUG-22249. However, it has not
been update for almost a year.


I've tried to call QApplication::processEvents to process all paint events
before calling the dialog and clearing font cache. No luck. :(


Is there any way to stop QML WebView from loading custom fonts?


Thanks,

Anton Filimonov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20121101/0e332cb9/attachment.html>


More information about the Interest mailing list