view etc/mule/m2ps.ps @ 84:ac0620f6398e r20-0b92

Import from CVS: tag r20-0b92
author cvs
date Mon, 13 Aug 2007 09:08:29 +0200
parents 131b0175ea99
children
line wrap: on
line source

%!PS
%% PostScript Header for use by m2ps Ver.2.2
%%   Copyright (C) 1992 Free Software Foundation, Inc.
%%
%% This file is part of Mule (MULtilingual Enhancement of GNU Emacs).
%% 
%% Mule is free software distributed in the form of patches to GNU Emacs.
%% You can redistribute it and/or modify
%% it under the terms of the GNU General Public License as published by
%% the Free Software Foundation; either version 1, or (at your option)
%% any later version.
%% 
%% Mule is distributed in the hope that it will be useful,
%% but WITHOUT ANY WARRANTY; without even the implied warranty of
%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%% GNU General Public License for more details.
%% 
%% You should have received a copy of the GNU General Public License
%% along with GNU Emacs; see the file COPYING.  If not, write to
%% the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
%% 
%%  92.10.8  written by K.Handa <handa@etl.go.jp>
%%  92.12.15 modified by K.Handa <handa@etl.go.jp>
%%	Support composite character.

/Mydict 200 dict def	% define a working dictionary
Mydict begin		% start using it.

%%%% Font Manipulation

/imagemaskmatrix [0 0 0 0 0 0] def

/BuildGlyphDefault {		% fontdict charname  BuildGlyphDefault  -
    0 begin
    1 index /CharData get exch get /ch exch def
    /FontSize get /fs exch def
    ch 0 get fs div 0 ch 1 4 getinterval { fs div } forall setcachedevice
    ch 5 get ch 6 get 2 copy
    0 gt exch 0 gt and {
        true
        imagemaskmatrix
        dup 0 fs put dup 3 fs neg put
        dup 4 ch 7 get put dup 5 ch 8 get put
        ch 9 1 getinterval cvx
        imagemask
    } {
	pop pop
    } ifelse
    end
} bind def    

/BuildGlyphNoCache {		% fontdict charname  BuildGlyphNoCache  -
    0 begin
    1 index /CharData get exch get /ch exch def
    /FontSize get /fs exch def
    ch 0 get fs div 0 setcharwidth
    ch 5 get ch 6 get 2 copy
    0 gt exch 0 gt and {
        true
        imagemaskmatrix
        dup 0 fs put dup 3 fs neg put
        dup 4 ch 7 get put dup 5 ch 8 get put
        ch 9 1 getinterval cvx
        imagemask
    } {
	pop pop
    } ifelse
    end
} bind def    

/BuildGlyphDefault load 0 6 dict put
/BuildGlyphNoCache load 0 6 dict put

/work 4 string def

/nf {			% font fontname fsize bbox rel cache  nf  -  % NEWFONT
    13 dict begin
    /FontType 3 def
    %ifelse
        { /BuildGlyph { BuildGlyphDefault } def }
        { /BuildGlyph { BuildGlyphNoCache } def }
    ifelse
    /Relative exch def
    /FontBBox exch def
    /FontSize exch def
    /FontMatrix [1 0 0 1 0 0] def
    /Encoding 256 array %def
        dup 0 1 255 {
            dup (XXX) cvs
            (CXXX) work copy pop
            work exch 1 exch putinterval
            work cvn
            put dup
        } for pop
    def
    /CharData 256 dict def
    /BuildChar {
	1 index /Encoding get exch get
	1 index /BuildGlyph get exec
    } def
    dup currentdict
    end
    definefont pop
    findfont FontScale scalefont def
} bind def

/g {				% charname chardata  g  -	% NEWGLYPH
    currentfont begin
    CharData begin def end
    end
} bind def

/f {				% font  f  -			% SETFONT
    setfont
} bind def
    
%%%% Page Control
/bp {				% -  bp  -		% BEGIN OF PAGE
    ShortMemory { save /SaveImage exch def } if
    erasepage
    /y TopMargin def
    LeftMargin y moveto
} bind def

/ep {				% -  ep  -		% END OF PAGE
    copypage
    ShortMemory { SaveImage restore } if
} bind def

%%%% Miscellaneous Routines for reducing traffic

/r {				% x  r  -		% MOVE RIGHT
    0 rmoveto
} bind def

/n {				% -  n  -		% NEWLINE
    /y y LinePitch sub def LeftMargin y moveto
} bind def

/s {				% string  s  -		% SHOW STRING
    show
} bind def

/cs1 {				% string cs1 -		% SHOW COMP-CHAR
    dup 0 get /ch exch def
    currentfont /CharData get currentfont /Encoding get ch get get
    dup 2 get /lly exch def
    4 get /ury exch def
    currentfont /Relative get /rel exch def
    ury rel lt { /ury rel def } if
    lly 0 gt { /lly 0 def } if
    currentpoint /yy exch def /xx exch def
    show
} bind def

/cs2 {				% string cs2 -		% SHOW COMP-CHAR
    gsave
    dup 0 get /ch exch def
    currentfont /FontSize get /fs exch def
    currentfont /CharData get currentfont /Encoding get ch get get
    dup 2 get /llyy exch def
    4 get /uryy exch def
    xx yy moveto
    llyy rel ge {
	0 ury llyy sub 1 add fs div FontScale mul rmoveto
	/ury ury llyy sub uryy add 1 add def
    } { uryy 0 le {
	0 lly uryy sub 1 sub fs div FontScale mul rmoveto
	/lly lly uryy sub llyy add 1 sub def
    } {
	uryy ury gt { /ury uryy def } if
	llyy lly lt { /lly llyy def } if
    } ifelse } ifelse
    show
    grestore
} bind def

/cs3 {				% string cs3 -		% SHOW COMP-CHAR
    gsave
    xx yy moveto show
    grestore
} bind def

end		% end of Mydict