all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Patch: overstrike/bold in Windows build
@ 2006-10-26 14:30 Ben North
  2006-10-27  8:44 ` Juanma Barranquero
  0 siblings, 1 reply; 10+ messages in thread
From: Ben North @ 2006-10-26 14:30 UTC (permalink / raw)


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);
         }
     }

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

end of thread, other threads:[~2006-10-27 17:15 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-26 14:30 Patch: overstrike/bold in Windows build Ben North
2006-10-27  8:44 ` Juanma Barranquero
2006-10-27  8:58   ` Ben North
2006-10-27 10:46     ` Juanma Barranquero
2006-10-27 12:03       ` Ben North
2006-10-27 14:02         ` Juanma Barranquero
2006-10-27 14:38           ` Ben North
2006-10-27 15:01             ` Juanma Barranquero
2006-10-27 16:59               ` Ben North
2006-10-27 17:15                 ` Juanma Barranquero

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.