How to display black chess pieces within normal text with chessfss

There aren't many chessfonts which actually contain black figurine pieces. I only know the berlin family and there you need to change the font shape to access them:

\documentclass[varwidth,margin=0.5cm]{standalone}
\usepackage{chessfss}
\begin{document}
\pawn \rook \knight \bishop \queen \king

\setfigfontfamily{berlin}
\pawn \rook \knight \bishop \queen \king 

\fontshape{bl}\pawn \rook \knight \bishop \queen \king
\end{document}

enter image description here

If you want to use another chess font you will have to get suitable glyphs first. You could e.g. ask the author of skaknew to add them. I could then create support files.

Edit

You could get glyphs by taking the font with the board pieces and then create a virtual font which changes the bounding boxes so that they sit better on the line.


Since I almost don't understand anything about fonts, I have defined using adjustbox new commands which trim, resize and scale the board pieces. It is kind of an ugly workaround, I know...

\documentclass[varwidth,margin=0.5cm]{standalone}
\usepackage{chessfss}
\usepackage{adjustbox}

\newcommand{\pawnB}[1][1.3ex]{%
\adjustbox{Trim=4.3pt 2.6pt 4.3pt 0pt,width=#1,margin=0.2ex 0ex 0.2ex 0ex}{\BlackPawnOnWhite}%
}%
\newcommand{\rookB}[1][1.58ex]{%
\adjustbox{Trim=3.2pt 2.2pt 3.2pt 0pt,width=#1,raise=0ex,margin=0.1ex 0ex 0.1ex 0ex}{\BlackRookOnWhite}%
}%
\newcommand{\knightB}[1][1.85ex]{%
\adjustbox{Trim=2.3pt 2.35pt 2.5pt 0pt,width=#1,raise=-0.03ex,margin=0.14ex 0ex 0.14ex 0ex}{\BlackKnightOnWhite}%
}%
\newcommand{\bishopB}[1][1.79ex]{%
\adjustbox{Trim=2.3pt 2pt 2.3pt 0pt,width=#1,raise=-0.12ex,margin=0.1ex 0ex 0.1ex 0ex}{\BlackBishopOnWhite}%
}%
\newcommand{\queenB}[1][2.05ex]{%
\adjustbox{Trim=1.2pt 2.2pt 1.2pt 0pt,width=#1,raise=-0.08ex,margin=0.1ex 0ex 0.1ex 0ex}{\BlackQueenOnWhite}%
}%
\newcommand{\kingB}[1][1.95ex]{%
\adjustbox{Trim=2pt 2pt 2pt 0pt,width=#1,raise=-0.06ex,margin=0.13ex 0ex 0.13ex 0ex}{\BlackKingOnWhite}%
}%

\begin{document}
\pawn  \rook   \knight   \bishop   \queen  \king\\
\pawnB \rookB  \knightB  \bishopB  \queenB \kingB
\end{document}

Output with the new commands defined from the board pieces


The alpha font family has black figurines stored within \fontshape{bl}.

\documentclass{article}

\usepackage{chessfss}

\begin{document}

\setfigfontfamily{alpha}

\figfont KQRBNp

\fontshape{bl}\figfont KQRBNp

\fontshape{*}\figfont KQRBNp

\end{document}

Chess alpha font family figurines in white and black.

Tags:

Chess