Cow Font for pdfLaTeX

Cow font in some of its glory.

Cow font in some of its glory.

Way back, there were cows. Duane Bibby, responsible for the cartoons that adorn a lot of TeX and LaTeX material, drew some cows.  http://www.tug.org/TUGboat/tb27-1/tb86hoekwater-cows.pdf.  This font is part of ConTeXt, a TeX implementation.  There is no simple way to use it to its full extent on LaTeX that I know of.  But you can do this:

  1. Download http://tlcontrib.metatex.org/2012/archive/cowfont.doc.tar.xz.
  2. Extract the archive and make sure all the files go into the right places.  I would use your local (userspace) texmf tree.  For example /home/username/texmf (on Linux).  If you extract the file to a temporary directory, you can see that it obeys the Tex Directory Structure.  I must confess I just manually moved the tfm files from their place in the temp folder to /home/username/texmf/fonts/tfm/hoekwater/koeieletters/ and similarly for the other types of files just because I was not sure what would happen if I did it all automatically.
  3. You can try running the rehashing and map updating commands like:
    sudo mktexlsr

    and

    sudo updmap-sys --Enable Map koeieletters.map

    and who knows what else — it is always a bit vexed whether you need sudo and whether to use updmap or updmap-sys.  I can’t help there.

  4. The rehashing did not work properly for me.  When I ran pdflatex on my test file (see below), it found everything except the map file that tells pdftex what PostScript fonts to associate with what TeX font names.  After messing around for too long, I…
  5. …Typed
    find /usr/ -iname "*.map" | grep pdftex

    to find out where the pdftex-related map files were kept and used sudo cp to stick the koeieletters.map file in there manually (a bit naughty). (It was called koeieletters-2013.map in the archive.)

  6. Did the rehashing/updating again, and now it all worked.  But…
  7. …There is no ‘cowfont.sty’ to load to use the font in LaTeX.  So I went here: http://tex.stackexchange.com/questions/115471/using-contexts-cow-font-with-pdftex and stole the example file.  Then it worked.
  8. And one more thing: If I did not want to manually stick the map file where only root ought to tread, I could have use the commented-out line in my example below, which directs pdftex to the map file explicitly.  For something as un-useful as cow font (i.e., something that really does not need to be installed system wide), this is a reasonable thing to do.
  9. Does not work for LaTeX outputting to dvi, just for pdflatex.

The example .tex file:

\documentclass{scrartcl}
\usepackage[T1]{fontenc}
% For scalebox, load this:
\usepackage{graphics}

\DeclareFontFamily{T1}{CowFont}{}
\DeclareFontShape{T1}{CowFont}{m}{n}{<-> koeieletters}{}

\DeclareFontFamily{T1}{CowFont-contour}{}
\DeclareFontShape{T1}{CowFont-contour}{m}{n}{<-> koeieletters-contour}{}

% This next line told pdftex where to find the map file explicitly. Managed to
% remove the need for it but left in for information.
%\pdfmapfile{/home/goossens/texmf/fonts/map/pdftex/context/koeieletters.map}

\begin{document}
{\usefont{T1}{CowFont}{m}{n}

The quick brown cow jumped over the lazy fox.

10-9-8-7-6-5-4-3-2-1-0}

{\usefont{T1}{CowFont-contour}{m}{n}

The quick brown cow jumped over the lazy fox.

10-9-8-7-6-5-4-3-2-1-0}

And then back to normal text.
\vspace{2cm}
% This bit it just to get some big output to use as a screen grab in
% the blog post. And to show some characters.
\begin{center}
{\usefont{T1}{CowFont}{m}{n}
\scalebox{2}{``The cow JumPed oVer the Moon.''}\\
\scalebox{2}{1.2,3;4:5-6--7---8[9]0!}\\
\scalebox{2}{" \textbackslash\ * () \_ + = ? < > "}
}
\end{center}

\end{document}

Also useful to look here: http://tlcontrib.metatex.org/cgi-bin/package.cgi/ruid=5728462876/action=view/id=764.

 

Font pointlessness.

Advertisements

Tags: , , , , , , , , ,

About Darren

I'm a scientist by training, based in Australia.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: