[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[mgp-users-jp 00725] mgp2ps --- %mark, %again, %cont
- To: mgp-users-jp@mew.org
- Subject: [mgp-users-jp 00725] mgp2ps --- %mark, %again, %cont
- From: aito@ei5sun.yz.yamagata-u.ac.jp
- Date: Fri, 14 Jul 2000 14:18:33 +0900
- Posted: Fri, 14 Jul 2000 14:22:13 +0900
- Reply-to: mgp-users-jp@mew.org
はじめまして,あ伊藤@山形大学です.
最近 magicpoint を使いはじめたのですが,なかなか良いですね.
ところで,.mgp file を mgp2ps で PostScript に変換するときに,
(1) %mark ... %again が効かない.
(2) TEXT
%cont, image "hoge.eps"
TEXT
を処理すると,テキストと画像の横位置がずれる.
という問題があったので,quick hack してみました.いかがなもんで
しょうか.
--- print.c.bak Fri Jul 14 11:52:43 2000
+++ print.c Fri Jul 14 14:18:18 2000
@@ -64,6 +64,7 @@
int xsiz;
int ysiz;
int eps;
+ int target_text; /* by A. Ito */
} imagepool[256]; /*enough?*/
static int nimagepool = 0;
static struct textpool {
@@ -751,6 +752,16 @@
back = cp->ctl_value;
break;
+/* MARK and AGAIN processing by A.Ito, 14 Jul. 2000 */
+ case CTL_MARK:
+ fprintf(fp,"/markx xpos def /marky ypos def\n");
+ break;
+
+ case CTL_AGAIN:
+ fprintf(fp,"markx marky moveto /xpos markx def /ypos marky def\n");
+ break;
+
+
default:
break;
}
@@ -894,6 +905,7 @@
fprintf(fp, "%d 0 rmoveto\n", textpool[i].xsiz);
}
}
+ fprintf(fp, "/xpos%d currentpoint pop def\n",i);
}
ntextpool = 0;
@@ -905,10 +917,11 @@
if (mgp_flag & FL_VERBOSE)
fprintf(fp, "%% emit the content of imagepool\n");
cp1 = imagepool[i].image;
- if (!cp1)
+ if (!cp1) {
+ fprintf(fp, "/xpos xpos%d def xpos ypos moveto\n",
+ imagepool[i].target_text);
continue;
- fprintf(fp, "xpos %d add ypos moveto\n",
- imagepool[i].xoffset);
+ }
image_load_print(cp1->ctm_fname, cp1->ctm_numcolor,
cp1->ctm_ximagesize, cp1->ctm_yimagesize, 0,
cp1->ctm_zoomflag);
@@ -1222,6 +1235,11 @@
*q++ = '\0';
text_remember(buf, ASCII, char_size[0], textstartpos, pfx);
}
+ /* by A.Ito 14 Jul. 2000 */
+ /* placeholder */
+ imagepool[nimagepool].image = NULL;
+ imagepool[nimagepool].target_text = ntextpool-1;
+ nimagepool++;
}
static char *
@@ -1469,8 +1487,13 @@
AllPlanes, ZPixmap);
fprintf(fp, "gsave\n");
+/*
fprintf(fp, "%d ypos %d sub translate\n",
xpos + paper_xmargin, print_height);
+*/
+/* by A. Ito */
+ fprintf(fp, "xpos ypos %d sub translate\n",
+ print_height);
fprintf(fp, "%d %d scale\n", print_width, print_height);
fprintf(fp, "%d %d 8\n", print_width, print_height);
fprintf(fp, "[%d 0 0 %d 0 %d]\n", print_width,
@@ -1785,7 +1808,11 @@
}
fprintf(fp, "BeginEPSF\n");
+/*
fprintf(fp, "%d XMARGIN add ypos translate\n", xpos);
+*/
+ /* by A.Ito */
+ fprintf(fp, "xpos ypos translate\n");
fprintf(fp, "%f %f scale\n", xscale, yscale);
fprintf(fp, "%d %d translate\n", -1 * x1, -1 * y2);
fprintf(fp, "%%%%BeginDocument: %s\n", filename);
--
山形大学工学部 情報科学科 伊藤 彰則
Akinori Ito, Ph.D.
Department of Informatics, Faculty of Engineering
Yamagata University
tel&fax: 0238-26-3369 E-mail: aito@eie.yz.yamagata-u.ac.jp