Freitag, 18. April 2014

XKCD font - gimp, LaTeX and mac

Recently I made business cards with gimp. This is a powerful graphics program I will test the next weeks. For the business cards I wanted to use a free available and useable font - the XKCD font that I once found on xkcdsucks. The font is called 'Humor Sans' and is still available.


System wide

I put it on a Mavericks into the system wide font library /Library/Fonts/ and on a Snow Leopard Macbook into the user library ~/Libray/Fonts/. Now I am able to use it systemwide in all integrated software like numbers, pages and ms office products. Nice.

LaTeX

For use in LaTeX one has to do more steps. First I tell you what I tried and at the end how I succeeded. I am still not happy with the solution as you will see. First I followed the steps given in this Macports forum. Somehow the fonts were not used. Then I tried to do it similar to chapter 2.7 in http://c.caignaert.free.fr/Install-ttf-Font.pdf. Humor Sans.fd, a *.map file and a *.tfm file were produced and were put into localtexmf/tex/latex/humor\ sans. The map-file went into .../config/. I do not know why, but this did not help too. I surely did something wrong. I think I will try again later, because I did not know the file of Christophe Caignaert I mention above. This pdf seems pretty clear. At the end I had the following preamble in my tex-document:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
...
\font\ttfxkcd xkcd at10pt

\font\ttfLargexkcd xkcd at16pt

The next parts are like this:

\makeatletter
\patchcmd{\@maketitle}{\LARGE}{\ttfLargexkcd}{}{}
\makeatother

\newcommand{\figref}[1]{Abb. \ref{#1}}
\newcommand{\xkcdcaption}[1]{\caption{\ttfxkcd #1}}
\newcommand{\xkcdrotatebox}[1]{\rotatebox{90}{\ttfxkcd #1}}
\newdateformat{mydate}{\ttfxkcd\monthname[\THEMONTH] \THEYEAR}
\date{\mydate\today}

\begin{document}
\ttfxkcd
\title{Title!!1!}
\maketitle
Text\\

\end{document}

Therefore a *.tfm, *.fd and *.ttf file of Humor Sans were put into the path and a map file. I think I produce them as described in http://c.caignaert.free.fr/Install-ttf-Font.pdf.

Gimp

At the end I used the LaTeX file rather for such things as door bell nameplates than for  business cards. The business card was produced via Gimp. And here the Macports forum discussion helped. Gimp now knows the font and produces nice pictures. But if you change the font size of Humor Sans in Gimp and export the picture as pdf, the pdf may not show the right size of the font in other software like acrobat or preview of mac.

Therefore I printed the picture as a pdf with the 'print to file' dialog. Then everything was fine.