http://bugs.winehq.org/show_bug.cgi?id=58314
Bug ID: 58314 Summary: GetGlyphOutlineW returns a negative number sometimes Product: Wine Version: 10.8 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: gdi32 Assignee: wine-bugs@winehq.org Reporter: skyfloogle@protonmail.com Distribution: ---
Created attachment 78672 --> http://bugs.winehq.org/attachment.cgi?id=78672 Source code for a repro, an exe build, Windows and Wine sample logs, and the necessary font.
In an application I'm developing, I've found that GetGlyphOutlineW returns a negative number under specific circumstances in Wine. According to the documentation, it should return a positive number, with the exception of GDI_ERROR (-1). My program therefore treats the return value as unsigned (as specified in the documentation) and checks against -1, which doesn't work when it returns -32 instead. It's not clear to me why this value is being returned, but I've only seen it reproduce with a specific character (¯) in a specific font.
I've put together a minimal reproducing sample. The issue reproduces on both 32 and 64 bit, and does not reproduce on Windows. Source code and a copy of the necessary font (https://ggbot.itch.io/raster-forge-font) are attached, as are expected and actual logs. In this sample, -8 is returned instead of -32, but I suspect the root cause is similar - it shouldn't be returning anything lower than -1 in either case.
For what it's worth, I'm running on EndeavourOS, which hasn't received 10.9 yet at the time of writing, but I've checked the commit logs for gdi32 and haven't seen anything that looks relevant.
http://bugs.winehq.org/show_bug.cgi?id=58314
Nikolay Sivov bunglehead@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever confirmed|0 |1
--- Comment #1 from Nikolay Sivov bunglehead@gmail.com --- The sample program is asking for a glyph for 0xaf (macron) that does not exist in the font. Linked font is used instead, Tahoma in this case.
Next in freetype_get_glyph_outline() in metrics fixup:
--- metrics.horiBearingY = top; metrics.height = top - bottom; ---
things go wrong and resulting box gets inverted yMin and yMax. This produces negative height later and negative "needed" buffer size.
I don't have time right now to look deeper at what's happening with this metrics adjustment, but that's the problem I think. I don't know if it's a general fixup issue or is caused by a linked font and metrics are mixed up somewhere between the fonts.