diff options
author | Karl Berry <karl@freefriends.org> | 2017-09-03 23:00:53 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-09-03 23:00:53 +0000 |
commit | f5cd2c11a5f8e60d8ba81823546e7aac93472baa (patch) | |
tree | ed552d8ff78f5e961e0b5a8d1f2adb65b18f2463 /Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf | |
parent | c66d98927c51070d537ce85dc449c4b53c56fc92 (diff) |
mcf2graph (3sep17)
git-svn-id: svn://tug.org/texlive/trunk@45206 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf')
-rw-r--r-- | Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf b/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf index eee9dfa0525..7f8b1d6cfc7 100644 --- a/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf +++ b/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf @@ -1,5 +1,5 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% mcf2graph ver 4.26 Copyright (c) 2013-2017 Akira Yamaji +% mcf2graph ver 4.27 Copyright (c) 2013-2017 Akira Yamaji % % Permission is hereby granted, free of charge, to any person obtaining a copy of this software % and associated documentation files (the "Software"), to deal in the Software without restriction, @@ -31,7 +31,7 @@ % Set to use plain.mp label,arrow : mpost -s ahlength=3 FILENAME %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% tracingstats:=1; -message " This is mcf2graph ver 4.2 2017.8"; +message " This is mcf2graph ver 4.2 2017.9"; %------------------------------------------------------------------------------------------------- newinternal nA,nB,nC,nD,nE,nF,char_num,str_cnt,sub_usr,sub_int,tbl_cnt; numeric save_para[],comD[][],parD[][],cntD[],tbl_str_wd[],tbl_atom[],tbl_subst[][],tbl_atom_wt[], @@ -146,10 +146,10 @@ def beginfont(text s)= save_defaultfont:=defaultfont; begingroup save cntA,cntB,cntM,minX,minY,f_beginchar,numS,sftX,sftY,f_ext, - cal_FM,cal_MW,cal_MW_str,cal_MI,cal_MI_str, + cal_FM,cal_MW,cal_MW_str,cal_MI,cal_MI_str,wdM,htM, inf_NO,inf_EN,inf_JN,inf_FM,inf_CAS,inf_USE,inf_EXA,inf_EXB,inf_MW, posBs,posBe,posA,posM,lineB,sB,eB,angB,angA,lenB,ang_br,info,pT; - numeric lineB[],sB[],eB[],angB[],angA[],lenB[],ang_br[],numS[]; + numeric lineB[],sB[],eB[],angB[],angA[],lenB[],ang_br[],numS[],wdM[],htM[]; pair posA[],posM[][],pT,posBs,posBe; string info[],cal_FM,cal_MW,cal_MW_str,cal_MI,cal_MI_str, inf_NO,inf_EN,inf_JN,inf_FM,inf_CAS,inf_USE,inf_EXA,inf_EXB,inf_MW; @@ -331,6 +331,7 @@ def ext_setup= pickup pencircle scaled ext_defaultline; dotlabeldiam:=3bp; labeloffset:=3bp; + save em; em=defaultscale*defaultsize; if (defaultfont="draw")or(f_MP=0)or(sw_label_emu=1): save label,dotlabel; @@ -346,26 +347,28 @@ enddef; %-------------------------------------------------------------------------------------------------- def EXT(text TXT)= begingroup - save w,h,wd,ht,n,p,am,em,aw; + save w,h,wd,ht,n,p,am,aw; pair p[]; ext_setup; - w:=font_wd; h:=font_ht; - wd:=w-2margin_left_right; ht:=h-2margin_top_bottom; + w:=font_wd; + h:=font_ht; + w0:=w-2margin_left_right; + h0:=h-2margin_top_bottom; p0:=(margin_left_right,margin_top_bottom); aw:=atom_wd; n:=cntM; - for i=1 upto n: p[i]:=posM[1][i]; endfor + for i=1 upto n: p[i]:=posM[1][i]; w[i]:=wdM[i]; h[i]:=htM[i]; endfor TXT addto mol_stru[0] also currentpicture; clearit; f_ext:=1; endgroup; enddef; %-------------------------------------------------------------------------------------------------- def ext(text TXT)= begingroup - save wd,ht,n,l,p,am,em,aw,A,B; + save w,h,n,l,p,am,aw,A,B; numeric A[]dir,B[]dir; pair p[],A[],B[],B[]s,B[]e; ext_setup; - wd:=mol_wd; ht:=mol_ht; l:=bond_len; aw:=atom_wd; + w:=mol_wd; h:=mol_ht; l:=bond_len; aw:=atom_wd; p0:=(minX,minY); An:=cntA; Bn:=cntB; for i=1 upto An: A[i]:=posA[i]; A[i]dir:=ang_br[i]; endfor for i=1 upto Bn: @@ -409,14 +412,20 @@ def ext_puts(expr PA)(expr STR)= enddef; %-------------------------------------------------------------------------------------------------- vardef label_emu@#(expr STR,POS) = %% modified 'thelabel@#(expr s,z)' of plain.mp - save oft,fx,fy,wds,sC; + save oft,fx,fy,wds,sC,pC; pair oft,oft.lft,oft.rt,oft.top,oft.bot,oft.ulft,oft.llft,oft.urt,oft.lrt; string sC; + picture pC; wds:=0; for i=0 upto length(STR)-1: sC:=pic_c(i,STR); if not((sw_label_emu=1)and((sC="_")or(sC="^"))): - wds:=wds+defaultscale*defaultsize*tbl_char_wd[ASCII(sC)]; + if (defaultfont="draw")or(f_MP=0): + wds:=wds+defaultscale*defaultsize*tbl_char_wd[ASCII(sC)]; + else: + pC:=sC infont defaultfont scaled defaultscale; + wds:=wds+xpart(lrcorner pC-llcorner pC); + fi fi endfor oft:= ( 0, 0); fx:=0.5; fy:=0.5; @@ -547,6 +556,8 @@ def MCd(expr RW,RH)(expr FW,FH)(text TX)= posM[0][incr cntM]:=(sftX,sftY); posM[1][cntM]:=(minX+sftX,minY+sftY); posM[2][cntM]:=(max_x+sftX,max_y+sftY); + wdM[cntM]:=mol_wd; + htM[cntM]:=mol_ht; if sw_mol_frame=1: draw_frame((minX,minY),mol_wd,mol_ht,thickness_font_frame) fi addto mol_stru[cntM] also currentpicture; clearit; |