FEN-2-Chess-Diagram


Create chess diagrams in InDesign

Welcome, thank you stopping by. Now let’s see how to create scalable chess diagrams for books or magazines, ePubs, or any publishing mediums in Adobe InDesign, tested on versions CS6 – CC 2022

HOW THE SCRIPT WORKS

This ExtendedScript creates scalable chess diagrams from FEN (Forsyth Edwards Notation) by using the Chess Merida Unicode chess font first designed by Armando Hernandez Marroquin in February 5, 1998 and modified by Michaël Peeters

The chess diagram is generated via a FEN string input passed through an algorithm that converts it to a text string of Unicode characters from a specific chess font (Chess Merida Unicode font) into a text frame for easy manipulation in InDesign. These font-based diagrams can now be embedded into PDF files, ensuring that your PDF content looks perfect wherever this is printed or viewed.

NOTE: The script creates a text frame with text characters from the Merida Unicode font. For proper rendering and alignment of the diagram, all text must be left-justified, font size and leading must be the same size. In other words, make sure the settings on the text frame use default values of paragraph styles and NOT your custom paragraph settings. 

How to create a chess diagram in Adobe InDesign

  1. Open or create a document in InDesign.
  2. Use your favorite Chess GUI software or website to create a FEN string. “Copy the FEN string to Clipboard.”
  3. In InDesign, double click the Fen2chessBoard script located in your Script panel, as per the installations instructions below.
  4. Paste the FEN string in the text box input area of the dialog box. Select the desired options. Click ok.

See Figure 3, for sample chess diagram rendering and sample Fen2chessBoard dialog box.

FEN-TO-DIAGRAM-INDESIGN
Figure 3

That easy, that fast!

Options for diagram include:

  1. Double frame or single frame.
  2. Chess notation coordinates along all four sides.
  3. View the board from black’s perspective.

Why FEN-2-Chess-Diagram?

One day I wanted to create a simple pamphlet with chess content for my personal use. After exhausting googling and not finding any solution for InDesign or any professional software, that didn’t involve learning LaTeX (A technical typesetting system used for scientific documentation). I wrote an algorithm for InDesign.

I created this script so that it can be used along with the Chess Merida Unicode font, to ease create chessboard legal & illegal positions in Adobe InDesign.

The FEN-2-Chess-Diagram script saves you time – by creating a scalable font base chess diagram on a text frame. Use your favorite chess software GUI (ChessBase, lichess.org, Scid vs. PC, Hiarcs, Chess.com, etc.) to copy-paste the FEN notation into the script text box area. Select, if you want to see from the black perspective (invert position), double frame, single frame. Choose to add coordinates on the borders. Choose a font size (e.g., 16 pts) click ok, and place it in your layout.

Coding wasn’t easy, but someone had to do it! – You’re welcome, lol. (It was easier than learning LaTeX, though)

How much does this cost?

IT’S FREE! I initially created it for my personal use, but after much thought, I decided to share it with my fellow brothers and sisters who are either chess aficionados or work for one. Like Jesus said, Love your neighbor as you love yourself.

Chess Fonts for Diagrams and Figurine Notation

I also created a custom font for Figurine algebraic notation by adding glyphs from Chess Merida Unicode font. The Chess Merida Sans Pro includes three different weights regular, bold and extra bold, with their italics variant and based on Adobe’s source-sans-pro. The font is free to use and distribute under the SIL OPEN FONT LICENSE Enjoy!

How to configure/use
Figurine Algebraic Notation in Adobe InDesign

Select the Algebraic Notation copy text you want to use (e.g., “This is a sample line 1.Nf3 Nf6 2.g3 g6” See Figure 1)
Then access Chess Merida Sans Pro Algebraic stylistic sets in InDesign,
from the top toolbar select Window > Type & Tables > Character.
Click the fly-out menu at the panel’s upper right, select OpenTypeStylistic Sets and then pick Set 1. 
You can also create a a Character Style and assign a shortcut.

Figurine Algebraic Notation in Adobe InDesign
FIGURE 1

The Upper case K, Q, R, B, N letters will automatically change to their respective chess Unicode Character (e.g., KING, QUEEN, ROOK, BISHOP, KNIGHT). See Figure 2.

 I suggest you create a Character Style with the “Stylistic Sets” Set 1. You can save a lot of time using InDesign keyboard shortcuts by applying character styles to your document’s text.

Figurine-Algebraic-Notation-In-InDesign2
FIGURE 2

You can also setup a Paragraph Style using GREP to replace the specific letters K,Q,R,B,N with the “Stylistic Sets” Set 1 Then anything in Algebraic notation (e.g., “This is a sample line 1.Nf3 Nf6 2.g3 g6”) in that paragraph style would replace with the Algebraic glyphs automatically.

FEN-2-Chess-Diagram ExtendedScript installation:

  1. Install the Chess Merida Unicode fonts included in the download files.
    Please refer to your pertaining OS documentation on how to install the fonts.

  2. INSTALL THE SCRIPT – IN INDESIGN
    Open the Scripts panel as follows:
    InDesign CS6 or Later: In the Window menu, choose Utilities > Scripts.

  3. In the Scripts panel you’ll see Application and User folders. Choose the User folder.
    With User folder selected, at the top right of the panel click on the menu button and choose Reveal in Finder (Mac) or Reveal in Explorer (PC).

  4. You should now see a Scripts Panel folder. Drag the script files/folder into there and it’s installed!

  5. Switch back to InDesign and the script will be listed under the folder you put it in.
    To start the script just double-click it and enjoy!

NOTE: The script FEN2Chessdiagram saves the last settings used. For this to work, save the file in the Script Panel User folder (see #3. in installations instructions above.) If your settings are not populating in the script’s dialog box, give the script file read & write administration privileges. See your operating systems instruction on how to change read & write permission to a file or folder.

To edit a script shown in the Scripts panel, select the script and choose Edit Script from the Scripts panel flyout menu or select the script and right-click to see the Edit Script option.

Click on link below to download Script and fonts.

Acknowledgements & Thanks

Thanks to God, I wrote this script after exhausting googling and modifying existing open-source chess algorithms from Github. Their appropriate credits below and embedded in the source code and files.

Designer Armando Hernandez Marroquin for designing the Chess Merida font

Copyright (C) 2007-2016, Michael Peeters https://github.com/xeyownt
(for Chess Merida Unicode font & his work on HTMLTTChess)

Copyright (C) 2020, Jeff Hlywa https://github.com/jhlywa
(for his work on validation algorithm used in chess.js)

Source Sans Pro was designed by Paul D. Hunt under the guidance of Robert Slimbach.
https://github.com/adobe-fonts/source-sans/wiki/History-and-Menu-Info
(This package contains a derived version of some of these fonts, with the major difference that chess glyphs are now mapped to Unicode to allow portable usage in Open Type features of Adobe InDesign for Stylistic Styles Set)

Copyright (C) 2020, Cesar Moran

One thought on “FEN-2-Chess-Diagram

Comments are closed.