Cover letter with style - part two
This is the second part of the tutorial Cover letter with style. You can find the first part here.
In this second part, we will change the default fonts using fontspec. Forget importing Postscript fonts, classifying them under the NFSS1 and other crazy stuff: fontspec is able to load opentype fonts and select them very easily. You have just to install the fonts on your system. For example, I bought Garamond e Gill Sans fonts from Adobe and I'm using Ubuntu, so I copied the *.otf files somewhere under the
/usr/share/fonts
and then I updated the font cache with this command
sudo fc-cache -fv
Last thing you will need is to take note of the exact name of the font family, to be able to select it. For that, after having installed the lcdf-typetools ubuntu package, you can do something like
otfinfo -i /usr/share/fonts/AGaramondPro-Regular.otf | grep Family
Ok, after those few steps I have installed the fonts and discovered their family name, say, "Adobe Garamond Pro" and "Gill Sans Std". Now just change the template (remember, standard.lco) as this:
-
\ProvidesFile{standard.lco}[%
-
2002/07/09 v0.9a LaTeX2e unsupported letter-class-option]
-
-
\usepackage{fontspec}
-
-
% ==============================================
-
% PERSONAL DATA
-
% ==============================================
-
\setkomavar{fromname}{Iulius Caesar}
-
\setkomavar{fromaddress}{Van Eeghenlaan 69\\1691QT Amsterdam\\Nederland}
-
\setkomavar{fromphone}{+31 (0)22 7394203}
-
\setkomavar{fromemail}{iulius@gmail.com}
-
\setkomavar{fromfax}{+31 (0)71 5144543}
-
\setkomavar{fromurl}{http://stefano.italians.nl}
-
\setkomavar{frombank}{Postbank 9307157}
-
\setkomavar{place}{Amsterdam}
-
\setkomavar{signature}{Iulius Caesar}
-
-
% ==============================================
-
% FORMATTING STUFF
-
% ==============================================
-
-
% === font settings
-
\defaultfontfeatures{Mapping=tex-text}
-
\setmainfont {Adobe Garamond Pro}
-
\setsansfont {Gill Sans Std}
-
-
-
\endinput
At line 4 I just imported the fontspec package. At line 24 I am instructing fontspec to add the ligatures TeX needs.2 At line 25 I set the main font and at line 26 I set the font to be used in case a sans serif one if needed.
Another important thing to set up, usually, is the font size and the lead. To do so, just add one more line:
-
\ProvidesFile{standard.lco}[%
-
2002/07/09 v0.9a LaTeX2e unsupported letter-class-option]
-
-
\usepackage{fontspec}
-
-
% ==============================================
-
% PERSONAL DATA
-
% ==============================================
-
\setkomavar{fromname}{Iulius Caesar}
-
\setkomavar{fromaddress}{Van Eeghenlaan 69\\1691QT Amsterdam\\Nederland}
-
\setkomavar{fromphone}{+31 (0)22 7394203}
-
\setkomavar{fromemail}{iulius@gmail.com}
-
\setkomavar{fromfax}{+31 (0)71 5144543}
-
\setkomavar{fromurl}{http://stefano.italians.nl}
-
\setkomavar{frombank}{Postbank 9307157}
-
\setkomavar{place}{Amsterdam}
-
\setkomavar{signature}{Iulius Caesar}
-
-
% ==============================================
-
% FORMATTING STUFF
-
% ==============================================
-
-
% === font settings
-
\defaultfontfeatures{Mapping=tex-text}
-
\setmainfont {Adobe Garamond Pro}
-
\setsansfont {Gill Sans Std}
-
-
%set the font size and leading
-
\renewcommand{\normalsize}{\fontsize{12.5}{17}\selectfont}
-
-
\endinput
I just added the line 29, plain old Latex directive, to redefine the \normalsize macro3. In this way I can specify the height of the font and the space in point between the lines. The values one should use really depend on so many factors... but this is not a course on basic typography.
Ok, time to generate our cover letter again. To appreciate the differences, I first show the old version:

And now with the professional fonts
Can you see the difference? I hope so. Note also the sender address: it has to be rendered in a smaller size, so KOMA-Script used the sans serif font because more legible; that's why we also specified a suitable family for sans serif font in our template.
For more information, examples and so on, I urge you to read the fontspec documentation, to get ready for the third part of the tutorial.
That's all folks. Now you can proceed to the third part.
Hi,
I really appreciate you taking the time to write these tutorials. It shows me new ways to do thing, I had never thought before.
Could you please some how provide me with a sample code for your completed CV tutorial?
Thanks
Sagun