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: Re: Patch: overstrike/bold in Windows build Date: Fri, 27 Oct 2006 17:59:45 +0100 Message-ID: <1161968385.45423b01109f0@imp.hosting365.ie> References: <1161873024.4540c680436eb@imp.hosting365.ie> <1161939507.4541ca3376a11@imp.hosting365.ie> <1161950628.4541f5a41d35a@imp.hosting365.ie> <1161959923.454219f3585f2@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 1162029148 26225 80.91.229.2 (28 Oct 2006 09:52:28 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 28 Oct 2006 09:52:28 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Oct 28 11:52:23 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 1GdkrQ-0003d2-Nc for ged-emacs-devel@m.gmane.org; Sat, 28 Oct 2006 11:52:17 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GdkrQ-00031y-4z for ged-emacs-devel@m.gmane.org; Sat, 28 Oct 2006 05:52:16 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GdV3j-0006X6-Lt for emacs-devel@gnu.org; Fri, 27 Oct 2006 12:59:55 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GdV3e-0006Rp-5g for emacs-devel@gnu.org; Fri, 27 Oct 2006 12:59:54 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GdV3d-0006RT-Hx for emacs-devel@gnu.org; Fri, 27 Oct 2006 12:59:49 -0400 Original-Received: from [82.195.128.192] (helo=web.hosting365.ie) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1GdV3d-0005pI-Df for emacs-devel@gnu.org; Fri, 27 Oct 2006 12:59:49 -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 k9RGxj0F024127; Fri, 27 Oct 2006 17:59:45 +0100 Original-Received: (from httpd@localhost) by web.hosting365.ie (8.12.11.20060308/8.12.11/Submit) id k9RGxjCG024125; Fri, 27 Oct 2006 17:59:45 +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 ; Fri, 27 Oct 2006 17:59:45 +0100 Original-To: Juanma Barranquero In-Reply-To: User-Agent: Internet Messaging Program (IMP) 3.2.8 X-Originating-IP: 212.187.194.10 X-Mailman-Approved-At: Sat, 28 Oct 2006 05:45:56 -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:61275 Archived-At: Juanma Barranquero wrote: > On 10/27/06, Ben North wrote: > > It looks like my patch is correct, then, but that > > it's revealing a problem elsewhere, i.e., in the code > > that decides when "synthetic" bold is required? > > Isn't it nice, when fixing a bug reveals another? :) Hmm. Very curious. The code which decides whether overstriking is necessary is in xfaces.c, around line 6689. The logic is: if (want_weight > XLFD_WEIGHT_MEDIUM && want_weight > got_weight) { /* We want a bold font, but didn't get one; try to use overstriking instead to simulate bold-face. However, don't overstrike an already-bold fontn unless the desired weight grossly exceeds the available weight. */ if (got_weight > XLFD_WEIGHT_MEDIUM) *needs_overstrike = (got_weight - want_weight) > 2; else *needs_overstrike = 1; } but the outer "if" means that we only get inside if got_weight < want_weight, and in that case, the value of (got_weight - want_weight) depends on whether your compiler represents the enum as signed or unsigned. The test code #include int main(int argc, char **argv) { enum E { E1, E2 }; enum E e1 = E1, e2 = E2; if (e1 - e2 > 2) printf("yes\n"); else printf("no\n"); } produces "yes" when compiled with gcc, but "no" when compiled with MSVC's "cl". In any case, the comment suggests that subtraction is the wrong way round. I suspect you must be building with gcc, to get the incorrect overstrike behaviour? I'm building with MSVC so don't see it. Could you try swapping the subtraction round, as in this patch? (Also fixes typo in comment.) --- ORIG/xfaces.c +++ xfaces.c 2006-10-27 17:57:43.034173200 +0100 @@ -6688,10 +6688,10 @@ { /* We want a bold font, but didn't get one; try to use overstriking instead to simulate bold-face. However, - don't overstrike an already-bold fontn unless the + don't overstrike an already-bold font unless the desired weight grossly exceeds the available weight. */ if (got_weight > XLFD_WEIGHT_MEDIUM) - *needs_overstrike = (got_weight - want_weight) > 2; + *needs_overstrike = (want_weight - got_weight) > 2; else *needs_overstrike = 1; }