From 7c5074176c14d4aae5557f99c3b8a9372fbbed50 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Wed, 15 Nov 2006 12:07:00 +0000 Subject: [PATCH] * Fix universal smushing. --- src/figlet.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/figlet.c b/src/figlet.c index f84b23f..5530337 100644 --- a/src/figlet.c +++ b/src/figlet.c @@ -124,8 +124,8 @@ static int feed_figlet(context_t *cx, uint32_t ch, uint32_t attr) if(cx->hlayout == H_SMUSH) { if(xleft < cx->x && - smush(cucul_get_char(cx->charcv, xright, y), - cucul_get_char(cx->cv, cx->x - 1 - xleft, cx->y + y), + smush(cucul_get_char(cx->cv, cx->x - 1 - xleft, cx->y + y), + cucul_get_char(cx->charcv, xright, y), 0)) xleft++; } @@ -375,7 +375,6 @@ static int open_font(context_t *cx) static uint32_t smush(uint32_t ch1, uint32_t ch2, unsigned int mode) { - /* Rule 1 */ if(ch1 == ch2 && ch1 != 0xa0) return ch2; @@ -391,6 +390,9 @@ static uint32_t smush(uint32_t ch1, uint32_t ch2, unsigned int mode) if(ch1 == '_' && strchr(rule2, ch2)) return ch2; + if(ch2 == '_' && strchr(rule2, ch1)) + return ch1; + /* Rule 3 */ if((tmp1 = strchr(rule3, ch1)) && (tmp2 = strchr(rule3, ch2))) {