# How can I make spaces appear with guidelines with this penmanship font?

I'm using a special font family for penmanship called ZNuscript. Some of the versions of this font include ruled lines that help to guide children in forming their letters. It displays just fine for any character other than a space.

If I write a sentence in LibreOffice using the font, the spaces appear as normal:

But when I use the same font in Overleaf using the XeLaTeX compiler, the spaces appear without guidelines:

I have tried using underscores, but in this font, they are almost double the width of a regular space.

Please have a look at this relevant Overleaf project to see the font files and code.

• You'll need an active space character which will likely break your document. – Henri Menke Jan 16 '20 at 5:33

You can do it with an active space character, but this has some issues as you can see in the output.

\documentclass{article}
\usepackage{fontspec}

\newfontface\tracingfont[Path=fonts/]{ZNuscriptDottedGuidedNL}

\begingroup
\catcode\ =13
\gdef\installactivespace{\catcode\ =13\def {\char"20\hskip0pt\relax}}%
\endgroup
\newcommand\tracing{\begingroup\installactivespace\dotracing}
\newcommand\dotracing[1]{\tracingfont#1\endgroup}

\begin{document}
\huge
\tracing{Here    are some spaces and if the line is too long it breaks but leaves spaces behind.}
\end{document}


• Thank you for this. For my purposes, sentences using these guidelines would never extend beyond one line as I'm using them for writing worksheets. Is that the only issue? Also, could you explain a bit more about the relevant pieces of your code? – cbunn Jan 16 '20 at 6:03