[Tex/LaTex] How to define a series of different font styles for use in a document (like a .css style sheet)

fontsxetex

I am completely new to LaTeX so forgive me if this is a stupid question.

What I want to be able to do is specify a number of different font styles for use in different parts of my document. So for example, I might create a style called title which uses Helvetica Black at 14pt, and a style sub-title that uses Helvetica Condensed at 12pt, and a body style that uses Tahoma at 10pt in 80% grey. I would then just label the various bits of my document.

I am currently using XeLaTeX, like so:

\usepackage{xltxtra}
\setmainfont[Mapping=tex-text]{Tahoma}
\begin{document}

But this just gives me one font throughout and then the document styles the headers, etc., I don't get a chance to use a different type face, or take fine grained control. I'm probably missing something here, but I'm sure what I'm asking is possible?

Best Answer

Use \newfontfamily command, check the documentation for more details:

\documentclass{article}
\usepackage{fontspec}

\newfontfamily\MyTitle[Ligatures=TeX]{TeX Gyre Pagella}
\newfontfamily\FooBar[Numbers=OldStyle]{Foo Bar}

\begin{document}
{\MyTitle some text} {\FooBar other text}
\end{docment}