Fonty v METAPOSTu
Libor Dvorak
dvorak at ugn.cas.cz
Mon Apr 23 10:37:36 CEST 2001
Dobry den,
> Pokud par dni vydrzite, bude na siti nekde prace M. Kratke o metapostu
> a baliku mfpic. A ten umoznuje velmi jednoduse nejruznejsi druhy
> srafovani.
Pokud nechcete cekat, muzete zkusit nasledujici kod z me dilny:
% simple hatching
newinternal hatchangle,hatchspace,hatchshift;
hatchangle:=45;
hatchspace:=5bp; % 0 < hatchspace
hatchshift:=0pt; % for gentle adjustment
def hatch expr p =
draw image(
save bb,sn,cs,a,b,h,sh,hl,n,i;
path bb; pair h[],sh; path hl;
bb:=bbox p;
sn:=sind(hatchangle); cs:=cosd(hatchangle);
a:=.5(xpart lrcorner bb-xpart llcorner bb);
b:=.5(ypart urcorner bb-ypart lrcorner bb);
h1=(a+b)*(cs,sn)=-h2;
sh:=hatchspace*(-sn,cs);
n:= floor((a*abs(sn)+b*abs(cs))/hatchspace);
hl:=(h1--h2) shifted
(center bb+(hatchshift-(n+1)*hatchspace)*(-sn,cs));
for i:= 0 upto 2n: hl:=hl shifted sh; draw hl; endfor
clip currentpicture to p)
enddef;
Pouziti je jednoduche: vlozite uvedeny kod nekde na zacatek
Vaseho zdrojoveho textu, vyrobite si uzavrenou krivku p
ohranicujici oblast, kterou chcete srafovat a pak napisete
hatch p;
Predtim je mozno nastavit interni promenne hatchangle,
hatchspace a hatchshift podle Vasich preferenci. Vzhled
srafovani muzete ovlivnit pomoci prikazu withpen,
withcolor atd., tedy napriklad
hatch fullcircle scaled 4cm withpen pencircle scaled .5bp
withcolor red dashed evenly;
Vam tucne vysrafuje kruznici, pricemz srafovani bude
cervene a carkovane.
Omlouvam se pokrocilym za obsahlejsi vyklad trivialit,
ale dotaz zrejme vznesl zacatecnik a snad je na miste
urcita shovivavost.
Libor Dvorak
More information about the csTeX
mailing list