double x=0,y=0;
double linepos,nextpos;
char on;
- int apos;
+ int apos=0;
if(line && line->type != gfx_moveTo) {
fprintf(stderr, "gfxtool: outline doesn't start with a moveTo");
return;
}
- if(!r || r[0]<0 || phase<0) {
- fprintf(stderr, "gfxtool: invalid dashes");
+ if(!r || (r[0]<=0 && r[0]>-0.01)) {
+ // no dashing. just draw the thing
+ while(line) {
+ if(line->type == gfx_moveTo) {
+ d->moveTo(d, line->x, line->y);
+ } else if(line->type == gfx_lineTo) {
+ d->lineTo(d, line->x, line->y);
+ } else if(line->type == gfx_splineTo) {
+ d->splineTo(d, line->sx, line->sy, line->x, line->y);
+ }
+ line = line->next;
+ }
+ return;
+ }
+ if(r[0]<0 || phase<0) {
+ fprintf(stderr, "gfxtool: invalid (negative) dashes: %f, phase=%f", r[0], phase);
return;
}
+
for(;line;line=line->next) {
if(line->type == gfx_moveTo) {
d->moveTo(d, line->x, line->y);
return box;
}
+void gfxbbox_intersect(gfxbbox_t*box1, gfxbbox_t*box2)
+{
+ if(box2->xmin > box1->xmin)
+ box1->xmin = box2->xmin;
+ if(box2->ymin > box1->ymin)
+ box1->ymin = box2->ymin;
+ if(box2->xmax < box1->xmax)
+ box1->xmax = box2->xmax;
+ if(box2->ymax > box1->ymax)
+ box1->ymax = box2->ymax;
+ if(box1->xmin > box1->xmax)
+ box1->xmax = box1->xmin;
+ if(box1->ymin > box1->ymax)
+ box1->ymax = box1->ymin;
+}
+
gfxbbox_t gfxline_getbbox(gfxline_t*line)
{
gfxcoord_t x=0,y=0;
gfxfontlist_t*last=0,*l = list;
while(l) {
last = l;
- if(!strcmp((char*)l->font->id, font->id)) {
+ if(l->font == font) {
return list; // we already know this font
}
l = l->next;