changeset 90867:129b35b0274f

(w32_native_per_char_metric): Swap width and rbearing calculations for non-Truetype fonts. (x_draw_glyph_string): Sync with xterm.c. (x_draw_glyph_string_foreground) [USE_FONT_BACKEND]: Remove redundant code. (w32_initialize) [USE_FONT_BACKEND]: Call w32font_initialize.
author Jason Rumney <jasonr@gnu.org>
date Thu, 31 May 2007 00:59:50 +0000
parents 109057569e6e
children cda1d64776fb
files src/w32term.c
diffstat 1 files changed, 22 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/src/w32term.c	Thu May 31 00:52:52 2007 +0000
+++ b/src/w32term.c	Thu May 31 00:59:50 2007 +0000
@@ -62,6 +62,7 @@
 
 #ifdef USE_FONT_BACKEND
 #include "font.h"
+void w32font_initialize P_ ((void));
 #endif	/* USE_FONT_BACKEND */
 
 #define abs(x)	((x) < 0 ? -(x) : (x))
@@ -979,8 +980,8 @@
 
       if (retval)
 	{
-	  pcm->width = sz.cx - font->tm.tmOverhang;
-	  pcm->rbearing = sz.cx;
+	  pcm->width = sz.cx;
+	  pcm->rbearing = sz.cx + font->tm.tmOverhang;
 	  pcm->lbearing = 0;
 	  pcm->ascent = FONT_BASE (font);
 	  pcm->descent = FONT_DESCENT (font);
@@ -1836,14 +1837,10 @@
 #ifdef USE_FONT_BACKEND
   else if (enable_font_backend)
     {
-      unsigned *code = alloca (sizeof (unsigned) * s->nchars);
       int boff = s->font_info->baseline_offset;
       struct font *font = (struct font *) s->font_info;
       int y;
 
-      for (i = 0; i < s->nchars; i++)
-	code[i] = (s->char2b[i].byte1 << 8) | s->char2b[i].byte2;
-
       if (s->font_info->vertical_centering)
 	boff = VCENTER_BASELINE_OFFSET (s->font, s->f) - boff;
 
@@ -2875,7 +2872,7 @@
           && (s->font->bdf || !s->font->tm.tmUnderlined))
         {
           unsigned long h;
-          unsigned long dy = 0;
+          int y;
 	  /* Get the underline thickness.  Default is 1 pixel.  */
 #ifdef USE_FONT_BACKEND
 	  if (enable_font_backend)
@@ -2897,28 +2894,29 @@
 	  else
 #endif
             {
-              if (x_underline_at_descent_line)
-                dy = s->height - h;
-              else
+                y = s->y + s->height - h;
+                /* TODO: Use font information for positioning and
+                   thickness of underline.  See OUTLINETEXTMETRIC,
+                   and xterm.c.  Note: If you make this work,
+                   don't forget to change the doc string of
+                   x-use-underline_color-position-properties
+                   below.  */
+#if 0
+              if (!x_underline_at_descent_line)
                 {
-                  /* TODO: Use font information for positioning and
-                     thickness of underline.  See OUTLINETEXTMETRIC,
-                     and xterm.c.  Note: If you makedev this work,
-                     don't forget to change the doc string of
-                     x-use-underline_color-position-properties
-                     below.  */
-                  dy = s->height - h;
+                  ...
                 }
+#endif
             }
           if (s->face->underline_defaulted_p)
             {
               w32_fill_area (s->f, s->hdc, s->gc->foreground, s->x,
-                             s->y + dy, s->background_width, 1);
+                             y, s->background_width, 1);
             }
           else
             {
               w32_fill_area (s->f, s->hdc, s->face->underline_color, s->x,
-                             s->y + dy, s->background_width, 1);
+                             y, s->background_width, 1);
             }
         }
       /* Draw overline.  */
@@ -7002,6 +7000,11 @@
       && SystemParametersInfo (SPI_GETFONTSMOOTHINGTYPE, 0, &smoothing_type, 0)
       && smoothing_type == FE_FONTSMOOTHINGCLEARTYPE;
   }
+
+#ifdef USE_FONT_BACKEND
+  w32font_initialize ();
+
+#endif
 }
 
 void