swftools
fichierps.mp

fichierps.mp [ source brut ]

 %% ----------------------------------------------------------------------------
 %% fichierps.mp
 %% Macros MetaPost pour gérer en parallèle un fichier PS destiné à produire un
 %% fichier PDF.
 %% 29 janvier 2005 - Jean-Michel Sarlat
 %% 18 avril   2007 - modification de la procédure d'initialisation pour adapter
 %%		     la commande stroke de PostScript.
 %% ----------------------------------------------------------------------------
 
 %%
 %% Déclarations
 %% ----------------------------------------------------------------------------
 string FichierPS;
 FichierPS := jobname & ".ps";
 def InsPS expr s = write s to FichierPS enddef;
 
 %%
 %% Dimensions du document
 %% ----------------------------------------------------------------------------
 if not known PageLargeur:
     PageLargeur  := 640;
     PageHauteur  := 480;
     _PLX_  := 0;
     _PLY_  := 0;
     _PRX_  := 640;
     _PRY_  := 480;
 fi;
 % PageSize enregistre les dimensions déclarées.
 def PageSize(expr lx,ly,rx,ry) =
     PageLargeur  := rx - lx;
     PageHauteur  := ry - ly;
     _PLX_  := lx;
     _PLY_  := ly;
     _PRX_  := rx;
     _PRY_  := ry;
 enddef;
 % InPS insrit la figure metapost et préise la translation nécessaire.
 vardef InPS =
     % InsPS(decimal _PLX_ & " neg " & decimal _PLY_ & " neg translate");
     InsPS("(" & jobname & "." & decimal charcode & ") run");
 enddef;
 % ClipPageSize découpe l'image aux dimensions déclarées.
 vardef ClipPageSize =
     clip currentpicture to 
        (_PLX_,_PLY_)--(_PLX_,_PRY_)--(_PRX_,_PRY_)--(_PRX_,_PLY_)--cycle
 enddef;
 %% ----------------------------------------------------------------------------
 
 
 %%
 %% Inscriptions dans le fichier PS
 %% ----------------------------------------------------------------------------
 % Procédure d'initialisation
 def InitFichierPS(expr lx,ly,rx,ry)  =
     PageSize(lx,ly,rx,ry);
     InsPS("%!");
     InsPS("<< /PageSize [" 
 	& decimal PageLargeur
 	& " "
 	& decimal PageHauteur
 	& "] >> setpagedevice");
     InsPS(decimal _PLX_ & " neg " & decimal _PLY_ & " neg translate");
     extra_endfig := "ClipPageSize;InPS;" & extra_endfig;
     extra_beginfig := extra_beginfig & "special("
 	& ditto
 	& "/sysstroke {systemdict /stroke get exec} def /stroke {.dashpath sysstroke} def"
 	& ditto
 	& ");";
 enddef;
 %% ----------------------------------------------------------------------------
 
 endinput
 
 
 
Validation CSS Validation XHTMLJean-Michel Sarlat — Dernière modification : 11 février 2008 (0.06s - 3017666 - vendredi 16 mai 2008)