% GOO/E macros
% This is a replacement file for gooemacs.tex as
% distributed in sgf2tex-3.0
%
\font\titlefont=cmr8 at 16pt
\font\eightpoint=cmtt8
% the normal go* font chars are 12pt high, 0pt deep, and 12pt wide
\font\gooa=gooa%    stones numbered   1- 99, black odd,  white even
\font\goea=goea%    stones numbered   1- 99, black even, white odd
\font\goob=goob%    stones numbered 100-199, black odd,  white even
\font\goeb=goeb%    stones numbered 100-199, black even, white odd
\font\gooc=gooc%    stones numbered 200-299, black odd,  white even
\font\goec=goec%    stones numbered 200-299, black even, white odd
\font\good=good%    stones numbered 300-399, black odd,  white even
\font\goed=goed%    stones numbered 300-399, black even, white odd
\font\gobl=gobl%    black stones marked with italic letters 1='a', 26='z'
\font\gowl=gowl%    white stones marked with italic letters 1='a', 26='z'
\font\gooegb=gooegb%    special glyphs:
                   %    \char43'+'=empty intersection in the center of the board
                   %    40'('=top edge, 41')'=bottom edge
                   %    91'['=left edge, 93']'=right edge
                   %    60'<'=upper left corner, 62'>'=upper right corner
                   %    44','=lower left corner, 46'.'=lower right corner
                   %    42'*'=hoshi point
                   %    64'@'=black stone, 33'!'=white stone
                   %    58':'=black triangled stone, 59';'=white triangled stone
\font\gooemt=gooemt%    lines sticking out from underneath stones:
                   %    43'+'=in the center of the board
                   %    40'('=at top edge, 41')'= at bottom edge
                   %    91'['=at left edge, 93']'=at right edge
                   %    60'<'=at upper left corner, 62'>'=at upper right corner
                   %    44','=at lower left corner, 46'.'=at lower right corner
% \setGoFonts sets all the go fonts to size of #1
\def\setGoFonts at #1 {
    \font\gooa=gooa at #1
    \font\goea=goea at #1
    \font\goob=goob at #1
    \font\goeb=goeb at #1
    \font\gooc=gooc at #1
    \font\goec=goec at #1
    \font\good=good at #1
    \font\goed=goed at #1
    \font\gobl=gobl at #1
    \font\gowl=gowl at #1
    \font\gooegb=gooegb at #1
    \font\gooemt=gooemt at #1
}
% the bgo* font chars are 14.4pt high, 0pt deep, and 14.4pt wide
\font\bgooa=gooa at 12pt
\font\bgoea=goea at 12pt
\font\bgoob=goob at 12pt
\font\bgoeb=goeb at 12pt
\font\bgooc=gooc at 12pt
\font\bgoec=goec at 12pt
\font\bgood=good at 12pt
\font\bgoed=goed at 12pt
\font\bgobl=gobl at 12pt
\font\bgowl=gowl at 12pt
\font\bgooegb=gooegb at 12pt
\font\bgooemt=gooemt at 12pt
\def\gool{
  \def\4##1##2##3{\if##1?\gooegb ##3 \else \gobl\char##1##2 \fi}%
  \def\5##1##2##3{\if##1?\gooegb ##3 \else \gowl\char##1##2 \fi}%
}
\def\bgool{
  \def\4##1##2##3{\if##1?\gooegb ##3 \else \bgobl\char##1##2 \fi}%
  \def\5##1##2##3{\if##1?\gooegb ##3 \else \bgowl\char##1##2 \fi}%
}
\newdimen\goIntWd % width of a goboard intersection
\newdimen\goIntHt % height of a goboard intersection
\newdimen\goTextAdj % amount to lower stones in \textstone macro, or raise labels on boards
\def\goo{\offinterlineskip\parindent=0pt\parskip=0pt\obeylines%     black odd, white even
\setbox0\hbox{\gooegb +}\global\goIntWd=\wd0\global\goIntHt=\ht0\global\goTextAdj=2pt%
  \def\0##1##2##3{\if##1?\gooegb ##3 \else \gooa\char##1##2 \fi}%
  \def\1##1##2##3{\if##1?\gooegb ##3 \else \goob\char##1##2 \fi}%
  \def\2##1##2##3{\if##1?\gooegb ##3 \else \gooc\char##1##2 \fi}%
  \def\3##1##2##3{\if##1?\gooegb ##3 \else \good\char##1##2 \fi}%
  \def\4##1##2##3{\if##1?\gooegb ##3 \else \gobl\char##1##2 \fi}%
  \def\5##1##2##3{\if##1?\gooegb ##3 \else \gowl\char##1##2 \fi}%
  \def\-##1##2{\gooegb ##1}%
  \def\!##1{\leavevmode\hbox to \goIntWd{\hss\raise\goTextAdj\hbox{\rm ##1}\hss}}% #1 on empty intersections
}
\def\goe{\offinterlineskip\parindent=0pt\parskip=0pt\obeylines%     black even, white odd
\setbox0\hbox{\gooegb +}\global\goIntWd=\wd0\global\goIntHt=\ht0\global\goTextAdj=2pt%
  \def\0##1##2##3{\if##1?\gooegb ##3 \else \goea\char##1##2 \fi}%
  \def\1##1##2##3{\if##1?\gooegb ##3 \else \goeb\char##1##2 \fi}%
  \def\2##1##2##3{\if##1?\gooegb ##3 \else \goec\char##1##2 \fi}%
  \def\3##1##2##3{\if##1?\gooegb ##3 \else \goed\char##1##2 \fi}%
  \def\4##1##2##3{\if##1?\gooegb ##3 \else \gobl\char##1##2 \fi}%
  \def\5##1##2##3{\if##1?\gooegb ##3 \else \gowl\char##1##2 \fi}%
  \def\-##1##2{\gooegb ##1}%
  \def\!##1{\leavevmode\hbox to \goIntWd{\hss\raise\goTextAdj\hbox{\rm ##1}\hss}}% #1 on empty intersections
}
\def\bgoo{\offinterlineskip\parindent=0pt\parskip=0pt\obeylines%     big font, black odd, white even
  \setbox0 \hbox{\bgooegb +} \global\goIntWd=\wd0 \global\goIntHt=\ht0 \global\goTextAdj=3pt%
  \def\0##1##2##3{\if##1?\bgooegb ##3 \else \bgooa\char##1##2 \fi}%
  \def\1##1##2##3{\if##1?\bgooegb ##3 \else \bgoob\char##1##2 \fi}%
  \def\2##1##2##3{\if##1?\bgooegb ##3 \else \bgooc\char##1##2 \fi}%
  \def\3##1##2##3{\if##1?\bgooegb ##3 \else \bgood\char##1##2 \fi}%
  \def\4##1##2##3{\if##1?\bgooegb ##3 \else \bgobl\char##1##2 \fi}%
  \def\5##1##2##3{\if##1?\bgooegb ##3 \else \bgowl\char##1##2 \fi}%
  \def\-##1##2{\bgooegb ##1}%
  \def\!##1{\leavevmode\hbox to \goIntWd{\hss\raise\goTextAdj\hbox{\rm ##1}\hss}}% #1 on empty intersections
}
\def\bgoe{\offinterlineskip\parindent=0pt\parskip=0pt\obeylines%    big font, black even, white odd
  \setbox0 \hbox{\bgooegb +} \global\goIntWd=\wd0 \global\goIntHt=\ht0 \global\goTextAdj=3pt%
  \def\0##1##2##3{\if##1?\bgooegb ##3 \else \bgoea\char##1##2 \fi}%
  \def\1##1##2##3{\if##1?\bgooegb ##3 \else \bgoeb\char##1##2 \fi}%
  \def\2##1##2##3{\if##1?\bgooegb ##3 \else \bgoec\char##1##2 \fi}%
  \def\3##1##2##3{\if##1?\bgooegb ##3 \else \bgoed\char##1##2 \fi}%
  \def\4##1##2##3{\if##1?\bgooegb ##3 \else \bgobl\char##1##2 \fi}%
  \def\5##1##2##3{\if##1?\bgooegb ##3 \else \bgowl\char##1##2 \fi}%
  \def\-##1##2{\bgooegb ##1}%
  \def\!##1{\leavevmode\hbox to \goIntWd{\hss\raise\goTextAdj\hbox{\rm ##1}\hss}}% #1 on empty intersections
}
\def\textstone#1{\lower\goTextAdj\hbox{#1}}
\def\\{{\char'134}}
