Vous êtes sur la page 1sur 5

FEN2DIAG v3.

3 User Manual

FEN2DIAG v3.3
Alastair Scott
alastair.scott@bigfoot.com http://www.comenet.co.uk/~amsco tt/fonts.htm

is to move, on which side(s) castling is possible) and are not used by FEN2DIAG. The symbols which make up the FEN string are as follows: / separates each rank, reading from the top of the board; 1 to 8 denotes 1 to 8 blank squares; Q, R, B, N, P and K denote White pieces; q, r, b, n, p and k denote Black pieces. So the first example translates to a White Queen on a8, a Black Pawn on a7 and so on. Figure 1 is a typical diagram generated by FEN2DIAG from the first example; you must have the Chess TrueType chess font installed (section ) to see the diagram properly.

September 1997
1. What is FEN2DIAG?
It is a pair of Word 6.0, 95 or 97 macros which allow you to produce high-quality chess position diagrams using TrueType chess fonts. These diagrams are generated from a position given in Forsyth-Edwards Notation or FEN. One macro works with any chess font; the other uses, to their full extent, the Hastings, Linares and Zurich fonts developed by Alpine Electronics of Powell, Wyoming, USA. FEN2DIAG is free. Do with it as you may!

2. What is FEN?
FEN summarises a chess position (not moves - just where pieces are on the board) elegantly and simply. FEN is generated by chess programs which: write FEN explicitly (e.g. Chessmaster 5000), or: allow you to set up a position and export it as an EPD file (e.g. Arasan), or: allow you to set up a position and export it, and any subsequent moves, as a PGN file (e.g. MacChess). or can be generated yourself by the FEN2CLIP macro (section ). Here are two examples of FEN: Q7/p4rkp/3q4/2p1p1N1/P1P5/8/7B/7K [FEN "1r1bk2r/2R2ppp/p3p3/1b2P2q/4QP2/4N3/1B4PP/3R 2K1 w kq - 0 1"] The first example is of the type written by Chessmaster 5000; the second example is of the type exported as (part of) PGN and EPD files, with a PGN tag (black) round it which is not used by FEN2DIAG. In the second example, the characters (blue) after the FEN string (red) give further positional details (e.g. who

q+ + + + O + +tLo +W++ +OOH p+p+ + + ++++ +++B + + + +k


Figure 1: Example diagram FEN2DIAG also supports a variation of FEN in which adjacent empty ranks are added together. So, for example, three adjacent empty ranks normally denoted /8/8/8 could be denoted /24. Thus 7K/8/P1k5/7p/8/8/8/8, the famous Rti study, could be denoted 7K/8/P1k5/7p/32.

3. Contents
The FEN2DG33.ZIP archive expands to eight files: 1. CHEQ_TT.TTF is a TrueType font (called Chess in the Windows font list) converted from the freely-distributable Adobe Type 1 CHEQ font by me. 2. README.DOC is this file. 3. FEN2DIAG.INI is an initialisation file (see section for details) which contains details of all the chess fonts I know about. If you have a chess font which isnt supported by the program, email me its details and I will include them in a future release of FEN2DIAG.

Page 1

FEN2DIAG v3.3 User Manual 4. F2D_TEST.TXT is a text file which contains examples of both types of FEN for you to try FEN2DIAG on. 5. FILE_ID.DIZ is a text file for bulletin board identification. 6. F2D_ALL.DOT (section ) is the FEN2DIAG macro which uses any of 22 chess fonts. 7. F2D_ALP.DOT (section ) is the FEN2DIAG macro which specifically uses the Alpine chess fonts. 8. FEN2CLIP.DOT (section ) is a utility macro which allows you to type in a board position on an eight by eight grid. This position is then converted to FEN and copied to the Clipboard ready for use by FEN2DIAG. If no such toolbar appears, press the right mouse button with the screen pointer over the toolbar area and select Toolbar 6 (F2D_ALP) or similar from the popup menu. After this the toolbar will appear. Then press the king button and a dialog box will open. Its appearance depends on which of the macros you are running.

5.1

F2D_ALL

This macro is run from Word 6.0, 95 or 97 when you want to use any chess font to generate a diagram. In the dialog box: Enter a FEN string into the FEN field, either by typing it in directly or by pasting (Ctrl-V) text previously cut from elsewhere. You should paste in the whole FEN string as the macro will remove any unnecessary characters; Select the font to be used for the diagram from the Font Name list. If the font you select isnt installed the diagram wont print properly. (The font you installed earlier is called Chess); Type the font size of the diagram into the Font Size field; If the font you selected contains border characters, checking the Show Border check box will draw a border round the diagram. If the font does not contain border characters, or the Show Border check box is unchecked, no border will be drawn. (The Chess, Chess Utrecht, PROChess AmerDiag and TASC Chess Figurine fonts contain border characters); Press the OK button (section ).

4. Setup
Copy CHEQ_TT.TTF to your Windows font directory (e.g. C:\Windows\Fonts); Copy the three .DOT files to your Word template directory (e.g. C:\Program Files\Microsoft Office Professional 97\Templates); Copy FEN2DIAG.INI to your Windows directory (e.g. C:\Windows). If your copy of Windows is stored in a directory other than C:\Windows copy FEN2DIAG.INI there; you must then edit the macro you are using (after loading it, as explained later, use Tools | Macro, click on FEN2DIAG in the list and press the Edit button) then change the line:
Open "C:\Windows\FEN2DIAG.ini" For Input As #1

to where you copied FEN2DIAG.INI. A hardwired pathname is, unfortunately, necessary: without it, depending on how the macro is run, Word may not be able to find FEN2DIAG.INI.

5.2

F2D_ALP

This macro is run from Word 6.0, 95 or 97 when you want to use the Alpine chess fonts to generate a diagram. In the dialog box: Enter a FEN string into the FEN field, either by typing it in directly or by pasting (Ctrl-V) text previously cut from elsewhere. You should paste in the whole string as the macro will remove any unnecessary characters; Select the font to be used for the diagram by pressing the appropriate Chess Font radio button; Select the border type by pressing the appropriate Border Type radio button. The types, and the characters which define them, are given in the Alpine Fonts User Guide; Press the OK button (section ).

5. Running FEN2DIAG
Open the appropriate .DOT file by either: double-clicking on it in Explorer (Windows 95) or File Manager (Windows 3.1), or: selecting File | Open in Word. Remember to select Document Templates from the Files of type: list box in Words Open dialog if you open it from within Word. Otherwise you wont be able to see the template. On opening the macro you should see a new toolbar with a single king button.

Page 2

FEN2DIAG v3.3 User Manual

5.3

Generating the Diagram

After you press the OK button, the diagram is generated in a new Word document window. Pressing Cancel or the close button stops the macro without generating the diagram. If the macro finds something wrong with what you entered into the dialog box you will see a warning message and the macro will stop. Possible warning messages are: 1. The FEN string is blank; 2. The FEN string contains invalid characters; 3. The font size is less than one point or more than 127 points; 4. FEN2DIAG.INI is not in the Windows directory; 5. The path to FEN2DIAG.INI does not exist; 6. Unknown Word BASIC error (should never happen); 7. Blank font selected (should never happen unless FEN2DIAG.INI is improperly edited).

Press the OK button, and the macro will stop. The FEN you produced is now stored on the Clipboard. You can then run FEN2DIAG: pressing Ctrl-V with the cursor in the FEN field will paste the FEN you produced into the field.

5.5

The Skak Font

If you select the Skak font and elect to use a border you will be asked a question before the diagram is produced. This is because the Skak font has two types of border: a plain border and one with algebraic figures (1-8 and a-h) along the left and bottom borders. On the message box press the Yes button to use the algebraic border; press the No button to use the plain border.

6. Fonts Supported
The following fonts are supported by FEN2DIAG version 3.3. Those marked can be downloaded from my Web site: Chessmaster

5.4

FEN2CLIP

FEN2CLIP should be run before FEN2DIAG if you want to use it to produce your own FEN rather than cutting and pasting the FEN from another file. Although you can work out FEN by hand FEN2CLIP is much easier. It is run by opening FEN2CLIP.DOT and pressing its button on the toolbar which appears; you may need to make the toolbar appear by performing the steps explained before in section . On pressing the button a dialog box appears with a grid of eight by eight fields which represents a chessboard. You should type one piece letter per occupied square into the appropriate fields, remembering that capital letters (KQRNBP) represent White pieces and small letters (kqrnbp) represent Black pieces. Fields representing empty squares should remain blank. When the macro is first run, all fields begin empty. To speed up typing you can either click on a field to jump the cursor to it or press Tab repeatedly to move the cursor across the files and then down to the next rank (i.e. from a8 to h8, then a7 to h7 and so on). When satisfied with what you have typed press the Copy FEN To Clipboard button. The dialog box will close and a message will appear, with the FEN representing your position replacing that in the quotation marks:

Commercial font by Eric Schiller and Willia Cone supplied with Chessmaster 5000 Free font originally by Adobe Chess Free font by Hans Bodlaender Chess Utrecht Commercial font by Steve Smith Hastings Commercial font supplied with Chess Assist ISChess Commercial font supplied with Chess Assist ISChessLR Commercial font by Steve Smith Linares Commercial fonts by Mel Merel Merel (x4) Commercial font from an old package PROChess AmerDiag Free font (Adobe Type 1 only) by Egon Mad Skak TASC Chess Figurine Free font by TASC BV which forms part of upgrade to their commercial database TASC 1.0 Free font by Alan Cowderoy Traveller Regular Commercial font by Eric Schiller and Willia Tilburg Cone Commercial font by Steve Smith Zurich

7. FAQ
Problem: The board appears jumbled; pieces are scattered across the full width of the page. Solution: Your NORMAL.DOT template uses even text justification; left justification is required for FEN2DIAG to work properly. To correct the problem: Run the macro and generate a chess position diagram; Select all eight ranks of the diagram by clicking and dragging with the mouse; Select Format | Paragraph, then the Indents and Spacing tab;

Page 3

FEN2DIAG v3.3 User Manual

Select Left from the Alignment list box; Press the OK button. The diagram should now be displayed correctly flush with the left border of the page.

FEN2DIAG.INI is a text file which contains a header followed by blocks of 38 lines. Each block defines how a chess font behaves - in particular, how its characters map to valid FEN characters and how its borders, if it contains border characters, are defined. The contents of FEN2DIAG.INI are: NumFonts=22 WhitePiece_Colour=8 BlackPiece_Colour=1 Border_Colour=6 WhiteSquare_Colour=16 BlackSquare_Colour=15 Pref_FontName=Chess Pref_FontSize=36 Pref_Border=1 Pref_Colour=1 Pref_Figurine=Chess Pref_Text=Times New Roman Pref_Diagram=Chess <Block 1 of 38 lines> <Block 2 of 38 lines> . . <Block 22 of 38 lines> not used not used not used not used not used

8. Tailpiece
Many thanks to Alan Cowderoy, Andrew Kaniak, Dale Gebhardt, Dave Regis, Egon Madsen, Mel Merel, Ian Murray-Watson, Richard Reich and Steve Smith for their suggestions - in particular, to Steve for his very generous gift of the Hastings, Linares and Zurich fonts, which have not only enabled FEN2DIAG to be greatly improved but have also sparked off ideas for a couple of other macros.

9. Version History
Version 1.0, released in July 1996, was the original version. Version 2.0, released in August 1996, added non-standard FEN handling, support for multiple and arbitrary fonts, control of borders and font size, and improved error checking. Version 3.0, released in September 1996, added separate macros for Word 6.0 and Word 95, colour handling, support for the Alpine chess fonts and for several other freeware and commercial chess fonts. It also included the Chess font, rather than the TASC Chess Figurine font supplied with previous versions. Version 3.1, released in October 1996, added the board editor, support for the PGN/EPD form of FEN, and the border characters for Chess. Version 3.2, released in December 1996, added support for another seven fonts, and now differentiates between diagram fonts and algebraic fonts. My email address was updated, and Web site details added. Version 3.3, released in September 1997, added support for Traveller Regular and the Merel fonts and added user preferences. My email address was again updated. Word 95 macros have been removed as I have decided to produce separate macros for the new Word 97, taking full advantage of its facilities. This will require a complete redesign as Word 97 has a different macro language from either Word 6 or Word 95. The version 3.3 macros will run with Word 6, Word 95 or Word 97.

not used not used not used not used

The first line gives the number of fonts supported by FEN2DIAG; currently twenty-two. The three other lines in the header which are used allow you to define your own preferred font, point size and whether a border is displayed or not: see section . There is neither space nor separating characters between header and blocks or between blocks; they run on directly from one another. Here is an example block, that for TASC Chess Figurine: FontName=TASC Chess Figurine BorderType=1 Blank_B=97 BlackKing_B=103 BlackQueen_B=102 BlackRook_B=99 BlackBishop_B=101 BlackKnight_B=100 BlackPawn_B=98 WhiteKing_B=109 WhiteQueen_B=108 WhiteRook_B=105 WhiteBishop_B=107 WhiteKnight_B=106 WhitePawn_B=104 Blank_W=65 BlackKing_W=71 BlackQueen_W=70 BlackRook_W=67 BlackBishop_W=69 BlackKnight_W=68 BlackPawn_W=66

10. Adding or Removing Fonts


Be sure to back up FEN2DIAG.INI before editing it!

Page 4

FEN2DIAG v3.3 User Manual WhiteKing_W=77 WhiteQueen_W=76 WhiteRook_W=73 WhiteBishop_W=75 WhiteKnight_W=74 WhitePawn_W=72 BorderN=121 BorderNE=88 BorderE=120 BorderSE=89 BorderS=119 BorderSW=90 BorderW=120 BorderNW=87 ContainsASCII=0 AlgebraicOnly=0 The first line gives the font name exactly as it appears in the Windows font list; The next line gives the border type: if 1, the font contains a border, if 0 it does not; The next line gives the ASCII code for a black (_B) blank square: that for TASC Chess Figurine is 97; The next twelve lines give the ASCII codes for the black and white pieces on black squares; The next line gives the ASCII code for a white (_W) blank square; The next twelve lines give the ASCII codes for the black and white pieces on white squares; The next eight lines give the ASCII codes for the border by compass point: for TASC Chess Figurine the character in the top right (NE) of the border is 88. If the font has no border all eight ASCII codes are irrelevant; The next line is a flag: if 1 the font has the normal ASCII characters available, if 0 it does not have them. This flag is not used by FEN2DIAG; The last line is another flag: if 1 the font has algebraic characters only (i.e. white pieces on white squares), if 0 it has a full set of board characters (i.e. white and black pieces on white and black squares). This flag is used by FEN2DIAG as some fonts (e.g. a subset of those supplied with ChessBase for Windows and Chess Assistant) are algebraic only. A set of 1+1+1+12+1+12+8+1+1 = 38 lines completely defines a chess font. So, if you come across a new chess font, you can make NumFonts=23 then work out the ASCII codes and add the appropriate 38 lines to FEN2DIAG.INI. When you run F2D_ALL it will automatically read in the 38 lines and you will be able to use the new font by picking it from the Font Name list on the dialog box. F2D_ALP doesnt use FEN2DIAG.INI.

11. User Preferences


User preferences allow you to use the same font, point size and border setting each time you run the macro without having to type them in or select them. They are used by the F2D_ALL macro: F2D_ALP doesnt require them as its settings are made by simple button presses. User preferences are set by editing the header of FEN2DIAG.INI as described in the previous section. The lines you change in the header to set your preferences are: Pref_FontName=font name Pref_FontSize=font size Pref_Border=(1 for yes, 0 for no) Suppose you wanted diagrams in Traveller Regular, 24point with no border. Then you would change the header lines to: Pref_FontName=Traveller Regular Pref_FontSize=24 Pref_Border=0 In this case, every time you ran F2D_ALL you would see Traveller Regular highlighted in the list of fonts, the point size set to 24 and the Use border? checkbox unchecked. Or, if you wanted diagrams in Zurich 48-point with borders, you would change the header lines to: Pref_FontName=Zurich Pref_FontSize=48 Pref_Border=1

Page 5