[Date Prev][Date Next][Subject Prev][Subject Next][ Date Index][ Subject Index]

re xyWrite and PostScript



OK! The other shoe dropped. Here's something to file away in case you ever
need to build a width table for a Type 1 font that has no .AFM file and you
have a software interpreter. This code, made into a file and called from the
system prompt, creates a *disk file* of character widths set up to be edited
into a xyWrite printer driver width table. Editing directions are at the top
of the file of widths. I wrote my first xyWrite width table in a few minutes
last night using it. David Clarke  wrote the
utility; I made it xyWrite-specific.

sad the code from %!PS- through the "% sample" section that ends "/Architect
swidths" to a file; I called mine widtbl2f.ps.

To create a widths file, edit the "% sample" section at the end of
widtbl2f.ps to handle the font you want widths for. From the system prompt,
invoke your interpreter with the name you choose for this PS file, a
pipe-to-file symbol, and the name of the output file, e.g.:
	gs32 widtbl2f.ps > widtable.pr4

If you use hardware PS, have no software interpreter, and need to build a
width table, you still can get widths as hard copy with David's pwidths code
I posted a few days ago.

Note: The number in the "findfont 200 scalefont setfont" line determines the
widths the code generates. David used 1000; xyWrite seems to want 200. I
suggest reducing the scalefont number in pwidths too from 1000 to 200. 	--A

===========================================================

%!PS-
%	Simple outputter of character widths
%	Outputs to console/return channel
%	by David Clarke 
/swidths
{	/w 256 array def /e 256 array def dup /n exch def
	findfont 200 scalefont setfont
	0 1 255 { dup dup currentfont /Encoding get exch
		 get dup e 4 -1 roll 3 -1 roll put
		 /.notdef ne{ dup (_) dup 0 4 -1 roll put
			 stringwidth pop cvi }
			 { 0 }ifelse w 3 1 roll put
		}for
	/Courier findfont 10 scalefont setfont
	(; Remove header ^^^.\n; BC ci \\; \;XC)print
	(\n; Block from line after SW=?? through last meaningful )print
	(line before ET:\n; Sort. Delete the many " =0 ; NNN.	)print
	(.notdef" lines at the beginning.\n;\n; Overwrite )print
	(space before each = with char described on that line.)print
	(\n; \(You may need to consult your sub table for )print
	(some.\)\n; BC ci \;WW\ \XC\n; What )print
	(remains is a width table for the font. See other )print
	(width tables\n; for form \(e.g., consolidate chars )print
	(with same widths to one entry\).\n; cf. xyWrite )print
	(documentation re SW=??\n;\nWD:)print n = (SW=??)print
	0 1 255 {	dup dup (\n =)print w exch get 6 string cvs = flush
		(\t;\t\t\t)print 6 string cvs print (.\t)print
		e exch get 30 string cvs print
		}for
	(\n;\nET\n;\n)print
}def

% Sample usage:
	(C:\\PSF\\ARCHTECT.PFA)run
	/Architect swidths

========================== annie fisher  nyc