emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Patch: overstrike/bold in Windows build


From: Ben North
Subject: Patch: overstrike/bold in Windows build
Date: Thu, 26 Oct 2006 15:30:24 +0100
User-agent: Internet Messaging Program (IMP) 3.2.8

The patch below fixed a problem I've noticed with a recent Windows build
of emacs (first noticed in the binary distribution from

   http://ourcomments.org/Emacs/EmacsW32.html

but, if I'm using arch correctly, also present in the latest CVS/arch
code).

When overstriking to simulate a bold font, the display is often/usually
slightly garbled.  The first character of an output string then gets its
leftmost column doubled, but the rest just shifts rightwards one pixel.
The patch fixes this for me, and the setting/resetting of the background
mode does not seem too expensive.  It's possible that the save/restore
is unnecessary because SetBkMode() seems to be called everywhere it
matters, so the patch could perhaps be simplified to the second version,
which also seems to work for me.  Somebody who knows the code better
would be able to tell.

Reproduction of the problem might be tricky since it relies on a
particular font set-up.  The problem does not appear in a build for the
X windowing system, and the patch below changes the logic in w32term.c
so that it seems to mirror what happens in xterm.c, with regard to
handling of the 'for_overlaps' field, so I think it's right.

Ben.


---- first version of patch, with save/restore of background mode ----

--- ORIG/w32term.c
+++ w32term.c   2006-10-26 15:24:52.005290300 +0100
@@ -1591,7 +1591,10 @@
         {
           /* For overstriking (to simulate bold-face), draw the
              characters again shifted to the right by one pixel.  */
+          int old_BkMode = GetBkMode (s->hdc);
+          SetBkMode (s->hdc, TRANSPARENT);
           w32_text_out (s, x + 1, s->ybase - boff, s->char2b, s->nchars);
+          SetBkMode (s->hdc, old_BkMode);
         }
     }
   if (s->font && s->font->hfont)


---- second version of patch, without save/restore of background mode ----

--- ORIG/w32term.c
+++ w32term.c   2006-10-26 15:24:20.439586300 +0100
@@ -1591,6 +1591,7 @@
         {
           /* For overstriking (to simulate bold-face), draw the
              characters again shifted to the right by one pixel.  */
+          SetBkMode (s->hdc, TRANSPARENT);
           w32_text_out (s, x + 1, s->ybase - boff, s->char2b, s->nchars);
         }
     }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]