On 05/04/2013 08:27 PM, Max TenEyck Woodbury wrote:
OK. Let's summarize:
There are some fonts where tmHeight is in fact 0. If Hin-Tak Leang is
correct, these may be Open-Source fonts possibly with proprietary
equivalents. Since I have hundreds of fonts installed on my system, it
is almost certain that I have one or more. Identifying which without
support in wine is a large task, not to be undertaken lightly.
Let's try to fully understand this problem and identify a font that
causes the issue. Since you already have one installed in your font
library, you could just run the tests with the attached patch applied
and make quick work of identifying the troublesome font. Maybe
(hopefully) it's an easy font to obtain so all of us can get a better
look at what's going on.
I'm going to *guess* that tmHeight being 0 is the actual problem, but we
won't know until we try the same font on Windows and see what Windows
does. If Windows also produces tmHeight=0, then this patch makes perfect
sense.
If Windows gives a non-zero tmHeight under the same circumstances, then
we know the problem is in the font loader, and we'll fix that instead,
thus making this patch unnecessary because tmHeight will always be
nonzero anyway.
>From f5dc537a3799b9c4507cb0c8aefcc4ee73d2a0b5 Mon Sep 17 00:00:00 2001
From: Sam Edwards <cfswo...@gmail.com>
Date: Sat, 4 May 2013 21:58:19 -0600
Subject: gdi32: [HACK] Print which font is causing division-by-zero problems.
---
dlls/gdi32/freetype.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
index c30a358..2547092 100644
--- a/dlls/gdi32/freetype.c
+++ b/dlls/gdi32/freetype.c
@@ -6772,6 +6772,12 @@ static BOOL get_text_metrics(GdiFont *font, LPTEXTMETRICW ptm)
{
if (!get_outline_text_metrics(font) && !get_bitmap_text_metrics(font)) return FALSE;
+ /* HACKHACK: If a font has tmHeight=0, let us know. */
+ if (!font->potm->otmTextMetrics.tmHeight)
+ {
+ ERR("Font named '%s' has tmHeight=0, aveWidth=%d!\n", font->ft_face->family_name, font->aveWidth);
+ }
+
/* Make sure that the font has sane width/height ratio */
if (font->aveWidth)
{
--
1.7.10.4