Commit 971d75a3 authored by Peter Billam's avatar Peter Billam

Marker much improved

parent aeeca63c
......@@ -266,7 +266,7 @@
g setgray
/insidesize Chess.dx Chess.markersize mul def
/basefont /Helvetica-Bold findfont def
basefont [ insidesize s length 0.7 exp div 0 0 insidesize 0 0 ]
basefont [ insidesize s length 0.6 exp div 0 0 insidesize 0 0 ]
makefont setfont % now narrowed
s space_to_centre translate
j i PlaceAt
......@@ -280,26 +280,6 @@
end
} bind def
%/MarkerSm { % j i grey_ratio boolean_charpath string_2_chars MarkerSm
% 10 dict begin
% [ /s /b /g /i /j ] { exch def } forall
% gsave
% g setgray
% /insidesize Chess.dx Chess.markersize mul def
% /basefont /Helvetica-Bold findfont def
% basefont [insidesize 2 div 0 0 insidesize 0 0] makefont setfont % narrow
% Chess.dx 3.5 div Chess.dx 6 div translate % should de-kludge this...
% j i PlaceAt
% b {
% .5 setlinewidth
% s true charpath gsave 1 setgray fill grestore stroke
% } {
% s show
% } ifelse
% grestore
% end
%} bind def
%--------------------------------------------------------------------------
/fen2board { % useage: fenstr flip fen2board
10 dict begin
......
......@@ -54,7 +54,6 @@ chess.ps - Some useful chess-handling stuff in PostScript
gsave 100 200 translate
(1rbq1rk1/1pp1ppbp/p1np1np1/8/2PPP3/2N1BP2/PP1QN1PP/R3KB1R w) false fen2board
5 2 0 true (X) Marker
5 6 0 false (13) MarkerSm
grestore
</PRE>
......@@ -66,7 +65,7 @@ This module implements in PostScript a few simple
for drawing chess diagrams,
</P><P>
This code is rolled into the
<A HREF=fen2img.html">fen2img</A>
<A HREF="fen2img.html">fen2img</A>
application, written in <I>Lua</I>
</P>
......@@ -101,9 +100,8 @@ where 0 means the square is empty, the positive numbers are White pieces,
and their negatives the Black pieces.
1=pawn, 2=knight, 3=bishop, 4=rook, 5=queen and 6=king.
</P><P>
The boolean <B>flip</B> determines whether
the board will be shown rotated 180 degrees,
from Black's point of view.
If the boolean <B>flip</B> is true then
the board will be shown rotated 180 degrees, ie: as Black sees it.
</P>
</DD><DT>
......@@ -113,33 +111,33 @@ fen_str&nbsp; flip &nbsp; fen2board</A></B>
This procedure wraps the above <I>Board</I> procedure to accept the
position in FEN syntax, see
<A HREF="https://en.wikipedia.org/wiki/Forsyth%E2%80%93Edwards_Notation">
wikipedia</A>
wikipedia</A>.<BR>
Only the first two fields of the FEN string are used.
</P><P>
The boolean <B>flip</B> determines whether
the board will be shown rotated 180 degrees,
from Black's point of view.
If the boolean <B>flip</B> is true then
the board will be shown rotated 180 degrees, ie: as Black sees it.
</P>
</DD><DT>
<B><A NAME="Marker">
row&nbsp; col&nbsp; grey_ratio&nbsp; boolean_charpath&nbsp; str &nbsp; Marker</A></B>
row&nbsp; col&nbsp; grey_ratio&nbsp; outline_only&nbsp; str &nbsp; Marker</A></B>
</DT><DD><P>
A <B>grey_ratio</B> of 0.0 means black, of 1.0 means white.
Often, a <I>grey_ratio</I> of about 0.4 when <I>charpath</I> is <I>false</I>
seems visually balanced against
a <I>grey_ratio</I> of 0.0 when <I>charpath</I> is <I>true</I
</P><P>
If <B>boolean_charpath</B> is <I>true</I> then the character is
printed in outline only, which gives a much lighter visual impression.
If the boolean <B>outline_only</B> is <I>true</I> then the character
is printed in outline only, giving a much lighter visual impression.
</P><P>
Unlike in Joao Pedro Neto's original,
the text is automatically centered in the square,
and the font (<I>Helvetica-Bold</I>) is made narrower
according to the length of the string,
so no separate <I>MarkerSm</I> procedure is necessary.
Strings longer than three characters tend not to fit in their squares.
</P>
<!--</DD><DT>
<B><A NAME="MarkerSm">
row&nbsp; col&nbsp; grey_ratio&nbsp; boolean_charpath&nbsp; string_2_chars &nbsp; MarkerSm</A></B>
</DT><DD><P>
See the <I>Postscript Language Tutorial and Cookbook</I> p.167
</P>-->
</DD></DL>
<A NAME="variables"> <HR> </A>
......@@ -157,7 +155,7 @@ The default is 40
The relative size of marker-letters inside the squares.<BR>
The default is 0.7, but if you wish, eg: to number a dozen or more
'corresponding' squares in an endgame analysis, then
<CODE>/Chess.markersize&nbsp;0.5&nbsp;def</CODE>
<CODE>/Chess.markersize&nbsp;0.4&nbsp;def</CODE>
may be more appropriate.
</DD></DL>
......
......@@ -90,7 +90,32 @@ showpage
/xmax currentpagedevice (PageSize) get 0 get def
/ymax currentpagedevice (PageSize) get 1 get def
(/home/pjb/ps/lib/chess.ps) run
gsave 40 80 translate
gsave 20 20 translate
(8/8/8/8/8/8/8/8 w) false fen2board
7 3 0.0 true (NOW) Marker
7 4 0.0 true (13) Marker
7 5 0.3 false (WW) Marker
7 6 0.3 false (ll) Marker
6 3 0.0 true (x) Marker
6 4 0.0 true (x) Marker
6 5 0.3 false (x) Marker
6 6 0.3 false (x) Marker
5 3 0.0 true (.) Marker
5 4 0.0 true (.) Marker
5 5 0.3 false (.) Marker
5 6 0.3 false (.) Marker
4 3 0.0 true (2) Marker
4 4 0.0 true (2) Marker
4 5 0.3 false (2) Marker
4 6 0.3 false (2) Marker
3 3 0.1 true (X) Marker
3 4 0.1 true (X) Marker
3 5 0.1 false (X) Marker
3 6 0.1 false (X) Marker
grestore
/Chess.markersize 0.4 def
gsave 200 400 translate
(8/8/8/8/8/8/8/8 w) false fen2board
7 3 0.0 true (NOW) Marker
7 4 0.0 true (13) Marker
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment