char buf[BUFSIZ];
point pt;
- sprintf(buf, "%d,%d,%d,%d", GD_bb(g).LL.x, GD_bb(g).LL.y,
- GD_bb(g).UR.x, GD_bb(g).UR.y);
+ sprintf(buf, "%d,%d,%d,%d", GD_bb(g).LL.x, YDIR(GD_bb(g).LL.y),
+ GD_bb(g).UR.x, YDIR(GD_bb(g).UR.y));
agset(g, "bb", buf);
if (GD_label(g) && GD_label(g)->text[0]) {
pt = GD_label(g)->p;
s = agxget(g, G_bb->index);
if (sscanf(s, BS, &bb.LL.x, &bb.LL.y, &bb.UR.x, &bb.UR.y) == 4) {
+ if (bb.LL.y > bb.UR.y) {
+ /* If the LL.y coordinate is bigger than the UR.y coordinate,
+ * we assume the input was produced using -y, so we normalize
+ * the bb.
+ */
+ int tmp = bb.LL.y;
+ bb.LL.y = bb.UR.y;
+ bb.UR.y = tmp;
+ }
GD_bb(g) = bb;
return 1;
} else