Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-20973

QFont (or something related) is unable to correctly resolve "Helvetica" and "Times" font family names when they not available on an X11 system under that names; causes "regression" in QtWebKit 2.2

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • P3: Somewhat important
    • None
    • 4.8.0
    • GUI: Font handling
    • None
    • Gentoo x86_64 unstable (i.e., ~amd64 arch), X11

    Description

      Initially I reported it as webkit bug 66384[1] but was told it is a Qt bug. As I don't quite know how to describe the problem on the Qt side, let me copy what I've written from QtWebKit perpective:

      After upgrading from Qt 4.7 to 4.8-beta1 I noticed that some apps using QtWebKit started rendering very bad looking fonts. Those apps are for example Qt Assistant and Kadu IM (version at least 0.9.0) when using its default settings. After some research I found that QWebSettings c-tor in QtWebKit 2.0 was hardcoding font families defaults that were working just fine on my system[2]. Though in QtWebKit 2.2 the QWebSettings c-tor relies on QFont::defaultFamily() regarding default font families and that QFont method, at least on X11, hardcodes fonts that just look very bad, like bitmap fonts or something. Precisely, it is "Times" for default and serif, and "Helvetica" for sans-serif[3]. I don't have such fonts installed on my system at all but I suppose they are somehow built into Qt as qtconfig is able to find and render them (in the same ugly way that QtWebKit does).

      On a side note, I also was able to confirm this issue on a clean Fedora Rawhide installation, which shows that it isn't limited only to my system.

      It is a discussion that took place on #qtwebkit after I reported the bug to webkit:

      <torarne> beevvy: if you can repro that in qtconfig that means that it's not really a webkit problem
      <torarne> beevvy: it means the default that qt has depends on a certain setup of the system, which if i remember correctly was according to lars a dependency we were willing to take
      <torarne> ill check tomorrow exactly what was the dependency
      <beevvy> torarne: anyway as a user (and developer using Qt) I definitely see a regresion between Qt 4.7 and 4.8-beta1, if you want so I can report it directly to Qt bugtracker
      <beevvy> torarne: it badly affects already released version of my app and thus I really would like to see it fixed that or another way in Qt 4.8.0
      <beevvy> thanks for taking care of my report anyway
      <elproxy> beevvy: could it be that you have no fonconfig ?
      <beevvy> $ ldd /usr/lib64/qt4/libQtGui.so.4.8.0 | grep fontconfig
      <beevvy> libfontconfig.so.1 => /usr/lib64/libfontconfig.so.1 (0x00007f7fe9602000)
      <beevvy> elproxy: ^^
      <elproxy> beevvy: ok good, not that then
      <torarne> beevvy: see ea2b0154a8ef7e24cf290345e8e02ae2c28a6217 in Qt
      <beevvy> torarne: I think this commit has nothing to do with the issue I have, for monospace/cursive/fantasy font families very much correct fonts are grabbed, I think
      <beevvy> torarne: problem is with QFont::

      {System,SansSerif,Serif}

      I think
      <torarne> beevvy: that's the commit in Qt that was related to r51758 in webkit
      <torarne> beevvy: both having the goal of aligning the generic font families for QtWebKit with other browsers on all platforms
      <torarne> beevvy: sorry, wrong webkit commit, just a sec
      <torarne> beevvy: r64114
      <beevvy> torarne: yes it's exactly the change which causes regression, thanks
      <torarne> beevvy: afaicr the effect you're seeing was an expected "regression", and caused by not having a dependency on your system, such as fontconfig
      <torarne> beevvy: the webkit change exposed that lack of the dependency, but did not cause it
      <torarne> beevvy: as evident by the same "bug" in qtconfig
      <torarne> beevvy: i will check tomorrow exactly what that dependency was, and if there's an unexpected regression here
      <beevvy> torarne: I do have fontconfig as I wrote to elproxy above
      <torarne> beevvy: right, i don't remember which one it was
      <beevvy> torarne: so are "Helvetica" and "Times" supposed to be mapped to something that I actually have on my system?
      <beevvy> torarne: because these are the names returned by QFont::defaultFamily()
      <beevvy> ...that doesn't render good on my system
      <elproxy> beevvy: yup, Helvetica should be resolved in DejaVu Sans I think
      <beevvy> elproxy: that makes very much sense to me
      <beevvy> should I do something more to help fix it?
      <elproxy> beevvy: well, it sounds to me like we still haven't quite figured out what the problem is...
      <elproxy> beevvy: maybe wait until tomorrow for torarne to check on what dependency you might be missing that's causing this...
      <beevvy> elproxy: ok, I will stay on this channel

      [1] https://bugs.webkit.org/show_bug.cgi?id=66384
      [2] Exact commit that changed this is webkit r64114: http://trac.webkit.org/changeset/64114
      [3] Refer to that piece of code: https://qt.gitorious.org/qt/qt/blobs/4.8/src/gui/text/qfont_x11.cpp#line275

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            jiang Jiang Jiang
            beevvy Bartosz Brachaczek
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes