[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Patch: overstrike/bold in Windows build
From: |
Ben North |
Subject: |
Re: Patch: overstrike/bold in Windows build |
Date: |
Fri, 27 Oct 2006 17:59:45 +0100 |
User-agent: |
Internet Messaging Program (IMP) 3.2.8 |
Juanma Barranquero <address@hidden> wrote:
> On 10/27/06, Ben North <address@hidden> 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;
}
- Patch: overstrike/bold in Windows build, Ben North, 2006/10/27
- Re: Patch: overstrike/bold in Windows build, Juanma Barranquero, 2006/10/27
- Re: Patch: overstrike/bold in Windows build, Ben North, 2006/10/28
- Re: Patch: overstrike/bold in Windows build, Juanma Barranquero, 2006/10/27
- Re: Patch: overstrike/bold in Windows build, Ben North, 2006/10/28
- Re: Patch: overstrike/bold in Windows build, Juanma Barranquero, 2006/10/27
- Re: Patch: overstrike/bold in Windows build, Ben North, 2006/10/28
- Re: Patch: overstrike/bold in Windows build, Juanma Barranquero, 2006/10/27
- Re: Patch: overstrike/bold in Windows build,
Ben North <=
- Re: Patch: overstrike/bold in Windows build, Juanma Barranquero, 2006/10/27