https://bugs.winehq.org/show_bug.cgi?id=38762
Bug ID: 38762 Summary: floating point exception while rendering font Product: Wine Version: 1.7.29 Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: gdi32 Assignee: wine-bugs@winehq.org Reporter: hramrach@gmail.com Distribution: ---
A font on my system has zero face->size.height and Wine divides by it.
warn:font:freetype_SelectFont font face L"Misaki Mincho" file L"/home/hramrach/.wine/dosdevices/c:/windows/Fonts/misakimn.ttf" has zero face height!
Attaching patch that produces the above warning and ignores the value when zero.
There is a branch for ignoring it under some other conditions already, anyway.
https://bugs.winehq.org/show_bug.cgi?id=38762
Michal Suchanek hramrach@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch
https://bugs.winehq.org/show_bug.cgi?id=38762
super_man@post.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |super_man@post.com
--- Comment #1 from super_man@post.com --- Did you forgot to add the patch?
https://bugs.winehq.org/show_bug.cgi?id=38762
--- Comment #2 from Nikolay Sivov bunglehead@gmail.com --- (In reply to Michal Suchanek from comment #0)
A font on my system has zero face->size.height and Wine divides by it.
warn:font:freetype_SelectFont font face L"Misaki Mincho" file L"/home/hramrach/.wine/dosdevices/c:/windows/Fonts/misakimn.ttf" has zero face height!
Attaching patch that produces the above warning and ignores the value when zero.
There is a branch for ignoring it under some other conditions already, anyway.
Hi, Michal.
The real question of course is what Windows does with it, where did you get this font and what is its file checksum?
https://bugs.winehq.org/show_bug.cgi?id=38762
Nikolay Sivov bunglehead@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords|patch |
https://bugs.winehq.org/show_bug.cgi?id=38762
--- Comment #3 from Nikolay Sivov bunglehead@gmail.com --- Created attachment 52623 --> https://bugs.winehq.org/attachment.cgi?id=52623 test patch
Found this patch using some black magic and Debian mailing lists. Michal, question still stands - how did you install this font? I need exactly same version to reproduce this.
https://bugs.winehq.org/show_bug.cgi?id=38762
Michal Suchanek hramrach@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- URL| |https://packages.debian.org | |/jessie/all/fonts-misaki/do | |wnload
--- Comment #4 from Michal Suchanek hramrach@gmail.com --- thanks for looking into this.
With some more black magic it can be seen that the package version in which this bug is present was 11-20080603-15
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=790417
pts https://packages.debian.org/search?keywords=misaki&searchon=names&su... shows this version is present in jessie and can be downloaded https://packages.debian.org/jessie/all/fonts-misaki/download
More information on fonts-misaki_11-20080603-15_all.deb: Exact Size 58078 Byte (56.7 kByte) MD5 checksum 52ee0ac62535397ec435b2f90ec38829 SHA1 checksum b98e781a8a5a5e6143dabfc5735cea6953699f35 SHA256 checksum 30ac69f2e3df0dead771177aa5364576907f3350b3abe1aa31712d2a2ef9fb0d
https://bugs.winehq.org/show_bug.cgi?id=38762
Nikolay Sivov bunglehead@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Summary|floating point exception |Misaki Mincho font is |while rendering font |causing division by zero on | |selection Ever confirmed|0 |1
--- Comment #5 from Nikolay Sivov bunglehead@gmail.com --- Yes, I can reproduce this now. Confirming.
https://bugs.winehq.org/show_bug.cgi?id=38762
--- Comment #6 from Nikolay Sivov bunglehead@gmail.com --- Okay, so this is what I think happens. Misaki Mincho has exactly one size of embedded bitmaps, its metrics are:
--- ... Horizontal Line Metrics Ascender: 8 Descender: 8 ... ---
and this is a freetype snippet that calculates height from EBLC:
--- metrics->ascender = (FT_Char)strike[16] * 64; /* hori.ascender */ metrics->descender = (FT_Char)strike[17] * 64; /* hori.descender */ metrics->height = metrics->ascender - metrics->descender; ---
I'm not sure what's a best place to fix this yet.
https://bugs.winehq.org/show_bug.cgi?id=38762
--- Comment #7 from Nikolay Sivov bunglehead@gmail.com --- Situation's been improved on freetype side with http://git.savannah.gnu.org/cgit/freetype/freetype2.git/commit/?id=6f09011fe... and http://git.savannah.gnu.org/cgit/freetype/freetype2.git/commit/?id=07f27e1e4....
It should help not only this font but improve handling of broken strike metrics in general for fonts with EBLC/CBLC data. I'm not sure what to do with that report, because it seems we still want some workaround because of freetype upgrade lag. Also it's possible that we should rethink this scaling logic in general, as Windows 7 provides some fonts with even more broken metrics data apparently. Which means it's ignored completely or selectively.
https://bugs.winehq.org/show_bug.cgi?id=38762
--- Comment #8 from Nikolay Sivov bunglehead@gmail.com --- (In reply to Nikolay Sivov from comment #7)
Situation's been improved on freetype side with http://git.savannah.gnu.org/cgit/freetype/freetype2.git/commit/ ?id=6f09011fe61638392cdc982af97447e579a7a69d and http://git.savannah.gnu.org/cgit/freetype/freetype2.git/commit/ ?id=07f27e1e43a63f611e3f0248a488fb891440fff2.
For the record, freetype 2.6.2 is first release to contain these changes.
https://bugs.winehq.org/show_bug.cgi?id=38762
jre.winesim@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |jre.winesim@gmail.com
https://bugs.winehq.org/show_bug.cgi?id=38762
Nikolay Sivov bunglehead@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Severity|normal |enhancement
https://bugs.winehq.org/show_bug.cgi?id=38762
--- Comment #9 from Jens Reyer jre.winesim@gmail.com --- Created attachment 55650 --> https://bugs.winehq.org/attachment.cgi?id=55650 avoid divide-by-zero condition for certain font files and warn about it
(In reply to Nikolay Sivov from comment #6)
I'm not sure what's a best place to fix this yet.
Me neither, but in Debian we have attached patch since 1.7.46. It's quite similar to your test patch, just placed 6 lines later in the code (your patch applies to line 5710 today).
Or did you have something completely different in mind?
Is there any reason not to apply one of these patches which prevents division by zero?
https://bugs.winehq.org/show_bug.cgi?id=38762
--- Comment #10 from Nikolay Sivov bunglehead@gmail.com --- I think that it's better to ignore such fonts instead trying to fix their properties. If it's a font installed with an application (meaning it does install it on Windows, and it works there), and it's supposed to work we should test what windows does to make it usable. If it's a host system font it's easier and safer to ignore it.