diff --git a/figlet.c b/figlet.c index d325c14..f582423 100644 --- a/figlet.c +++ b/figlet.c @@ -1424,7 +1424,7 @@ int smushamt() int addchar(c) inchr c; { - int smushamount,row,k; + int smushamount,row,k,column,offset; char *templine; getletter(c); @@ -1434,6 +1434,7 @@ inchr c; return 0; } + offset = 0; templine = (char*)myalloc(sizeof(char)*(outlinelenlimit+1)); for (row=0;row<charheight;row++) { if (right2left) { @@ -1447,8 +1448,13 @@ inchr c; } else { for (k=0;k<smushamount;k++) { - outputline[row][outlinelen-smushamount+k] = - smushem(outputline[row][outlinelen-smushamount+k],currchar[row][k]); + column = outlinelen-smushamount+k; + if (column < 0) { + offset = -column; + column = 0; + } + outputline[row][column] = + smushem(outputline[row][column],currchar[row][k + offset]); } strcat(outputline[row],currchar[row]+smushamount); }