version 1.1.1.2, 2000/01/22 14:16:27 |
version 1.1.1.3, 2003/09/15 07:09:37 |
Line 105 TERM_PUBLIC void MF_arrow __PROTO((unsigned int sx, un |
|
Line 105 TERM_PUBLIC void MF_arrow __PROTO((unsigned int sx, un |
|
TERM_PUBLIC void MF_put_text __PROTO((unsigned int x, unsigned int y, char *str)); |
TERM_PUBLIC void MF_put_text __PROTO((unsigned int x, unsigned int y, char *str)); |
TERM_PUBLIC void MF_reset __PROTO((void)); |
TERM_PUBLIC void MF_reset __PROTO((void)); |
|
|
|
/* from util.c */ |
|
extern char *gp_strdup __PROTO((char *)); |
|
|
#define GOT_MF_PROTO |
#define GOT_MF_PROTO |
|
|
#endif /* TERM_PROTO */ |
#endif /* TERM_PROTO */ |
|
|
|
|
|
|
|
|
TERM_PUBLIC void MF_init() |
TERM_PUBLIC void |
|
MF_init() |
{ |
{ |
MF_char_code = 0; |
MF_char_code = 0; |
MF_ang = 0; |
MF_ang = 0; |
|
|
fputs("\ |
fputs("\ |
\ndef put_text(expr ts,xstart,ystart,rot,justification) =\n\ |
\ndef put_text(expr ts,xstart,ystart,rot,justification) =\n\ |
begingroup\n\ |
begingroup\n\ |
text_width:=0;text_height:=0;\n\ |
text_width:=0;text_height:=0;text_depth:=0;\n\ |
for ind:=0 step 1 until length(ts)-1:\n\ |
for ind:=0 step 1 until length(ts)-1:\n\ |
dec_num:=ASCII substring (ind,ind+1) of ts;\n\ |
dec_num:=ASCII substring (ind,ind+1) of ts;\n\ |
if unknown r[dec_num]: dec_num:=32; fi\n\ |
if unknown r[dec_num]: dec_num:=32; fi\n\ |
if dec_num=32: \n\ |
if dec_num=32: \n\ |
text_width:=text_width+wd[65];\n\ |
text_width:=text_width+wd[65];\n\ |
text_height:=GPMAX(text_height,ht[65]+dp[65]);\n\ |
text_height:=max(text_height,ht[65]);\n\ |
|
text_depth:=max(text_depth,dp[65]);\n\ |
elseif dec_num>=0: \n\ |
elseif dec_num>=0: \n\ |
text_width:=text_width+wd[dec_num];\n\ |
text_width:=text_width+wd[dec_num];\n\ |
text_height:=GPMAX(text_height,ht[dec_num]+dp[dec_num]);\n\ |
text_height:=max(text_height,ht[dec_num]);\n\ |
|
text_depth:=max(text_depth,dp[dec_num]);\n\ |
fi\n\ |
fi\n\ |
endfor\n\ |
endfor\n\ |
if rot=90:\n\ |
if rot=90:\n\ |
|
|
elseif justification=2: ynext:=round(ystart-text_width/2);\n\ |
elseif justification=2: ynext:=round(ystart-text_width/2);\n\ |
else: ynext:=round(ystart-text_width);\n\ |
else: ynext:=round(ystart-text_width);\n\ |
fi\n\ |
fi\n\ |
xnext:=xstart+text_height/2;\n\ |
xnext:=xstart+(text_height-text_depth)/2;\n\ |
else:\n\ |
else:\n\ |
if justification=1: xnext:=xstart;\n\ |
if justification=1: xnext:=xstart;\n\ |
elseif justification=2: xnext:=round(xstart-text_width/2);\n\ |
elseif justification=2: xnext:=round(xstart-text_width/2);\n\ |
else: xnext:=round(xstart-text_width);\n\ |
else: xnext:=round(xstart-text_width);\n\ |
fi\n\ |
fi\n\ |
ynext:=ystart-text_height/2;\n\ |
ynext:=ystart-(text_height-text_depth)/2;\n\ |
fi\n\ |
fi\n\ |
for ind:=0 step 1 until length(ts)-1:\n\ |
for ind:=0 step 1 until length(ts)-1:\n\ |
dec_num:=ASCII substring (ind,ind+1) of ts;\n\ |
dec_num:=ASCII substring (ind,ind+1) of ts;\n\ |
Line 265 else: font_coding_scheme:=\n\ |
|
Line 271 else: font_coding_scheme:=\n\ |
|
spanish_shriek=oct\"016\"; spanish_query=oct\"017\"; fi\n\ |
spanish_shriek=oct\"016\"; spanish_query=oct\"017\"; fi\n\ |
font_setup;\n\ |
font_setup;\n\ |
input romanu.mf %Roman uppercase.\n\ |
input romanu.mf %Roman uppercase.\n\ |
input romanl.mf %Roman lowerrcase.\n\ |
input romanl.mf %Roman lowercase.\n\ |
input greeku.mf %Greek uppercase.\n\ |
input greeku.mf %Greek uppercase.\n\ |
input romand.mf %Numerals.\n\ |
input romand.mf %Numerals.\n\ |
input romanp.mf %Ampersand, question marks, currency sign.\n\ |
input romanp.mf %Ampersand, question marks, currency sign.\n\ |
Line 326 arrowhead = (-7pt,-2pt){dir30}..(-6pt,0pt)..\ |
|
Line 332 arrowhead = (-7pt,-2pt){dir30}..(-6pt,0pt)..\ |
|
} |
} |
|
|
|
|
TERM_PUBLIC void MF_graphics() |
TERM_PUBLIC void |
|
MF_graphics() |
{ |
{ |
register struct termentry *t = term; |
register struct termentry *t = term; |
|
|
Line 338 TERM_PUBLIC void MF_graphics() |
|
Line 345 TERM_PUBLIC void MF_graphics() |
|
} |
} |
|
|
|
|
TERM_PUBLIC void MF_text() |
TERM_PUBLIC void |
|
MF_text() |
{ |
{ |
fputs("endchar;\n", gpoutfile); |
fputs("endchar;\n", gpoutfile); |
} |
} |
|
|
|
|
TERM_PUBLIC int MF_justify_text(mode) |
TERM_PUBLIC int |
|
MF_justify_text(mode) |
enum JUSTIFY mode; |
enum JUSTIFY mode; |
{ |
{ |
MF_justify = mode; |
MF_justify = mode; |
Line 352 enum JUSTIFY mode; |
|
Line 361 enum JUSTIFY mode; |
|
} |
} |
|
|
|
|
TERM_PUBLIC int MF_text_angle(ang) |
TERM_PUBLIC int |
|
MF_text_angle(ang) |
int ang; |
int ang; |
{ |
{ |
if (ang > 0) |
if (ang > 0) |
|
|
} |
} |
|
|
|
|
TERM_PUBLIC void MF_linetype(linetype) |
TERM_PUBLIC void |
|
MF_linetype(linetype) |
int linetype; |
int linetype; |
{ |
{ |
if (linetype >= 8) |
if (linetype >= 8) |
|
|
} |
} |
|
|
|
|
TERM_PUBLIC void MF_move(x, y) |
TERM_PUBLIC void |
|
MF_move(x, y) |
unsigned int x, y; |
unsigned int x, y; |
{ |
{ |
MF_last_x = x; |
MF_last_x = x; |
Line 393 unsigned int x, y; |
|
Line 405 unsigned int x, y; |
|
} |
} |
|
|
|
|
TERM_PUBLIC void MF_vector(x, y) |
TERM_PUBLIC void |
|
MF_vector(x, y) |
unsigned int x, y; |
unsigned int x, y; |
{ |
{ |
if (MF_is_solid) { |
if (MF_is_solid) { |
Line 452 unsigned int x, y; |
|
Line 465 unsigned int x, y; |
|
} |
} |
|
|
|
|
TERM_PUBLIC void MF_arrow(sx, sy, ex, ey, head) |
TERM_PUBLIC void |
|
MF_arrow(sx, sy, ex, ey, head) |
unsigned int sx, sy, ex, ey; |
unsigned int sx, sy, ex, ey; |
TBOOLEAN head; |
TBOOLEAN head; |
{ |
{ |
|
|
} |
} |
|
|
|
|
TERM_PUBLIC void MF_put_text(x, y, str) |
TERM_PUBLIC void |
|
MF_put_text(x, y, str) |
unsigned int x, y; |
unsigned int x, y; |
char *str; |
char *str; |
{ |
{ |
int i, j = 0; |
int i, j = 0; |
|
char *text; |
|
|
for (i = 0; i < strlen(str); i++) |
/* ignore empty strings */ |
if (str[i] == '"') |
if (!str || !*str) |
str[i] = '\''; /* Replace " with ' */ |
return; |
|
|
|
/* F***. why do drivers need to modify string args? */ |
|
text = gp_strdup(str); |
|
|
|
for (i = 0; i < strlen(text); i++) |
|
if (text[i] == '"') |
|
text[i] = '\''; /* Replace " with ' */ |
switch (MF_justify) { |
switch (MF_justify) { |
case LEFT: |
case LEFT: |
j = 1; |
j = 1; |
|
|
break; |
break; |
} |
} |
fprintf(gpoutfile, "put_text(\"%s\",%da,%db,%d,%d);\n", |
fprintf(gpoutfile, "put_text(\"%s\",%da,%db,%d,%d);\n", |
str, x, y, MF_ang, j); |
text, x, y, MF_ang, j); |
|
free(text); |
} |
} |
|
|
|
|
TERM_PUBLIC void MF_reset() |
TERM_PUBLIC void |
|
MF_reset() |
{ |
{ |
fputs("end.\n", gpoutfile); |
fputs("end.\n", gpoutfile); |
} |
} |
|
|
"?term mf", |
"?term mf", |
"?mf", |
"?mf", |
"?metafont", |
"?metafont", |
" The `mf` terminal driver creates a input file to the METAFONT program. Thus a", |
" The `mf` terminal driver creates an input file to the METAFONT program. Thus a", |
" figure may be used in the TeX document in the same way as is a character.", |
" figure may be used in the TeX document in the same way as is a character.", |
"", |
"", |
" To use a picture in a document, the METAFONT program must be run with the", |
" To use a picture in a document, the METAFONT program must be run with the", |
|
|
"", |
"", |
" The text support is based on a METAFONT character set. Currently the", |
" The text support is based on a METAFONT character set. Currently the", |
" Computer Modern Roman font set is input, but the user is in principal free to", |
" Computer Modern Roman font set is input, but the user is in principal free to", |
" chose whatever fonts he or she needs. The METAFONT source files for the", |
" choose whatever fonts he or she needs. The METAFONT source files for the", |
" chosen font must be available. Each character is stored in a separate", |
" chosen font must be available. Each character is stored in a separate", |
" picture variable in METAFONT. These variables may be manipulated (rotated,", |
" picture variable in METAFONT. These variables may be manipulated (rotated,", |
" scaled etc.) when characters are needed. The drawback is the interpretation", |
" scaled etc.) when characters are needed. The drawback is the interpretation", |