From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ben North Newsgroups: gmane.emacs.devel Subject: Patch: overstrike/bold in Windows build Date: Thu, 26 Oct 2006 15:30:24 +0100 Message-ID: <1161873024.4540c680436eb@imp.hosting365.ie> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1161935836 4598 80.91.229.2 (27 Oct 2006 07:57:16 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 27 Oct 2006 07:57:16 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Oct 27 09:57:12 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GdMaR-0005FB-DW for ged-emacs-devel@m.gmane.org; Fri, 27 Oct 2006 09:57:07 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GdMaQ-0006Tz-KJ for ged-emacs-devel@m.gmane.org; Fri, 27 Oct 2006 03:57:06 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Gd6Fg-0004PZ-5h for emacs-devel@gnu.org; Thu, 26 Oct 2006 10:30:36 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Gd6FZ-0004Og-5g for emacs-devel@gnu.org; Thu, 26 Oct 2006 10:30:34 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Gd6FZ-0004Od-0u for emacs-devel@gnu.org; Thu, 26 Oct 2006 10:30:29 -0400 Original-Received: from [199.232.41.67] (helo=mx20.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1Gd6FY-0003pm-Pd for emacs-devel@gnu.org; Thu, 26 Oct 2006 10:30:29 -0400 Original-Received: from [82.195.128.192] (helo=web.hosting365.ie) by mx20.gnu.org with esmtp (Exim 4.52) id 1Gd6FW-0000jf-S7 for emacs-devel@gnu.org; Thu, 26 Oct 2006 10:30:27 -0400 Original-Received: from web.hosting365.ie (localhost [127.0.0.1]) by web.hosting365.ie (8.12.11.20060308/8.12.11) with ESMTP id k9QEUOTR017055 for ; Thu, 26 Oct 2006 15:30:24 +0100 Original-Received: (from httpd@localhost) by web.hosting365.ie (8.12.11.20060308/8.12.11/Submit) id k9QEUONJ017052 for emacs-devel@gnu.org; Thu, 26 Oct 2006 15:30:24 +0100 Original-Received: from mm3023.london1.eu.level3.net (mm3023.london1.eu.level3.net [212.187.194.10]) by imp.hosting365.ie (IMP) with HTTP for ; Thu, 26 Oct 2006 15:30:24 +0100 Original-To: emacs-devel@gnu.org User-Agent: Internet Messaging Program (IMP) 3.2.8 X-Originating-IP: 212.187.194.10 X-Mailman-Approved-At: Fri, 27 Oct 2006 03:55:57 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:61220 Archived-At: 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); } }