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

QFontInfo::family() does not show localized family name on OS X with Japanese locale.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • P2: Important
    • None
    • 4.8.5
    • GUI: Font handling
    • OS X 10.7 and 10.8 system. Japanese locale set as primary locale.
    • macOS

    Description

      Steps to reproduce this issue.

      1. Make a sample application which has a QFontComboBox widget.
      2. Set OS language to Japanese, so that all font names in the combo box will be localized in Japanese.
      3. Select a font called "ヒラギノ角ゴ Pro" in the combo box and save selected family name into a QString variable.
      4. We tried to get the font family name back from above step's QString variable by using: QFontInfo("ヒラギノ角ゴ Pro").family() method.

      Expected result: returned value of family() method will be localized in Japanese.
      Actual result: "Hiragino Kaku Gothic Pro" which is the original family name in English.

      We used the result of QFontInfo::family() to find the correct font name in combo box. The combo box contains font names in Japanese while QFontInfo::family() returns font name in English so the combo box doesn't find anything match with the keyword.

      Alternative test code listed below.

      diff --git a/examples/dialogs/standarddialogs/dialog.cpp b/examples/dialogs/standa
      index bdfc739..ff640ae 100644
      --- a/examples/dialogs/standarddialogs/dialog.cpp
      +++ b/examples/dialogs/standarddialogs/dialog.cpp
      @@ -272,6 +272,8 @@ void Dialog::setFont()
               fontLabel->setText(font.key());
               fontLabel->setFont(font);
           }
      +    qDebug() << "font.family():" << font.family();
      +    qDebug() << "QFontInfo(font.family()).family():" << QFontInfo(font.family()).
       }
      
       void Dialog::setExistingDirectory()
      

      Qt 4.8.4/5

      font.family(): "ヒラギノ角ゴ Pro"
      QFontInfo(font.family()).family(): "Hiragino Kaku Gothic Pro"
      *Expected: QFontInfo(font.family()).family(): "ヒラギノ角ゴ Pro"

      Qt 5.1

      font.family(): "ヒラギノ角ゴ Pro"
      QFontInfo(font.family()).family(): "ヒラギノ角ゴ Pro"

      Attachments

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

        Activity

          People

            esabraha Eskil Abrahamsen Blomfeldt
            leonlee Leonard Lee
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes