diff options
author | Karl Berry <karl@freefriends.org> | 2015-07-30 21:59:50 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2015-07-30 21:59:50 +0000 |
commit | b6f4cf0741ace7ba3bc432bead24db36b84985af (patch) | |
tree | 61116ed575f3bae2ab0891b5e9ebd69c33eb7be8 /Master/texmf-dist/metapost | |
parent | 6dc0ccac671319a03fa217782f7cbd746556c426 (diff) |
mcf2graph (30jul15)
git-svn-id: svn://tug.org/texlive/trunk@38004 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/metapost')
-rw-r--r-- | Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf | 47 |
1 files changed, 18 insertions, 29 deletions
diff --git a/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf b/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf index 05f69ae860b..03890a729b2 100644 --- a/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf +++ b/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf @@ -1,5 +1,5 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% mcf2graph ver 3.52 Copyright (c) 2013-2015 Akira Yamaji +% mcf2graph ver 3.53 Copyright (c) 2013-2015 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, @@ -19,8 +19,8 @@ % mcf2graph is METAFONT/METAPOST macro package convert % Molecular Coding Format(MCF) to font/eps/sgv/png/mdl molfile(V2000) %---------------------------------------------------------------------------------------------- -% Web page of author: http://molecoding.cocolog-nifty.com/blog/ -% Suggestion or request mail to: akira.yamaji5@gmail.com +% This package is located at : http://mirror.ctan.org/pkg/graphics/mcf2graph +% Suggestion or request mail to : akira.yamaji5@gmail.com %---------------------------------------------------------------------------------------------- % Set outputformat to "png" : mpost -s ahangle=1 FILENAME % Set outputformat to "svg" : mpost -s ahangle=2 FILENAME @@ -44,30 +44,25 @@ picture atom_font[],chem_structure,temp_picture; %------------------------------------------------------------------------------------------------- sw_numberA:=sw_numberB:=sw_frame:=sw_logout:=sw_solid:=sw_expand:=sw_start_vector:=0; sw_atom_frame:=sw_checklist:=sw_MOLfile:=char_num:=str_cnt:=size_changed:=proc_end:=0; -if known outputtemplate: - f_MP:=1; - if known SAVfile: % for MePoTeX - mp_log_name:="@MCF_INFO.log"; outputtemplate:="%j.%c."; - def beginchar(text s)= enddef; def endchar = enddef; sw_logout:=1; - else: % for METAPOST - mp_log_name:=jobname&"-info.log"; - if ahlength=1: proc_end:=1; fi % first molecular only - if ahlength=2: sw_checklist:=1; def shipit = enddef; fi % checklist on - if ahangle=0: def shipit = enddef; % No image file - elseif ahangle=1: outputformat:="png"; hppp:=vppp:=0.1; % PNG format - elseif ahangle=2: outputformat:="svg"; % SVG format - elseif ahangle=3: sw_MOLfile:=1; def shipit = enddef; % MDL Molefile on - fi - outputtemplate:="%j-%3c."&outputformat; - def beginchar(text s)= beginfig(char_num) enddef; def endchar = endfig enddef; +if known green: f_MP:=1; + mp_log_name:=jobname&"-info.log"; + if ahlength=1: proc_end:=1; fi % first molecular only + if ahlength=2: sw_checklist:=1; def shipit = enddef; fi % checklist on + if ahangle=0: def shipit = enddef; % No image file + elseif ahangle=1: outputformat:="png"; hppp:=vppp:=0.1; % PNG format + elseif ahangle=2: outputformat:="svg"; % SVG format + elseif ahangle=3: sw_MOLfile:=1; def shipit = enddef; % MDL Molefile on fi + outputtemplate:="%j-%3c."&outputformat; + def beginchar(text s)= beginfig(char_num) enddef; def endchar = endfig enddef; vardef mp_filename = jobname&"-"&fit_zero(char_num)&decimal(char_num)&"."&outputformat enddef; def printf expr s= write s to mp_log_name enddef; ahangle:=45; ahlength:=4; def # = enddef; color color_list[]; def Cp(expr s) = if known s: if s<>0: withcolor color_list[s] fi fi enddef; def define_pixels(text s) = enddef; -else: f_MP:=0; def Cp(expr s) = enddef; def color = transform enddef; - mode_setup; def printf expr s= message s enddef; def mp_filename= "" enddef; fi +else: f_MP:=0; + def Cp(expr s) = enddef; def color = transform enddef; + mode_setup; def printf expr s= message s enddef; def mp_filename= "" enddef; fi clearit; chem_structure:=currentpicture; %------------------------------------------------------------------------------------------------- let DIV= /; let MUL= *; let LT= <; let GT= >; let AND= &; let :: = : ; let == = =; @@ -104,12 +99,6 @@ def beginfont(text s)= mol_name:=""; len_x:=len_y:=cntA:=0; for list=s: cntA:=cntA+1; info[cntA]:=list; if substring (0,2) of list="EN": mol_name:=substring (3,length(list)) of list; fi exitif cntA=11; endfor - ratio_hw:=font_ht#/font_wd#; - if f_MP=0: - if mode=proof: - if font_wd#>=font_ht#: - if font_wd#>35mm#:font_wd#:=35mm#;font_ht#:=ratio_hw*35mm#; fi - else: if font_ht#>35mm#:font_ht#:=35mm#;font_wd#:=35mm#/ratio_hw; fi fi fi fi beginchar(char_num,font_wd#,font_ht#,0); clearit; enddef; %------------------------------------------------------------------------------------------------- @@ -157,8 +146,8 @@ for i=1 upto cntA: xpos:=xpart(posA[i]); ypos:=ypart(posA[i]); enddef; %------------------------------------------------------------------------------------------------- def resize(expr WD,HT)= - if (len_y/len_x)>ratio_hw: factor:=(font_ht*HT-2tb_margin)/len_y; - else: factor:=(font_wd*WD-2lr_margin)/len_x; fi + if (len_y/len_x)>(font_ht/font_wd): factor:=(font_ht*HT-2tb_margin)/len_y; + else: factor:=(font_wd*WD-2lr_margin)/len_x; fi ratio_bond_width:=ratio_bond_width*factor; len_x:=len_x*factor; len_y:=len_y*factor; enddef; %------------------------------------------------------------------------------------------------- |