From f65acc722bacbe7313fefb4e7be321b270252f92 Mon Sep 17 00:00:00 2001 From: "bstell%netscape.com" Date: Tue, 10 Jul 2001 01:36:32 +0000 Subject: [PATCH] bug 63831, r=ftang@netscape.com, sr=sfraser when measuring space glyph width use 8 bit space char with 8 bit font use 16 bit space char with 16 bit font --- gfx/src/gtk/nsFontMetricsGTK.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/gfx/src/gtk/nsFontMetricsGTK.cpp b/gfx/src/gtk/nsFontMetricsGTK.cpp index c8edf289b13..b112efb901f 100644 --- a/gfx/src/gtk/nsFontMetricsGTK.cpp +++ b/gfx/src/gtk/nsFontMetricsGTK.cpp @@ -1159,7 +1159,17 @@ void nsFontMetricsGTK::RealizeFont() // 56% of ascent, best guess for non-true type mXHeight = NSToCoordRound((float) fontInfo->ascent* f * 0.56f); - gint rawWidth = gdk_text_width(mWesternFont->GetGDKFont(), " ", 1); + gint rawWidth; + if ((fontInfo->min_byte1 == 0) && (fontInfo->max_byte1 == 0)) { + rawWidth = gdk_text_width(mWesternFont->GetGDKFont(), " ", 1); + } + else { + XChar2b _16bit_space; + _16bit_space.byte1 = 0; + _16bit_space.byte2 = ' '; + rawWidth = gdk_text_width(mWesternFont->GetGDKFont(), + (const char *)&_16bit_space, sizeof(_16bit_space)); + } mSpaceWidth = NSToCoordRound(rawWidth * f); unsigned long pr = 0;