ti = spans[i].items;
for (j = 0; j < spans[i].nitems; j++) {
- if (ti->font && (ti->font->size > 0))
+ if (ti->font && ti->font->size > 0)
tf.size = ti->font->size;
else
tf.size = finfo.size;
AF[0] = b.LL;
AF[2] = b.UR;
if (border > 1) {
- double delta = ((double) border) / 2.0;
+ double delta = (double)border / 2.0;
AF[0].x += delta;
AF[0].y += delta;
AF[2].x -= delta;
{
pointf AF[7];
char *sptr[2];
- char *color = (dp->pencolor ? dp->pencolor : DEFAULT_COLOR);
+ char *color = dp->pencolor ? dp->pencolor : DEFAULT_COLOR;
unsigned short sides;
gvrender_set_pencolor(job, color);
- if ((dp->style & (DASHED | DOTTED))) {
+ if (dp->style & (DASHED | DOTTED)) {
sptr[0] = sptr[1] = NULL;
if (dp->style & DASHED)
sptr[0] = "dashed";
}
} else {
if (dp->border > 1) {
- double delta = ((double) dp->border) / 2.0;
+ double delta = (double)dp->border / 2.0;
b.LL.x += delta;
b.LL.y += delta;
b.UR.x -= delta;
pts.UR.y += pos.y;
//Determine vertical line coordinate and length
- if ((cp->ruled & HTML_VRULE) && (cp->col + cp->cspan < cp->parent->cc)) {
+ if ((cp->ruled & HTML_VRULE) && cp->col + cp->cspan < cp->parent->cc) {
if (cp->row == 0) { // first row
// extend to center of table border and add half cell spacing
base = cp->parent->data.border + cp->parent->data.space / 2;
doSide(job, rule_pt, 0, rule_length);
}
//Determine the horizontal coordinate and length
- if ((cp->ruled & HTML_HRULE) && (cp->row + cp->rspan < cp->parent->rc)) {
+ if ((cp->ruled & HTML_HRULE) && cp->row + cp->rspan < cp->parent->rc) {
if (cp->col == 0) { // first column
// extend to center of table border and add half cell spacing
base = cp->parent->data.border + cp->parent->data.space / 2;
if (cp->col + cp->cspan == cp->parent->cc) // also last column
base *= 2;
/* incomplete row of cells; extend line to end */
- else if (nextc && (nextc->row != cp->row)) {
- base += (cp->parent->data.box.UR.x + pos.x) - (pts.UR.x + cp->parent->data.space / 2);
+ else if (nextc && nextc->row != cp->row) {
+ base += cp->parent->data.box.UR.x + pos.x - (pts.UR.x + cp->parent->data.space / 2);
}
} else if (cp->col + cp->cspan == cp->parent->cc) { // last column
// extend to center of table border and add half cell spacing
base = 0;
rule_pt.x = pts.LL.x - cp->parent->data.space / 2;
/* incomplete row of cells; extend line to end */
- if (nextc && (nextc->row != cp->row)) {
- base += (cp->parent->data.box.UR.x + pos.x) - (pts.UR.x + cp->parent->data.space / 2);
+ if (nextc && nextc->row != cp->row) {
+ base += cp->parent->data.box.UR.x + pos.x - (pts.UR.x + cp->parent->data.space / 2);
}
}
rule_pt.y = pts.LL.y - cp->parent->data.space / 2;
env.imgscale = agget(job->obj->u.n, "imagescale");
env.objid = job->obj->id;
env.objid_set = false;
- if ((env.imgscale == NULL) || (env.imgscale[0] == '\0'))
+ if (env.imgscale == NULL || env.imgscale[0] == '\0')
env.imgscale = "false";
if (lp->kind == HTML_TBL) {
htmltbl_t *tbl = lp->u.tbl;
{
htmldata_t *rv;
- if (cp->data.port && (strcasecmp(cp->data.port, id) == 0))
+ if (cp->data.port && strcasecmp(cp->data.port, id) == 0)
rv = &cp->data;
else if (cp->child.kind == HTML_TBL)
rv = portToTbl(cp->child.u.tbl, id);
htmlcell_t **cells;
htmlcell_t *cp;
- if (tp->data.port && (strcasecmp(tp->data.port, id) == 0))
+ if (tp->data.port && strcasecmp(tp->data.port, id) == 0)
rv = &tp->data;
else {
rv = NULL;
b.LL.x = b.LL.y = 0;
b.UR = gvusershape_size(env->g, img->src);
- if ((b.UR.x == -1) && (b.UR.y == -1)) {
+ if (b.UR.x == -1 && b.UR.y == -1) {
rv = 1;
b.UR.x = b.UR.y = 0;
agerr(AGERR, "No or improper image file=\"%s\"\n", img->src);
if (cp->data.flags & FIXED_FLAG) {
if (cp->data.width && cp->data.height) {
- if (((cp->data.width < sz.x) || (cp->data.height < sz.y)) && (cp->child.kind != HTML_IMAGE)) {
+ if ((cp->data.width < sz.x || cp->data.height < sz.y) && cp->child.kind != HTML_IMAGE) {
agerr(AGWARN, "cell size too small for content\n");
rv = 1;
}
#endif
/* Do the 1D cases by hand */
- if ((tbl->rc == 1) || (tbl->cc == 1)) {
+ if (tbl->rc == 1 || tbl->cc == 1) {
sizeLinearArray(tbl);
return;
}
/* If fixed, align cell */
if (cp->data.flags & FIXED_FLAG) {
oldsz = cp->data.box.UR;
- delx = (pos.UR.x - pos.LL.x) - oldsz.x;
+ delx = pos.UR.x - pos.LL.x - oldsz.x;
if (delx > 0) {
switch (cp->data.flags & HALIGN_MASK) {
case HALIGN_LEFT:
break;
}
}
- dely = (pos.UR.y - pos.LL.y) - oldsz.y;
+ dely = pos.UR.y - pos.LL.y - oldsz.y;
if (dely > 0) {
switch (cp->data.flags & VALIGN_MASK) {
case VALIGN_BOTTOM:
} else if (cp->child.kind == HTML_IMAGE) {
/* Note that alignment trumps scaling */
oldsz = cp->child.u.img->box.UR;
- delx = (cbox.UR.x - cbox.LL.x) - oldsz.x;
+ delx = cbox.UR.x - cbox.LL.x - oldsz.x;
if (delx > 0) {
switch (cp->data.flags & HALIGN_MASK) {
case HALIGN_LEFT:
}
}
- dely = (cbox.UR.y - cbox.LL.y) - oldsz.y;
+ dely = cbox.UR.y - cbox.LL.y - oldsz.y;
if (dely > 0) {
switch (cp->data.flags & VALIGN_MASK) {
case VALIGN_BOTTOM:
int af;
oldsz = cp->child.u.txt->box.UR;
- delx = (cbox.UR.x - cbox.LL.x) - oldsz.x;
+ delx = cbox.UR.x - cbox.LL.x - oldsz.x;
/* If the cell is larger than the text block and alignment is
* done at textblock level, the text box is shrunk accordingly.
*/
- if ((delx > 0)
- && ((af = (cp->data.flags & HALIGN_MASK)) != HALIGN_TEXT)) {
+ if (delx > 0 && (af = (cp->data.flags & HALIGN_MASK)) != HALIGN_TEXT) {
switch (af) {
case HALIGN_LEFT:
cbox.UR.x -= delx;
}
}
- dely = (cbox.UR.y - cbox.LL.y) - oldsz.y;
+ dely = cbox.UR.y - cbox.LL.y - oldsz.y;
if (dely > 0) {
switch (cp->data.flags & VALIGN_MASK) {
case VALIGN_BOTTOM:
tbl->data.pencolor = strdup(tbl->u.n.parent->data.pencolor);
oldsz = tbl->data.box.UR.x;
- delx = (pos.UR.x - pos.LL.x) - oldsz;
+ delx = pos.UR.x - pos.LL.x - oldsz;
assert(delx >= 0);
oldsz = tbl->data.box.UR.y;
- dely = (pos.UR.y - pos.LL.y) - oldsz;
+ dely = pos.UR.y - pos.LL.y - oldsz;
assert(dely >= 0);
/* If fixed, align box */
/* change sizes to start positions and distribute extra space */
x = pos.LL.x + tbl->data.border + tbl->data.space;
- extra = delx / (tbl->cc);
- plus = ROUND(delx - extra * (tbl->cc));
+ extra = delx / tbl->cc;
+ plus = ROUND(delx - extra * tbl->cc);
for (i = 0; i <= tbl->cc; i++) {
delx = tbl->widths[i] + extra + (i < plus ? 1 : 0);
tbl->widths[i] = x;
x += delx + tbl->data.space;
}
y = pos.UR.y - tbl->data.border - tbl->data.space;
- extra = dely / (tbl->rc);
- plus = ROUND(dely - extra * (tbl->rc));
+ extra = dely / tbl->rc;
+ plus = ROUND(dely - extra * tbl->rc);
for (i = 0; i <= tbl->rc; i++) {
dely = tbl->heights[i] + extra + (i < plus ? 1 : 0);
tbl->heights[i] = y;
if (tbl->data.flags & FIXED_FLAG) {
if (tbl->data.width && tbl->data.height) {
- if ((tbl->data.width < wd) || (tbl->data.height < ht)) {
+ if (tbl->data.width < wd || tbl->data.height < ht) {
agerr(AGWARN, "table size too small for content\n");
rv = 1;
}
{
char *str;
- if (((str = agget(obj, "pencolor")) != 0) && str[0])
+ if ((str = agget(obj, "pencolor")) != 0 && str[0])
return str;
- else if (((str = agget(obj, "color")) != 0) && str[0])
+ else if ((str = agget(obj, "color")) != 0 && str[0])
return str;
else
return NULL;
if (!lbl->u.tbl->data.pencolor && getPenColor(obj))
lbl->u.tbl->data.pencolor = strdup(getPenColor(obj));
rv |= size_html_tbl(g, lbl->u.tbl, NULL, &env);
- wd2 = (lbl->u.tbl->data.box.UR.x) / 2;
- ht2 = (lbl->u.tbl->data.box.UR.y) / 2;
+ wd2 = lbl->u.tbl->data.box.UR.x / 2;
+ ht2 = lbl->u.tbl->data.box.UR.y / 2;
box = boxfof(-wd2, -ht2, wd2, ht2);
pos_html_tbl(lbl->u.tbl, box, BOTTOM | RIGHT | TOP | LEFT);
lp->dimen.x = box.UR.x - box.LL.x;