* Fix universal smushing.

This commit is contained in:
Sam Hocevar 2006-11-15 12:07:00 +00:00 committed by sam
parent aefd454432
commit 7c5074176c

View file

@ -124,8 +124,8 @@ static int feed_figlet(context_t *cx, uint32_t ch, uint32_t attr)
if(cx->hlayout == H_SMUSH) if(cx->hlayout == H_SMUSH)
{ {
if(xleft < cx->x && if(xleft < cx->x &&
smush(cucul_get_char(cx->charcv, xright, y), smush(cucul_get_char(cx->cv, cx->x - 1 - xleft, cx->y + y),
cucul_get_char(cx->cv, cx->x - 1 - xleft, cx->y + y), cucul_get_char(cx->charcv, xright, y),
0)) 0))
xleft++; 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) static uint32_t smush(uint32_t ch1, uint32_t ch2, unsigned int mode)
{ {
/* Rule 1 */ /* Rule 1 */
if(ch1 == ch2 && ch1 != 0xa0) if(ch1 == ch2 && ch1 != 0xa0)
return ch2; return ch2;
@ -391,6 +390,9 @@ static uint32_t smush(uint32_t ch1, uint32_t ch2, unsigned int mode)
if(ch1 == '_' && strchr(rule2, ch2)) if(ch1 == '_' && strchr(rule2, ch2))
return ch2; return ch2;
if(ch2 == '_' && strchr(rule2, ch1))
return ch1;
/* Rule 3 */ /* Rule 3 */
if((tmp1 = strchr(rule3, ch1)) && (tmp2 = strchr(rule3, ch2))) if((tmp1 = strchr(rule3, ch1)) && (tmp2 = strchr(rule3, ch2)))
{ {