I would like to make writing practice sheets similar to the following.
How can you make "dotted" fonts like this?
The closest I saw on this forum was
How can I convert text to paths with pdflatex?
[1] but I don't know if \pscharpath
can be modified/used to do this job. Or maybe there is a TikZ solution?
Update. My plan was to position the horizontal lines using trial and error. Is there, alternatively, some way to get the correct height of a lower case and upper case letter automatically?
Here's something that seems similar to what you're after. The macro is:
\setline{<scale factor>}{<text>}
The height of scaled upper and lower case x's in the document font are measured to draw the lines. The dotted effect comes from \pdfliteral{q 1 Tr [1 4]0 d}#2\pdfliteral{Q}
where:
The pdf commands are documented in Chapter 4 of the PDF Reference [1]
q
saves the graphic state1 Tr
traces the outline of the glyph rather than filling it[1 4]0 d
sets the stroke style to (pretty much) dashed 1
on 4
off starting with a dash.Q
means restore the graphics state to what it wasEdit: Apparently the settings above are somewhat viewer dependent. The given settings with Sumatra, give the output pictured below. To get the "same" output with Adobe Reader (at least my version) Change the line given above to:
\pdfliteral{q 1 Tr [.1 .4]0 d .1 w}#2\pdfliteral{Q}
I tried it with a bunch of fonts from
The LaTeX Font Catalogue
[2] and while most worked, some didn't (in particular Calligra...not sure why). As mentioned in the comments, if you could find a suitable font then this might work for you. A couple examples of output below:
\documentclass{article}
\usepackage{graphicx}
\usepackage{dashrule}
\newsavebox\myboxX
\newsavebox\myboxx
\newdimen\heightX
\newdimen\heightx
\newcommand{\setline}[2]{%
\savebox\myboxX{\scalebox{#1}{X}}%
\savebox\myboxx{\scalebox{#1}{x}}%
\heightX=\ht\myboxX
\heightx=\ht\myboxx
\noindent\ooalign{\rule[\heightX]{\textwidth}{.1pt}\cr
\noindent\hdashrule[\heightx]{\textwidth}{.1pt}{1mm}\cr
\noindent\rule{\textwidth}{.1pt}\cr
\noindent\scalebox{#1}{#2}\scalebox{#1}{\pdfliteral{q 1 Tr [1 4]0 d}#2\pdfliteral{Q}}}%
% For Adove, use this setting rather than the one above.
%\noindent\scalebox{#1}{#2}\scalebox{#1}{\pdfliteral{q 1 Tr [.1 .4]0 d .1 w}#2\pdfliteral{Q}}}%
}
\begin{document}
\setline{5}{Abc}\vspace{1cm}
\setline{5}{De}\vspace{1cm}
\end{document}
[1] http://partners.adobe.com/public/developer/en/pdf/PDFReference.pdf[1 4]
to [.1 .4]
the result looks a bit better, so I suspect that it is a problem of setting some "base unit": i.sstatic.net/pvWf5.png - yo'
pdfliteral
commands to typeset dotted outlines of words. But the normal text that goes afterwards is misplaced. Do you have perhaps an idea how to overcome this? I have a multiline dotted text. - imz -- Ivan Zakharyaschev
page
keyword to pdfliteral, as shown at permalink.gmane.org/gmane.comp.tex.pdftex/4392 - imz -- Ivan Zakharyaschev
otftotfm
. Before doing this, make sure your font licence agreement allows it. How to get a dotted version, I don't know. - user10274