My program worked well using the Unicode chess symbols in the 'Dejavu Sans Mono' font, but I wanted to use the more attractive 'Chess Alpha' font. There are free downloads for Chess Alpha on several sites. I downloaded the Chess Alpha font and unzipped it. I created a directory called .fonts in my home directory using the file manager and moved Alpha.ttf into this directory. (The procedure for installing fonts is different on Windows.) I found that there was no empty light square symbol in the font, which made it useless for displaying chess positions. (The space character was too narrow.) I viewed the font using:
http://mathew-kurian.github.io/CharacterMap/
(Note that the fixed width chess board pieces are in the middle of their surrounding boxes. The variable width figurine chess pieces are at the bottom of their surrounding boxes.)
The font file did not open with BirdFont. I was able to open it with FontForge, and I managed to fix the font.
Select View > Label Glyth By > Unicode
Many of the glyphs were encoded by several Unicodes (02c7 was encoded by many Unicodes). There were no free Unicodes that I could use to add a space glyph with the same width as the other board symbols (which was 2048). The solution suggested on the web was to use an encoding that did have free space. I tried the first one in the list.
Select Encoding > Reencode > ISO 8859-1 (Latin1)
https://en.wikipedia.org/wiki/ISO/IEC_8859-1
Some of the Glytyh boxes now had no Unicode and a grey cross in the box. Right click on the first one. Select Glyph Info... Replace the character in the Unicode Char field with a space. Glyph Name then becomes "space" and Unicode Value becomes "U+0020". Click OK.
The Glyth box now showed 0020 as the Unicode. Right click on the box and select Set Width. Set Width To: shows as 2048. Click OK. The cross disappears from the 0020 box.
Select File > Generate Fonts... Click the Generate button. Ignore the warnings. FontForge said that it had fixed an error that would cause problems with Windows (something to do with OS/2). That error does not appear to be related to my changes. There is no need to save a FontForge file.
The Chess Alpha font now worked beautifully for displaying a chess position. I did not test the figurine symbols or the board edgings.
No comments:
Post a Comment