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

QFontDatabase::styles() appears to have locale sensitivity on Linux

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 4.8.0
    • 4.7.0
    • GUI: Text handling
    • None
    • 18447df1d021cfed69472b867cb7593401be27a6

    Description

      During investigation of a KDE bug (https://bugs.kde.org/show_bug.cgi?id=250728), we've found an apparent locale sensitivity in QFontDatabase, at least on Linux (original reporter identified the problem on Ubuntu 10.04.1 LTS, I've reproduced it on Fedora 13).

      The result of the styles() method appears to vary according to the LC_CTYPE environment variable, for one specific font (NSimSun). It works correctly, except for Chinese language locales (e.g. LC_CTYPE=zh_CN.UTF-8). In those cases, styles() returns an empty QStringList.

      The attached patch (for the qfontdatabase auto tests) shows the problem. It passes for the C locale, and most other locales that I tried.

      When run as
      [bradh@fedora13 qfontdatabase]$ LC_CTYPE=zh_CN.UTF-8 ./tst_qfontdatabase

                      • Start testing of tst_QFontDatabase *********
                        Config: Using QTest library 4.7.1, Qt 4.7.1
                        PASS : tst_QFontDatabase::initTestCase()
                        PASS : tst_QFontDatabase::styles()
                        SKIP : tst_QFontDatabase::fixedPitch(Script) Font not installed
                        Loc: [tst_qfontdatabase.cpp(153)]
                        SKIP : tst_QFontDatabase::fixedPitch(Courier) Font not installed
                        Loc: [tst_qfontdatabase.cpp(153)]
                        SKIP : tst_QFontDatabase::fixedPitch(Lucida Console) Font not installed
                        Loc: [tst_qfontdatabase.cpp(153)]
                        PASS : tst_QFontDatabase::fixedPitch()
                        PASS : tst_QFontDatabase::widthTwoTimes()
                        PASS : tst_QFontDatabase::addAppFont()
                        FAIL! : tst_QFontDatabase::addAppFontLocale(NSimSun) 'newFamilies.contains(addedFamilies.at)' returned FALSE. ()
                        Loc: [tst_qfontdatabase.cpp(358)]
                        PASS : tst_QFontDatabase::cleanupTestCase()
                        Totals: 6 passed, 1 failed, 3 skipped
                      • Finished testing of tst_QFontDatabase *********

      Attachments

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

        Activity

          People

            jiang Jiang Jiang
            bradh Brad Hards
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes