After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 726298 - gtk-font-name isn't correctly handled on Windows
gtk-font-name isn't correctly handled on Windows
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: Win32
3.11.x
Other Windows
: Normal normal
: ---
Assigned To: gtk-win32 maintainers
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2014-03-14 02:58 UTC by Fan, Chun-wei
Modified: 2014-03-28 13:12 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
The image showing garbled text for Arabic and Hebrew (90.00 KB, image/png)
2014-03-14 02:58 UTC, Fan, Chun-wei
  Details
Fallback to Pango for gtk-font-name handling on Windows if necessary (2.57 KB, patch)
2014-03-14 08:42 UTC, Fan, Chun-wei
accepted-commit_now Details | Review

Description Fan, Chun-wei 2014-03-14 02:58:18 UTC
Created attachment 271818 [details]
The image showing garbled text for Arabic and Hebrew

Hi,

The commit 254d35af re-activates gtk-font-name handling, but unfortunately it isn't a fully-optimal solution as it breaks the handling of fonts that the system code page does not support.  For example, as shown in the attached image, the Hebrew and Arabic texts in "Internationalization" under the "Text View" (or "Multiple Views") demo in gtk3-demo would show garbled/incorrect text, the Japanese text is displayed correctly on my Chinese (zh-TW) Windows 8 system.
Comment 1 Fan, Chun-wei 2014-03-14 03:25:32 UTC
Hi,

Apparently this problem hits when one or both of the following are true:
-The system is running Windows 8
-The setting for the language for non-Unicode programs differs from the language version of Windows (7 included, not sure about XP) that is running.

I will try to investigate on this-this problem can be worked-around by deactivating the gtk-font-name handling, but probably better solutions exist.

With blessings, thank you!
Comment 2 Fan, Chun-wei 2014-03-14 08:42:50 UTC
Created attachment 271832 [details] [review]
Fallback to Pango for gtk-font-name handling on Windows if necessary

Hi,

I have come up with a patch to let the gtk-font-name handling fallback to using Pango (the behavior before the commit that re-activated handling gtk-font-name on Windows using Win32 APIs) when:

1. The program is running on Windows 8+ 
2. The code page setting of non-Unicode programs does not match the language version of Windows that is running.

The reason behind falling back to Pango in scenario 2 is because, if people are developing GTK+-3.x apps using Visual Studio on CJK versions of Windows, they need to set the code page of non-Unicode programs to English, so that the resulting code will build and run correctly.

As we are close to 3.12 at this point, it would be greatly appreciated if this code can receive some feedback, and perhaps getting in, ASAP.

With blessings, thank you!
Comment 3 Fan, Chun-wei 2014-03-14 08:46:43 UTC
Oh, by the way, I have tested this in the following systems:

-Windows XP pro Chinese (Traditional), running in Windows 7 XP Mode
-Windows 7 pro, Chinese (Traditional), with non-Unicode code page setting to English (US) and Chinese (Taiwan)
-Windows 8.1 pro, Chinese (Traditional), with non-Unicode code page setting to English (US) and Chinese (Taiwan)

...and it seems that things are running fine in these parts at this point.

With blessings, thank you!
Comment 4 Ignacio Casal Quinteiro (nacho) 2014-03-28 09:12:33 UTC
Review of attachment 271832 [details] [review]:

I'd rather have it handled with the win apis but in any case I guess we can push this for now.
Comment 5 Fan, Chun-wei 2014-03-28 13:12:54 UTC
Hello Ignacio,

Thanks for the reviews, I have pushed the patch as 9e686d1f.

With blessings, thank you-I will close this bug for now.