unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* Emacs 22.1 Windows ClearType Support
@ 2007-11-22 15:51 Ng, Andrew
  2007-11-22 21:43 ` Juanma Barranquero
  0 siblings, 1 reply; 4+ messages in thread
From: Ng, Andrew @ 2007-11-22 15:51 UTC (permalink / raw)
  To: bug-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 585 bytes --]

I have been having a go at fixing up the issues related to ClearType in
Emacs 22.1.

I think I have pretty much sorted out the major issues and everything
appears to work fine now. I've tried as much as possible not to alter
the non-ClearType code path.

I've also added an environment variable "EMACS_CLEARTYPE". If present
this will disable ClearType if its value is 0 and will enable ClearType
if its value is non-zero. Otherwise, ClearType is enabled according to
the system settings.

I've attached a patch file for my changes.

Thank you.

Regards,

Andrew Ng

[-- Attachment #2: patchfile --]
[-- Type: application/octet-stream, Size: 6194 bytes --]

diff -u emacs-22.1-orig/src/dispnew.c emacs-22.1/src/dispnew.c
--- emacs-22.1-orig/src/dispnew.c	2007-04-16 17:21:18.000000000 +0100
+++ emacs-22.1/src/dispnew.c	2007-11-22 14:26:44.187500000 +0000
@@ -4523,8 +4523,8 @@
 	      if (overlapping_glyphs_p
 		  && i > 0
 		  && i < current_row->used[TEXT_AREA]
-		  && (current_row->used[TEXT_AREA]
-		      != desired_row->used[TEXT_AREA]))
+		  /*&& (current_row->used[TEXT_AREA]
+		      != desired_row->used[TEXT_AREA])*/)
 		{
 		  int left, right;
 
diff -u emacs-22.1-orig/src/w32fns.c emacs-22.1/src/w32fns.c
--- emacs-22.1-orig/src/w32fns.c	2007-03-24 15:49:48.000000000 +0000
+++ emacs-22.1/src/w32fns.c	2007-11-20 10:03:13.171875000 +0000
@@ -4546,6 +4546,8 @@
     int codepage;
     int i;
 
+    const char *env;
+
     if (!fontname || !x_to_w32_font (fontname, &lf))
       return (NULL);
 
@@ -4557,7 +4559,12 @@
            ended up with. */
       return NULL;
 
-    lf.lfQuality = DEFAULT_QUALITY;
+#ifndef CLEARTYPE_QUALITY
+#define CLEARTYPE_QUALITY 5
+#endif
+
+    env = getenv("EMACS_CLEARTYPE");
+    lf.lfQuality = env ? ((atoi(env) != 0) ? CLEARTYPE_QUALITY : ANTIALIASED_QUALITY) : DEFAULT_QUALITY;
 
     font = (XFontStruct *) xmalloc (sizeof (XFontStruct));
     bzero (font, sizeof (*font));
diff -u emacs-22.1-orig/src/w32term.c emacs-22.1/src/w32term.c
--- emacs-22.1-orig/src/w32term.c	2007-02-19 14:45:39.000000000 +0000
+++ emacs-22.1/src/w32term.c	2007-11-21 12:52:00.953125000 +0000
@@ -903,7 +903,7 @@
 #endif
 	  if (cleartype_active)
 	    {
-	      /* Cleartype antialiasing causes characters to overhang
+	      /* Cleartype antialiasing can cause characters to overhang
 		 by a pixel on each side compared with what GetCharABCWidths
 		 reports.  */
 	      char_widths.abcA -= 1;
@@ -1041,7 +1041,8 @@
       if (((font->tm.tmPitchAndFamily & TMPF_FIXED_PITCH) != 0)
           /* Some fonts (eg DBCS fonts) are marked as fixed width even
              though they contain characters of different widths. */
-          || (font->tm.tmMaxCharWidth != font->tm.tmAveCharWidth))
+          || (font->tm.tmMaxCharWidth != font->tm.tmAveCharWidth)
+          || cleartype_active)
 	{
 	  /* Font is not fixed pitch, so cache per_char info for the
              ASCII characters.  It would be much more work, and probably
@@ -1437,9 +1438,42 @@
 w32_compute_glyph_string_overhangs (s)
      struct glyph_string *s;
 {
-  /* TODO: Windows does not appear to have a method for
-     getting this info without getting the ABC widths for each
-     individual character and working it out manually. */
+  if (s->cmp == NULL
+      && s->first_glyph->type == CHAR_GLYPH
+      && s->nchars > 0)
+    {
+      XFontStruct *font = s->font;
+      const int    font_type = s->first_glyph->font_type;
+
+      wchar_t  *ws = s->char2b;
+      const int nc = s->nchars;
+      int       i, pos, mn, mx;
+      if (nc == 1)
+        {
+          XCharStruct *pcm = w32_per_char_metric (font, ws, font_type);
+
+          s->right_overhang = pcm->rbearing > pcm->width ? pcm->rbearing - pcm->width : 0;
+          s->left_overhang  = pcm->lbearing < 0 ? -pcm->lbearing : 0;
+          return;
+        }
+
+      pos = mn = mx = 0;
+      for (i = 0; i < nc; ++i, ++ws)
+        {
+          XCharStruct *pcm = w32_per_char_metric (font, ws, font_type);
+
+          const int rp = pos + pcm->rbearing;
+          const int lp = pos + pcm->lbearing;
+
+          if (rp > mx) mx = rp;
+          if (lp < mn) mn = lp;
+
+          pos += pcm->width;
+        }
+
+      s->right_overhang = mx > pos ? mx - pos : 0;
+      s->left_overhang  = mn < 0 ? -mn : 0;
+    }
 }
 
 
@@ -1536,7 +1570,7 @@
 x_draw_glyph_string_foreground (s)
      struct glyph_string *s;
 {
-  int i, x;
+  int i, x, ct_clear = 0;
   HFONT old_font;
 
   /* If first glyph of S has a left box line, start drawing the text
@@ -1550,7 +1584,15 @@
   if (s->for_overlaps || (s->background_filled_p && s->hl != DRAW_CURSOR))
     SetBkMode (s->hdc, TRANSPARENT);
   else
-    SetBkMode (s->hdc, OPAQUE);
+  {
+    if (cleartype_active)
+      {
+        ct_clear = 1;
+        SetBkMode (s->hdc, TRANSPARENT);
+      }
+    else
+      SetBkMode (s->hdc, OPAQUE);
+  }
 
   SetTextColor (s->hdc, s->gc->foreground);
   SetBkColor (s->hdc, s->gc->background);
@@ -1586,6 +1628,21 @@
           char1b[i] = XCHAR2B_BYTE2 (&s->char2b[i]);
 
       /* Draw text with TextOut and friends. */
+      if (ct_clear)
+        {
+          HBRUSH hb;
+          RECT   r;
+
+          r.left = x;
+          r.top  = s->y;
+          r.right  = x + s->background_width;
+          r.bottom = s->y + s->height;
+
+          hb = CreateSolidBrush (s->gc->background);
+          FillRect (s->hdc, &r, hb);
+          DeleteObject (hb);
+        }
+
       w32_text_out (s, x, s->ybase - boff, s->char2b, s->nchars);
 
       if (s->face->overstrike)
@@ -6336,7 +6393,7 @@
   w32_destroy_fringe_bitmap,
   w32_per_char_metric,
   w32_encode_char,
-  NULL, /* w32_compute_glyph_string_overhangs */
+  w32_compute_glyph_string_overhangs,
   x_draw_glyph_string,
   w32_define_frame_cursor,
   w32_clear_frame_area,
@@ -6434,6 +6491,8 @@
     UINT smoothing_type;
     BOOL smoothing_enabled;
 
+    const char *env;
+
     /* If using proportional scroll bars, ensure handle is at least 5 pixels;
        otherwise use the fixed height.  */
     vertical_scroll_bar_min_handle = 5;
@@ -6459,11 +6518,13 @@
        the char metric calculations which adds extra pixels to
        compensate for the "sub-pixels" that are not counted by the
        system APIs. */
+    env = getenv("EMACS_CLEARTYPE");
     cleartype_active =
-      SystemParametersInfo (SPI_GETFONTSMOOTHING, 0, &smoothing_enabled, 0)
-      && smoothing_enabled
-      && SystemParametersInfo (SPI_GETFONTSMOOTHINGTYPE, 0, &smoothing_type, 0)
-      && smoothing_type == FE_FONTSMOOTHINGCLEARTYPE;
+      env ? (atoi(env) != 0) :
+        (SystemParametersInfo (SPI_GETFONTSMOOTHING, 0, &smoothing_enabled, 0)
+         && smoothing_enabled
+         && SystemParametersInfo (SPI_GETFONTSMOOTHINGTYPE, 0, &smoothing_type, 0)
+         && smoothing_type == FE_FONTSMOOTHINGCLEARTYPE);
   }
 }
 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Emacs 22.1 Windows ClearType Support
  2007-11-22 15:51 Emacs 22.1 Windows ClearType Support Ng, Andrew
@ 2007-11-22 21:43 ` Juanma Barranquero
  2007-11-22 21:58   ` Jason Rumney
  0 siblings, 1 reply; 4+ messages in thread
From: Juanma Barranquero @ 2007-11-22 21:43 UTC (permalink / raw)
  To: Ng, Andrew; +Cc: bug-gnu-emacs, Emacs Devel

On Nov 22, 2007 4:51 PM, Ng, Andrew <anng@ptc.com> wrote:

> I have been having a go at fixing up the issues related to ClearType in
> Emacs 22.1.
>
> I think I have pretty much sorted out the major issues and everything
> appears to work fine now. I've tried as much as possible not to alter
> the non-ClearType code path.
>
> I've also added an environment variable "EMACS_CLEARTYPE". If present
> this will disable ClearType if its value is 0 and will enable ClearType
> if its value is non-zero. Otherwise, ClearType is enabled according to
> the system settings.
>
> I've attached a patch file for my changes.
>
> Thank you.
>
> Regards,
>
> Andrew Ng

Here's the patch, adapted to the current trunk.

             Juanma


Index: src/dispnew.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/dispnew.c,v
retrieving revision 1.398
diff -u -r1.398 dispnew.c
--- src/dispnew.c	21 Nov 2007 03:46:31 -0000	1.398
+++ src/dispnew.c	22 Nov 2007 21:27:53 -0000
@@ -4525,9 +4525,7 @@
 		 taken care of by draw_glyphs.  */
 	      if (overlapping_glyphs_p
 		  && i > 0
-		  && i < current_row->used[TEXT_AREA]
-		  && (current_row->used[TEXT_AREA]
-		      != desired_row->used[TEXT_AREA]))
+		  && i < current_row->used[TEXT_AREA])
 		{
 		  int left, right;

Index: src/w32fns.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/w32fns.c,v
retrieving revision 1.307
diff -u -r1.307 w32fns.c
--- src/w32fns.c	14 Nov 2007 17:33:36 -0000	1.307
+++ src/w32fns.c	22 Nov 2007 21:23:32 -0000
@@ -4571,6 +4571,8 @@
     int codepage;
     int i;

+    const char *env;
+
     if (!fontname || !x_to_w32_font (fontname, &lf))
       return (NULL);

@@ -4582,7 +4584,12 @@
            ended up with. */
       return NULL;

-    lf.lfQuality = DEFAULT_QUALITY;
+#ifndef CLEARTYPE_QUALITY
+#define CLEARTYPE_QUALITY 5
+#endif
+
+    env = getenv ("EMACS_CLEARTYPE");
+    lf.lfQuality = env ? (atoi (env) ? CLEARTYPE_QUALITY :
ANTIALIASED_QUALITY) : DEFAULT_QUALITY;

     font = (XFontStruct *) xmalloc (sizeof (XFontStruct));
     bzero (font, sizeof (*font));
Index: src/w32term.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/w32term.c,v
retrieving revision 1.276
diff -u -r1.276 w32term.c
--- src/w32term.c	9 Nov 2007 12:19:55 -0000	1.276
+++ src/w32term.c	22 Nov 2007 21:33:15 -0000
@@ -948,7 +948,7 @@
 #endif
 	  if (cleartype_active)
 	    {
-	      /* Cleartype antialiasing causes characters to overhang
+	      /* Cleartype antialiasing can cause characters to overhang
 		 by a pixel on each side compared with what GetCharABCWidths
 		 reports.  */
 	      char_widths.abcA -= 1;
@@ -1086,7 +1086,8 @@
       if (((font->tm.tmPitchAndFamily & TMPF_FIXED_PITCH) != 0)
           /* Some fonts (eg DBCS fonts) are marked as fixed width even
              though they contain characters of different widths. */
-          || (font->tm.tmMaxCharWidth != font->tm.tmAveCharWidth))
+          || (font->tm.tmMaxCharWidth != font->tm.tmAveCharWidth)
+          || cleartype_active)
 	{
 	  /* Font is not fixed pitch, so cache per_char info for the
              ASCII characters.  It would be much more work, and probably
@@ -1483,9 +1484,42 @@
 w32_compute_glyph_string_overhangs (s)
      struct glyph_string *s;
 {
-  /* TODO: Windows does not appear to have a method for
-     getting this info without getting the ABC widths for each
-     individual character and working it out manually. */
+  if (s->cmp == NULL
+      && s->first_glyph->type == CHAR_GLYPH
+      && s->nchars > 0)
+    {
+      XFontStruct *font = s->font;
+      const int    font_type = s->first_glyph->font_type;
+
+      wchar_t  *ws = s->char2b;
+      const int nc = s->nchars;
+      int       i, pos, mn, mx;
+      if (nc == 1)
+        {
+          XCharStruct *pcm = w32_per_char_metric (font, ws, font_type);
+
+          s->right_overhang = pcm->rbearing > pcm->width ?
pcm->rbearing - pcm->width : 0;
+          s->left_overhang  = pcm->lbearing < 0 ? -pcm->lbearing : 0;
+          return;
+        }
+
+      pos = mn = mx = 0;
+      for (i = 0; i < nc; ++i, ++ws)
+        {
+          XCharStruct *pcm = w32_per_char_metric (font, ws, font_type);
+
+          const int rp = pos + pcm->rbearing;
+          const int lp = pos + pcm->lbearing;
+
+          if (rp > mx) mx = rp;
+          if (lp < mn) mn = lp;
+
+          pos += pcm->width;
+        }
+
+      s->right_overhang = mx > pos ? mx - pos : 0;
+      s->left_overhang  = mn < 0 ? -mn : 0;
+    }
 }


@@ -1582,7 +1616,7 @@
 x_draw_glyph_string_foreground (s)
      struct glyph_string *s;
 {
-  int i, x;
+  int i, x, ct_clear = 0;
   HFONT old_font;

   /* If first glyph of S has a left box line, start drawing the text
@@ -1595,6 +1629,11 @@

   if (s->for_overlaps || (s->background_filled_p && s->hl != DRAW_CURSOR))
     SetBkMode (s->hdc, TRANSPARENT);
+  else if (cleartype_active)
+    {
+      ct_clear = 1;
+      SetBkMode (s->hdc, TRANSPARENT);
+    }
   else
     SetBkMode (s->hdc, OPAQUE);

@@ -1632,6 +1671,21 @@
           char1b[i] = XCHAR2B_BYTE2 (&s->char2b[i]);

       /* Draw text with TextOut and friends. */
+      if (ct_clear)
+        {
+          HBRUSH hb;
+          RECT   r;
+
+          r.left = x;
+          r.top  = s->y;
+          r.right  = x + s->background_width;
+          r.bottom = s->y + s->height;
+
+          hb = CreateSolidBrush (s->gc->background);
+          FillRect (s->hdc, &r, hb);
+          DeleteObject (hb);
+        }
+
       w32_text_out (s, x, s->ybase - boff, s->char2b, s->nchars);

       if (s->face->overstrike)
@@ -6292,7 +6346,7 @@
   w32_destroy_fringe_bitmap,
   w32_per_char_metric,
   w32_encode_char,
-  NULL, /* w32_compute_glyph_string_overhangs */
+  w32_compute_glyph_string_overhangs,
   x_draw_glyph_string,
   w32_define_frame_cursor,
   w32_clear_frame_area,
@@ -6592,6 +6646,8 @@
     UINT smoothing_type;
     BOOL smoothing_enabled;

+    const char *env;
+
     /* If using proportional scroll bars, ensure handle is at least 5 pixels;
        otherwise use the fixed height.  */
     vertical_scroll_bar_min_handle = 5;
@@ -6617,11 +6673,13 @@
        the char metric calculations which adds extra pixels to
        compensate for the "sub-pixels" that are not counted by the
        system APIs. */
+    env = getenv ("EMACS_CLEARTYPE");
     cleartype_active =
-      SystemParametersInfo (SPI_GETFONTSMOOTHING, 0, &smoothing_enabled, 0)
-      && smoothing_enabled
-      && SystemParametersInfo (SPI_GETFONTSMOOTHINGTYPE, 0, &smoothing_type, 0)
-      && smoothing_type == FE_FONTSMOOTHINGCLEARTYPE;
+      env ? (atoi (env) != 0) :
+      (SystemParametersInfo (SPI_GETFONTSMOOTHING, 0, &smoothing_enabled, 0)
+       && smoothing_enabled
+       && SystemParametersInfo (SPI_GETFONTSMOOTHINGTYPE, 0,
&smoothing_type, 0)
+       && smoothing_type == FE_FONTSMOOTHINGCLEARTYPE);
   }
 }




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Emacs 22.1 Windows ClearType Support
  2007-11-22 21:43 ` Juanma Barranquero
@ 2007-11-22 21:58   ` Jason Rumney
  2007-11-22 22:07     ` Juanma Barranquero
  0 siblings, 1 reply; 4+ messages in thread
From: Jason Rumney @ 2007-11-22 21:58 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: bug-gnu-emacs, Ng, Andrew, Emacs Devel

Juanma Barranquero wrote:
> Here's the patch, adapted to the current trunk.
>   

Thanks, but we would want to install this in EMACS_22_RELEASE, or not at
all. When emacs-unicode-2 gets merged with the trunk, then there is a
completely new font backend which already has the Cleartype problems
mostly fixed (mostly, because the cursor is still being drawn with the
old font code, but that will be fixed before Emacs 23 is released).







^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Emacs 22.1 Windows ClearType Support
  2007-11-22 21:58   ` Jason Rumney
@ 2007-11-22 22:07     ` Juanma Barranquero
  0 siblings, 0 replies; 4+ messages in thread
From: Juanma Barranquero @ 2007-11-22 22:07 UTC (permalink / raw)
  To: Jason Rumney; +Cc: bug-gnu-emacs, Ng, Andrew, Emacs Devel

On Nov 22, 2007 10:58 PM, Jason Rumney <jasonr@gnu.org> wrote:

> Thanks, but we would want to install this in EMACS_22_RELEASE, or not at
> all.

OK; here's against EMACS_22_BASE.

             Juanma


Index: src/dispnew.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/dispnew.c,v
retrieving revision 1.392.2.1
diff -u -r1.392.2.1 dispnew.c
--- src/dispnew.c	25 Jul 2007 05:15:58 -0000	1.392.2.1
+++ src/dispnew.c	22 Nov 2007 22:00:45 -0000
@@ -4522,9 +4522,7 @@
 		 taken care of by draw_glyphs.  */
 	      if (overlapping_glyphs_p
 		  && i > 0
-		  && i < current_row->used[TEXT_AREA]
-		  && (current_row->used[TEXT_AREA]
-		      != desired_row->used[TEXT_AREA]))
+		  && i < current_row->used[TEXT_AREA])
 		{
 		  int left, right;

Index: src/w32fns.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/w32fns.c,v
retrieving revision 1.288.2.10
diff -u -r1.288.2.10 w32fns.c
--- src/w32fns.c	15 Nov 2007 09:33:33 -0000	1.288.2.10
+++ src/w32fns.c	22 Nov 2007 22:00:45 -0000
@@ -4545,6 +4545,8 @@
     int codepage;
     int i;

+    const char *env;
+
     if (!fontname || !x_to_w32_font (fontname, &lf))
       return (NULL);

@@ -4556,7 +4558,12 @@
            ended up with. */
       return NULL;

-    lf.lfQuality = DEFAULT_QUALITY;
+#ifndef CLEARTYPE_QUALITY
+#define CLEARTYPE_QUALITY 5
+#endif
+
+    env = getenv ("EMACS_CLEARTYPE");
+    lf.lfQuality = env ? (atoi (env) ? CLEARTYPE_QUALITY :
ANTIALIASED_QUALITY) : DEFAULT_QUALITY;

     font = (XFontStruct *) xmalloc (sizeof (XFontStruct));
     bzero (font, sizeof (*font));
Index: src/w32term.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/w32term.c,v
retrieving revision 1.259.2.6
diff -u -r1.259.2.6 w32term.c
--- src/w32term.c	1 Nov 2007 03:45:35 -0000	1.259.2.6
+++ src/w32term.c	22 Nov 2007 22:00:45 -0000
@@ -903,7 +903,7 @@
 #endif
 	  if (cleartype_active)
 	    {
-	      /* Cleartype antialiasing causes characters to overhang
+	      /* Cleartype antialiasing can cause characters to overhang
 		 by a pixel on each side compared with what GetCharABCWidths
 		 reports.  */
 	      char_widths.abcA -= 1;
@@ -1041,7 +1041,8 @@
       if (((font->tm.tmPitchAndFamily & TMPF_FIXED_PITCH) != 0)
           /* Some fonts (eg DBCS fonts) are marked as fixed width even
              though they contain characters of different widths. */
-          || (font->tm.tmMaxCharWidth != font->tm.tmAveCharWidth))
+          || (font->tm.tmMaxCharWidth != font->tm.tmAveCharWidth)
+          || cleartype_active)
 	{
 	  /* Font is not fixed pitch, so cache per_char info for the
              ASCII characters.  It would be much more work, and probably
@@ -1437,9 +1438,42 @@
 w32_compute_glyph_string_overhangs (s)
      struct glyph_string *s;
 {
-  /* TODO: Windows does not appear to have a method for
-     getting this info without getting the ABC widths for each
-     individual character and working it out manually. */
+  if (s->cmp == NULL
+      && s->first_glyph->type == CHAR_GLYPH
+      && s->nchars > 0)
+    {
+      XFontStruct *font = s->font;
+      const int    font_type = s->first_glyph->font_type;
+
+      wchar_t  *ws = s->char2b;
+      const int nc = s->nchars;
+      int       i, pos, mn, mx;
+      if (nc == 1)
+        {
+          XCharStruct *pcm = w32_per_char_metric (font, ws, font_type);
+
+          s->right_overhang = pcm->rbearing > pcm->width ?
pcm->rbearing - pcm->width : 0;
+          s->left_overhang  = pcm->lbearing < 0 ? -pcm->lbearing : 0;
+          return;
+        }
+
+      pos = mn = mx = 0;
+      for (i = 0; i < nc; ++i, ++ws)
+        {
+          XCharStruct *pcm = w32_per_char_metric (font, ws, font_type);
+
+          const int rp = pos + pcm->rbearing;
+          const int lp = pos + pcm->lbearing;
+
+          if (rp > mx) mx = rp;
+          if (lp < mn) mn = lp;
+
+          pos += pcm->width;
+        }
+
+      s->right_overhang = mx > pos ? mx - pos : 0;
+      s->left_overhang  = mn < 0 ? -mn : 0;
+    }
 }


@@ -1536,7 +1570,7 @@
 x_draw_glyph_string_foreground (s)
      struct glyph_string *s;
 {
-  int i, x;
+  int i, x, ct_clear = 0;
   HFONT old_font;

   /* If first glyph of S has a left box line, start drawing the text
@@ -1549,6 +1583,11 @@

   if (s->for_overlaps || (s->background_filled_p && s->hl != DRAW_CURSOR))
     SetBkMode (s->hdc, TRANSPARENT);
+  else if (cleartype_active)
+    {
+      ct_clear = 1;
+      SetBkMode (s->hdc, TRANSPARENT);
+    }
   else
     SetBkMode (s->hdc, OPAQUE);

@@ -1586,6 +1625,21 @@
           char1b[i] = XCHAR2B_BYTE2 (&s->char2b[i]);

       /* Draw text with TextOut and friends. */
+      if (ct_clear)
+        {
+          HBRUSH hb;
+          RECT   r;
+
+          r.left = x;
+          r.top  = s->y;
+          r.right  = x + s->background_width;
+          r.bottom = s->y + s->height;
+
+          hb = CreateSolidBrush (s->gc->background);
+          FillRect (s->hdc, &r, hb);
+          DeleteObject (hb);
+        }
+
       w32_text_out (s, x, s->ybase - boff, s->char2b, s->nchars);

       if (s->face->overstrike)
@@ -6357,7 +6411,7 @@
   w32_destroy_fringe_bitmap,
   w32_per_char_metric,
   w32_encode_char,
-  NULL, /* w32_compute_glyph_string_overhangs */
+  w32_compute_glyph_string_overhangs,
   x_draw_glyph_string,
   w32_define_frame_cursor,
   w32_clear_frame_area,
@@ -6455,6 +6509,8 @@
     UINT smoothing_type;
     BOOL smoothing_enabled;

+    const char *env;
+
     /* If using proportional scroll bars, ensure handle is at least 5 pixels;
        otherwise use the fixed height.  */
     vertical_scroll_bar_min_handle = 5;
@@ -6480,11 +6536,13 @@
        the char metric calculations which adds extra pixels to
        compensate for the "sub-pixels" that are not counted by the
        system APIs. */
+    env = getenv ("EMACS_CLEARTYPE");
     cleartype_active =
-      SystemParametersInfo (SPI_GETFONTSMOOTHING, 0, &smoothing_enabled, 0)
-      && smoothing_enabled
-      && SystemParametersInfo (SPI_GETFONTSMOOTHINGTYPE, 0, &smoothing_type, 0)
-      && smoothing_type == FE_FONTSMOOTHINGCLEARTYPE;
+      env ? (atoi (env) != 0) :
+      (SystemParametersInfo (SPI_GETFONTSMOOTHING, 0, &smoothing_enabled, 0)
+       && smoothing_enabled
+       && SystemParametersInfo (SPI_GETFONTSMOOTHINGTYPE, 0,
&smoothing_type, 0)
+       && smoothing_type == FE_FONTSMOOTHINGCLEARTYPE);
   }
 }




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-11-22 22:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-22 15:51 Emacs 22.1 Windows ClearType Support Ng, Andrew
2007-11-22 21:43 ` Juanma Barranquero
2007-11-22 21:58   ` Jason Rumney
2007-11-22 22:07     ` Juanma Barranquero

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).