textBB (double x, double y, textpara_t* para)
{
boxf bb;
- double wd = para->width;
- double ht = para->height;
+ pointf sz = para->size;
switch (para->just) {
case 'l':
bb.LL.x = x;
- bb.UR.x = bb.LL.x + wd;
+ bb.UR.x = bb.LL.x + sz.x;
break;
case 'n':
- bb.LL.x = x - wd/2.0;
- bb.UR.x = x + wd/2.0;
+ bb.LL.x = x - sz.x / 2.0;
+ bb.UR.x = x + sz.x / 2.0;
break;
case 'r':
bb.UR.x = x;
- bb.LL.x = bb.UR.x - wd;
+ bb.LL.x = bb.UR.x - sz.x;
break;
}
bb.UR.y = y + para->yoffset_layout;
- bb.LL.y = bb.UR.y - ht;
+ bb.LL.y = bb.UR.y - sz.y;
return bb;
}
fontname = para->font->name;
fontsize = para->font->size;
- para->width = 0.0;
- para->height = fontsize * LINESPACING;
+ para->size.x = 0.0;
+ para->size.y = fontsize * LINESPACING;
para->yoffset_layout = 0.0;
para->yoffset_centerline = 0.1 * fontsize;
para->layout = NULL;
*fontpath = fpp;
if ((p = para->str)) {
while ((c = *p++))
- para->width += Fontwidth[(unsigned char) c];
- para->width *= fontsize;
+ para->size.x += Fontwidth[(unsigned char) c];
+ para->size.x *= fontsize;
}
}
pointf textsize(GVC_t *gvc, textpara_t * para, char *fontname, double fontsize)
{
char **fpp = NULL, *fontpath = NULL;
- pointf size;
htmlfont_t *font;
font = NEW(htmlfont_t);
fprintf(stderr, "fontname: unable to resolve \"%s\"\n", fontname);
}
- size.x = para->width;
- size.y = para->height;
- return size;
+ return para->size;
}
tl.yoffset_centerline = 1;
tl.postscript_alias = ti->postscript_alias;
tl.layout = ti->layout;
- tl.width = ti->size;
- tl.height = paras[i].lfsize;
+ tl.size.x = ti->size.x;
+ tl.size.y = paras[i].lfsize;
tl.just = 'l';
p_.x = p.x;
gvrender_textpara(job, p_, &tl);
- p.x += ti->size;
+ p.x += ti->size.x;
ti++;
}
}
sz = textsize(GD_gvc(g), &lp, fname, fsize);
free(ftxt->paras[i].items[j].str);
ftxt->paras[i].items[j].str = lp.str;
- ftxt->paras[i].items[j].size = sz.x;
+ ftxt->paras[i].items[j].size.x = sz.x;
ftxt->paras[i].items[j].yoffset_layout = lp.yoffset_layout;
ftxt->paras[i].items[j].yoffset_centerline = lp.yoffset_centerline;
ftxt->paras[i].items[j].postscript_alias = lp.postscript_alias;
size = textsize(gvc, para, lp->fontname, lp->fontsize);
else {
size.x = 0.0;
- para->height = size.y = (int)(lp->fontsize * LINESPACING);
+ para->size.y = size.y = (int)(lp->fontsize * LINESPACING);
}
lp->u.txt.nparas++;
gvrender_textpara(job, p, &(lp->u.txt.para[i]));
/* UL position for next para */
- p.y -= lp->u.txt.para[i].height;
+ p.y -= lp->u.txt.para[i].size.y;
}
gvrender_end_label(job);
void *layout;
void (*free_layout) (void *layout); /* FIXME - this is ugly */
htmlfont_t *font;
- double size, yoffset_layout, yoffset_centerline;
- double width, height; /* FIXME */
+ double yoffset_layout, yoffset_centerline;
+ pointf size;
char just; /* 'l' 'n' 'r' */ /* FIXME */
} textpara_t;
#if 0
gvputs(job, " <dia:attribute name=\"obj_bb\">\n");
gvprintf(job, " <dia:rectangle val=\"%g,%g;%g,%g\"/>\n",
- p.x - (Scale * (para->width) / 2.), p.y - 0.4,
- p.x + (Scale * (para->width) / 2.), p.y + 0.4);
+ p.x - (Scale * (para->size.x) / 2.), p.y - 0.4,
+ p.x + (Scale * (para->size.x) / 2.), p.y + 0.4);
gvputs(job, " </dia:attribute>\n");
#endif
gvputs(job, " </dia:object>\n");
xdot_point(xbufs[emit_state], p);
sprintf(buf, "%d ", j);
agxbput(xbufs[emit_state], buf);
- xdot_fmt_num (buf, para->width);
+ xdot_fmt_num (buf, para->size.x);
agxbput(xbufs[emit_state], buf);
xdot_str (job, "", para->str);
}
case 'l':
break;
case 'r':
- p.x -= para->width;
+ p.x -= para->size.x;
break;
default:
case 'n':
- p.x -= para->width / 2;
+ p.x -= para->size.x / 2;
break;
}
/* Why on earth would we do this. But it works. SCN 2/26/2002 */
p.y += para->font->size / (3.0 * POINTS_PER_INCH);
- p.x += para->width / (2.0 * POINTS_PER_INCH);
+ p.x += para->size.x / (2.0 * POINTS_PER_INCH);
if (para->font->name && (!(lastname) || strcmp(lastname, para->font->name))) {
gvprintf(job, ".ft %s\n", picfontname(para->font->name));
case 'l': //left justified
break;
case 'r': //right justified
- c.x = c.x - para->width;
+ c.x = c.x - para->size.x;
break;
default:
case 'n': //centered
- c.x = c.x - para->width / 2.0;
+ c.x = c.x - para->size.x / 2.0;
break;
}
str = ps_string(para->str,isLatin1);
switch (para->just) {
case 'r':
- p.x -= para->width;
+ p.x -= para->size.x;
break;
case 'l':
p.x -= 0.0;
break;
case 'n':
default:
- p.x -= para->width / 2.0;
+ p.x -= para->size.x / 2.0;
break;
}
p.y += para->yoffset_centerline;
gvprintpointf(job, p);
gvputs(job, " moveto ");
- gvprintdouble(job, para->width);
+ gvprintdouble(job, para->size.x);
gvprintf(job, " %s alignedtext\n", str);
}
p1.x=p.x;
break;
case 'r':
- p1.x=p.x-para->width;
+ p1.x=p.x-para->size.x;
break;
default:
case 'n':
- p1.x=p.x-(para->width/2);
+ p1.x=p.x-(para->size.x/2);
break;
}
- p2.x=p1.x+para->width;
- if (para->height < para->font->size){
- para->height = 1 + (1.1*para->font->size);
+ p2.x=p1.x+para->size.x;
+ if (para->size.y < para->font->size){
+ para->size.y = 1 + (1.1*para->font->size);
}
p1.x-=8; /* vml textbox margin fudge factor */
p2.x+=8; /* vml textbox margin fudge factor */
p2.y=graphHeight-(p.y);
- p1.y=(p2.y-para->height);
+ p1.y=(p2.y-para->size.y);
/* text "y" was too high
* Graphviz uses "baseline", VML seems to use bottom of descenders - so we fudge a little
* (heuristics - based on eyeballs) */
{
gdImagePtr im = (gdImagePtr) job->context;
pointf spf, epf;
- double parawidth = para->width * job->zoom * job->dpi.x / POINTS_PER_INCH;
+ double parawidth = para->size.x * job->zoom * job->dpi.x / POINTS_PER_INCH;
char* fontname;
if (!im)
case 'l':
break;
case 'r':
- p.x -= para->width;
+ p.x -= para->size.x;
break;
default:
case 'n':
- p.x -= para->width / 2;
+ p.x -= para->size.x / 2;
break;
}
- q.x = p.x + para->width;
+ q.x = p.x + para->size.x;
q.y = p.y;
spf = vrml_node_point(job, obj->u.n, p);
else
strex.flags |= gdFTEX_FONTCONFIG;
- para->width = 0.0;
- para->height = 0.0;
+ para->size.x = 0.0;
+ para->size.y = 0.0;
para->yoffset_layout = 0.0;
para->layout = NULL;
if (para->str && para->str[0]) {
/* can't use brect on some archtectures if strlen 0 */
- para->width = (double) (brect[4] - brect[0]);
+ para->size.x = (double) (brect[4] - brect[0]);
/* 1.2 specifies how much extra space to leave between lines;
* see LINESPACING in const.h.
*/
- para->height = (int)(fontsize * 1.2);
+ para->size.y = (int)(fontsize * 1.2);
}
}
return TRUE;
doc->osBody() << setFont(font, style, weight, variant, stretch) << setFontSize(para->font->size) << endl;
switch (para->just) {
case 'r':
- p.x -= para->width;
+ p.x -= para->size.x;
break;
case 'l':
p.x -= 0.0;
break;
case 'n':
default:
- p.x -= para->width / 2.0;
+ p.x -= para->size.x / 2.0;
break;
}
p.y += para->yoffset_centerline;
gvprintpointf(job, p);
gvputs(job, " moveto ");
-// gvprintdouble(job, para->width);
+// gvprintdouble(job, para->size.x);
// str = ps_string(para->str,isLatin1);
// gvprintf(job, " %s alignedtext\n", str);
doc->osBody() << show(para->str) << endl;
switch (para->just) {
case 'r':
- p.x -= para->width;
+ p.x -= para->size.x;
break;
case 'l':
p.x -= 0.0;
break;
case 'n':
default:
- p.x -= para->width / 2.0;
+ p.x -= para->size.x / 2.0;
break;
}
p.y += para->yoffset_centerline + para->yoffset_layout;
logical_rect.height = 0;
textlayout_scale = POINTS_PER_INCH / (FONT_DPI * PANGO_SCALE);
- para->width = (int)(logical_rect.width * textlayout_scale + 1); /* round up so that width/height are never too small */
- para->height = (int)(logical_rect.height * textlayout_scale + 1);
+ para->size.x = (int)(logical_rect.width * textlayout_scale + 1); /* round up so that width/height are never too small */
+ para->size.y = (int)(logical_rect.height * textlayout_scale + 1);
/* FIXME -- Horrible kluge !!! */
* Use an assumed height based on the point size.
*/
- para->height = (int)(para->font->size * 1.1 + .5);
+ para->size.y = (int)(para->font->size * 1.1 + .5);
/* The y offset from baseline to 0,0 of the bitmap representation */
#if defined PANGO_VERSION_MAJOR && (PANGO_VERSION_MAJOR >= 1)