15 February, 1995

"Gofig" PostScript for Printing Go Diagrams

The Postscript below includes definition of the "gofig" dictionary. This document describes the capabilities of that dictionary. In practice, C++ code generates the other lines of PostScript needed to

	Establish the coordinate system.
	Draw the coordinates (1...19 and A...T), if desired.
	Draw grid lines and edge lines.
	Call the hoshi and stone functions listed below, as appropriate.
        

These are the functions provided:


	x y wst		Draw a white stone
	x y bst		Draw a black stone
	x y note wstn	White stone with a note
	x y note bstn	Black ditto
	x y note spotn	Empty spot with a note
	x y hoshi	Draw a hoshi point
        

Where 'x' and 'y' are coordinates of a board intersection. They range from 0 to n-1, where n is the number of lines. (There may be different numbers of lines in each direction. The routines don't know and don't care.) The origin is at the upper left, unlike PostScript where it is at the lower left.

And where 'note' is a string. As usual in PostScript, strings are delimited at start and end with '(' and ')' respectively. Some strings are treated specially:


	(%)	draw a diagonal cross
	(+)	draw an orthogonal cross
	(#)	draw a square
	(@)	draw a circle 
	(^)	draw a triangle
	(-)	draw a dash
        

The gofig dictionary defines a number of parameters that could be adjusted. Here are their definitions in PostScript notation. The units of parameters are given as D for dimension and C for color. All dimensions are specified with 1.0 meaning the distance between rows or columns. (Since the rows are wider apart, the stones are actually ellipses.)

% basic parameters
/Black {0 0 0 setrgbcolor} def % color for Black stones: C
/White {1 1 1 setrgbcolor} def % color for white stones: C
%/BoardColor {1 1 1 setrgbcolor} def % color for board: C
/BoardColor {.94 .90 .55 setrgbcolor} def % for color printer (burlywood1): C
/linethick .04 def % linethickness: D
/noteaura .15 def % erase lines this close to letters: D
/letht .53 def % height of letters and digits: D
/notew .84 def % width of multidigit numbers: D
/bsradius .5 def % black stone radius: D
% Parameters that are currently derived, but needn't be
/bscolor /Black load def % black stone color: C
/bsnotecolor /White load def % color of notes on black stones: C
/wscolor /White load def % white stone color: C
/wsedgecolor /Black load def % color of white stone edge: C
/wsnotecolor /Black load def % color of notes on white stones: C
/wsthick linethick 5 mul 4 div def % white stone edge thickness: D
/wsradius bsradius wsthick 2 div sub def %white stone radius: D
/symradius wsradius .7 mul def % radius of symbols: D
/linecolor /Black load def % color of lines on board: C
/edgethick linethick 1.5 mul def % thickness of edge lines: D
/hoshicolor /linecolor load def % color of hoshi dot: C
/hoshiradius linethick 3 mul def % radius of hoshi dot: D
/boardnotecolor /Black load def % color of notes on empty: C
/notethick linethick 2 mul def % thickness of lines in symbols: D

The font used for notes on stones is given just before the definition of onedigitfont.