]> git.eshelyaron.com Git - emacs.git/commitdiff
(w32_native_per_char_metric): Swap width and rbearing
authorJason Rumney <jasonr@gnu.org>
Thu, 31 May 2007 00:59:50 +0000 (00:59 +0000)
committerJason Rumney <jasonr@gnu.org>
Thu, 31 May 2007 00:59:50 +0000 (00:59 +0000)
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.

src/w32term.c

index 604de982f5067ed1627f7a7a0f3200ba56970eb2..2d3969001d8d68bfd6d8b499e0b4c63f7c359d4c 100644 (file)
@@ -62,6 +62,7 @@ Boston, MA 02110-1301, USA.  */
 
 #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 @@ w32_native_per_char_metric (font, char2b, font_type, pcm)
 
       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 @@ x_draw_glyph_string_foreground (s)
 #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 @@ x_draw_glyph_string (s)
           && (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 @@ x_draw_glyph_string (s)
          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 @@ w32_initialize ()
       && SystemParametersInfo (SPI_GETFONTSMOOTHINGTYPE, 0, &smoothing_type, 0)
       && smoothing_type == FE_FONTSMOOTHINGCLEARTYPE;
   }
+
+#ifdef USE_FONT_BACKEND
+  w32font_initialize ();
+
+#endif
 }
 
 void