https://bugs.winehq.org/show_bug.cgi?id=43956
Bug ID: 43956 Summary: GDI+ is unable to load some truetype fonts Product: Wine Version: 2.19 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: gdiplus Assignee: wine-bugs@winehq.org Reporter: jp-dev@inbox.ru Distribution: ---
My GDI+ program is unable to load a certain font when it runs under Wine. I have written a smaller test program, and the font which fails under Wine was able to load under Windows XP.
The test program uses the GdipPrivateAddFontFile API, whereas my program where I first met the bug used GdipPrivateAddMemoryFont. In both cases, it is the same error, a GpStatus 3 is returned, the enumeration value OutOfMemory.
I attach the problematic font file to this bug report.
I an using wine-staging 2.19.
https://bugs.winehq.org/show_bug.cgi?id=43956
--- Comment #1 from JP Cimalando jp-dev@inbox.ru --- Created attachment 59599 --> https://bugs.winehq.org/attachment.cgi?id=59599 A test program
https://bugs.winehq.org/show_bug.cgi?id=43956
--- Comment #2 from JP Cimalando jp-dev@inbox.ru --- Created attachment 59600 --> https://bugs.winehq.org/attachment.cgi?id=59600 font file not loadable by GDI+ (OFL license)
https://bugs.winehq.org/show_bug.cgi?id=43956
JP Cimalando jp-dev@inbox.ru changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |jp-dev@inbox.ru
https://bugs.winehq.org/show_bug.cgi?id=43956
--- Comment #3 from JP Cimalando jp-dev@inbox.ru --- The root of the problem seems to be ERROR_INSUFFICIENT_BUFFER (122) returned by MultiByteToWideChar. It's located in copy_name_table_string in gdiplus/font.c line 1415, under the TT_PLATFORM_MACINTOSH case.
https://bugs.winehq.org/show_bug.cgi?id=43956
Fabian Maurer dark.shadow4@web.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |download, source, testcase CC| |dark.shadow4@web.de Ever confirmed|0 |1 Status|UNCONFIRMED |NEW
--- Comment #4 from Fabian Maurer dark.shadow4@web.de --- You're right, this is very odd. Thanks for the detailed bug report, always appreciate test cases like this. Is there other fonts with the same problem, or was this the only one you found?
https://bugs.winehq.org/show_bug.cgi?id=43956
--- Comment #5 from JP Cimalando jp-dev@inbox.ru --- I don't have another font which fails like this one. Running file on it reveals it's a "macintosh" font, I have no idea myself what this means but it seems relevant. This font is an output of fontforge and you can find the source at this address. https://github.com/jpcima/lcd-font
https://bugs.winehq.org/show_bug.cgi?id=43956
--- Comment #6 from JP Cimalando jp-dev@inbox.ru --- Increasing the size of the buffer WCHAR[32] in GdipPrivateAddMemoryFont apparently fixes the problem. I doubled it to 64.
https://bugs.winehq.org/show_bug.cgi?id=43956
--- Comment #7 from Nikolay Sivov bunglehead@gmail.com --- The issue is likely because we rely on gdi32 too much in font handling, especially for private fonts. 32 stands for LF_FACESIZE, which is a name length limit for LOGFONT structure. We probably should make it dynamic.
https://bugs.winehq.org/show_bug.cgi?id=43956
--- Comment #8 from Fabian Maurer dark.shadow4@web.de --- Created attachment 59606 --> https://bugs.winehq.org/attachment.cgi?id=59606 Edited font with insanely long name
Definitely need to make it dynamic.
Attached a font with really long name, it needs a buffer of ~3300 to work. On windows it works fine though.
https://bugs.winehq.org/show_bug.cgi?id=43956
--- Comment #9 from Fabian Maurer dark.shadow4@web.de --- Created attachment 59614 --> https://bugs.winehq.org/attachment.cgi?id=59614 Patch to allow fonts with long names
Attached a patch to address this issue. Still needs a bit more testing though.
https://bugs.winehq.org/show_bug.cgi?id=43956
--- Comment #10 from Fabian Maurer dark.shadow4@web.de --- Sent in a patch: https://source.winehq.org/patches/data/138506
https://bugs.winehq.org/show_bug.cgi?id=43956
--- Comment #11 from Fabian Maurer dark.shadow4@web.de --- Sent in another round of patches. The issue lies also with gdi32, that can't deal with those long names. The current patchset has one patch to deal with those gdi32 issues and the other for the gdiplus problem.
https://bugs.winehq.org/show_bug.cgi?id=43956
Fabian Maurer dark.shadow4@web.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Fixed by SHA1| |89366f740f1e3629a58711057af | |ba39681a07ad6 Resolution|--- |FIXED Status|NEW |RESOLVED
--- Comment #12 from Fabian Maurer dark.shadow4@web.de --- Fixed with 89366f740f1e3629a58711057afba39681a07ad6.
https://bugs.winehq.org/show_bug.cgi?id=43956
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #13 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 3.0-rc1.
https://bugs.winehq.org/show_bug.cgi?id=43956
Michael Stefaniuc mstefani@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |2.0.x
https://bugs.winehq.org/show_bug.cgi?id=43956
Michael Stefaniuc mstefani@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|2.0.x |---
--- Comment #14 from Michael Stefaniuc mstefani@winehq.org --- Removing the 2.0.x milestone from bugs included in 2.0.5.