From: Ben North <ben@redfrontdoor.org>
Cc: emacs-devel@gnu.org
Subject: Re: Patch: overstrike/bold in Windows build
Date: Fri, 27 Oct 2006 17:59:45 +0100 [thread overview]
Message-ID: <1161968385.45423b01109f0@imp.hosting365.ie> (raw)
In-Reply-To: <f7ccd24b0610270801ia8a6cdei6ce5c0016e2c724d@mail.gmail.com>
Juanma Barranquero <lekktu@gmail.com> wrote:
> On 10/27/06, Ben North <ben@redfrontdoor.org> 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 <stdio.h>
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;
}
next prev parent reply other threads:[~2006-10-27 16:59 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2006-10-27 17:15 ` Juanma Barranquero
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1161968385.45423b01109f0@imp.hosting365.ie \
--to=ben@redfrontdoor.org \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.