--- ray/src/rt/text.c 2016/03/22 03:56:17 2.27 +++ ray/src/rt/text.c 2024/12/03 19:36:58 2.30 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: text.c,v 2.27 2016/03/22 03:56:17 greg Exp $"; +static const char RCSid[] = "$Id: text.c,v 2.30 2024/12/03 19:36:58 greg Exp $"; #endif /* * text.c - functions for text patterns and mixtures. @@ -113,21 +113,22 @@ do_text( return(1); } } else if (m->otype == PAT_BTEXT) { - if (foreground) - scalecolor(r->pcol, m->oargs.farg[9]); - else - scalecolor(r->pcol, m->oargs.farg[10]); + if (foreground) { + scalescolor(r->pcol, m->oargs.farg[9]); + } else { + scalescolor(r->pcol, m->oargs.farg[10]); + } } else { /* PAT_CTEXT */ - COLOR cval; + SCOLOR scval; if (foreground) - setcolor(cval, m->oargs.farg[9], + setscolor(scval, m->oargs.farg[9], m->oargs.farg[10], m->oargs.farg[11]); else - setcolor(cval, m->oargs.farg[12], + setscolor(scval, m->oargs.farg[12], m->oargs.farg[13], m->oargs.farg[14]); - multcolor(r->pcol, cval); + smultscolor(r->pcol, scval); } return(0); } @@ -222,6 +223,8 @@ gettext( /* get text structure for material */ tlp->next = NULL; /* get the font */ t->f = getfont(tm->oargs.sarg[fndx(tm)]); + if (!t->f) + objerror(tm, USER, "font load error"); /* compute character spacing */ i = sndx(tm); d = i < tm->oargs.nfargs ? tm->oargs.farg[i] : 0.0; @@ -291,7 +294,7 @@ intext( /* check to see if p is in text glyph */ x *= 255.; h = x; i = y = DOT(v, tp->down); - if (x < 0.0 || y < 0.0) + if ((x < 0.0) | (y < 0.0)) return(0); x -= (double)h; y = ((i+1) - y)*255.; @@ -325,8 +328,8 @@ inglyph( /* (x,y) within font glyph gl? */ return(0); xlb = x; ylb = y; - if (gl->left > xlb || gl->right <= xlb || /* check extent */ - gl->bottom > ylb || gl->top <= ylb) + if ((gl->left > xlb) | (gl->right <= xlb) | /* check extent */ + (gl->bottom > ylb) | (gl->top <= ylb)) return(0); xlb = xlb<<1 | 1; /* add 1/2 to test points... */ ylb = ylb<<1 | 1; /* ...so no equal comparisons */