Bug 29570 - [Qt] External font loading in Qt Webkit
Summary: [Qt] External font loading in Qt Webkit
Alias: None
Product: WebKit
Classification: Unclassified
Component: Text (show other bugs)
Version: 528+ (Nightly build)
Hardware: Other OS X 10.5
: P2 Normal
Assignee: Nobody
Keywords: Qt, QtTriaged
Depends on: 29433
  Show dependency treegraph
Reported: 2009-09-21 08:32 PDT by Tor Arne Vestbø
Modified: 2014-02-03 03:13 PST (History)
5 users (show)

See Also:

Test case (Needs font files, see comment) (515 bytes, text/html)
2010-02-16 06:29 PST, Jocelyn Turcotte
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tor Arne Vestbø 2009-09-21 08:32:49 PDT
This bug report originated from Nokia internal issue QT-1762

--- Comments ---




Windows Vista

Platform details
The bug appears on Vista x64 and Ubuntu 9.04. Probably on other platforms too.


Compiler details
Tested with Visual Studio 2008 and GCC 4.3.3.

External font loading in Qt Webkit

Steps to reproduce / test case
[This has been posted to the qt-interest mailing list on 19. July 2009 18:13]

I believe I have found a bug in Qt. It pertains to external font loading
with the “@font-face” CSS property.

Two issues are present:

1.  If we load both the regular and the italic versions of a font face from
different font files and then specify that an HTML element should use that
font face, the regular version of the font is displayed, but not the italic.

Example CSS code:

@font-face { font-family: "Fontin"; src: url(Fontin-Regular.ttf); }
@font-face { font-family: "Fontin"; font-style: italic; src:
url(Fontin-Italic.ttf); }
body { font-family: "Fontin" }

The regular style is displayed correctly, the italic isn’t. Same thing
happens for bold versions and different font families/font files. Needless
to say, this works in Firefox 3.5 and Safari 4.0.2.

2. My application uses the “contentEditable” property to enable editing of
the loaded HTML file. If the user tries to make some regular text italic
with “CTRL + I” (or invokes the command in some other way), the text isn’t
displayed italic (because of issue #1, naturally). But if he then closes the
application, it crashes with a segfault.

I have also tried loading the fonts by hand with
“QFontDatabase::addApplicationFont(const QString & fileName)” and it made no
difference for either issue.

I am providing a small test application that demonstrates issue #1. But for
reasons that are beyond my comprehension, I am unable to replicate issue #2
in a test application, although it is very easy to replicate in my program.

Make sure that the font files are in the same folder as your executable, and
that they are not installed in the system.

I do have the next best thing for issue #2: start the “Browser” demo
application that comes with Qt and open the “test.xhtml” file that comes
with my test app for issue #1. Even without setting “contentEditable” to
true and making some text italic by hand, it will crash on exit with a
segfault. It will also display issue #1, that is, it won’t display italic
text as italic. I have analyzed the stack trace for the crash in the
“Browser” application and in my own, and they are practically identical: it’s
the same bug, although it’s invoked in slightly different ways. I have
included the stack trace for my application for reference.

This has all been tested on Vista x64 and Ubuntu 9.04. The Qt versions used
were 4.5.2 and 4.5.0, respectively.


[On the mailing list it's been pointed out that I should use CSS styling for the italic text. My
application uses them exclusively. The example uses "<i>Italic text.</i>" for the sake of brevity. The bug doesn't care. Feel free to set the text italic with a CSS style and see the application crash in the absolutely same way.]
Comment 1 Jocelyn Turcotte 2010-02-16 06:29:42 PST
Created attachment 48813 [details]
Test case (Needs font files, see comment)

To reproduce:
- download the html file on you disk
- download the Fontin-Regular.ttf and Fontin-Italic.ttf from the following page in the same directory:

Reproduced in trunk.

The description also talks about a crash while editing such a page within QtWebKit.
Comment 2 Robert Hogan 2010-12-20 12:21:21 PST
Is this a duplicate of https://bugs.webkit.org/show_bug.cgi?id=29433 ?
Comment 3 Strahinja Markovic 2010-12-21 05:35:37 PST
This is a duplicate of https://bugs.webkit.org/show_bug.cgi?id=29433 

I wrote the original report on the old Nokia tracker almost two years ago.
Comment 4 Jocelyn Turcotte 2014-02-03 03:13:04 PST
=== Bulk closing of Qt bugs ===

If you believe that this bug report is still relevant for a non-Qt port of webkit.org, please re-open it and remove [Qt] from the summary.

If you believe that this is still an important QtWebKit bug, please fill a new report at https://bugreports.qt-project.org and add a link to this issue. See http://qt-project.org/wiki/ReportingBugsInQt for additional guidelines.