Fonts & Character SetsFont selection with otfinst

Information and discussion about fonts and character sets (e.g. how to use language specific characters)
Post Reply
theo moore
Posts: 72
Joined: Thu Jan 15, 2009 3:16 pm

Font selection with otfinst

Post by theo moore »

I have been typesetting my document with XeTeX and fontspec thus far. However, I'm not too happy with the lack of microkerning for XeTeX so I'd like to switch to using OpenType fonts coupled with the otfinst program.

Requirements: My document is being typeset in Adobe Caslon Pro for the main body text, and a sans-serif for the captions. Fontsize commands are used throughout to re-define headers and so forth. One important re-definition is:

Code: Select all

\renewcommand{\normalsize}{\fontsize{11}{14}\fontspec{Adobe Caslon Pro}}
\renewcommand{\footnotesize}{\fontsize{11}{14}\fontspec{Optima Regular}}
So you see, I've been using fontspec to select the fonts of my documents.

I've used the otfinst program to generate the necessary files for using OpenType fonts without XeTeX. I tested it on MinionPro, and once the necessary files were generated, I simply used this:

Code: Select all

\documentclass{book}
\usepackage{minion}

\begin{document}
This is testing the Minion font
\end{document}
Now the minion style file generated by otfinst looks like this:

Code: Select all

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{minion}[2010/06/21 Minion Pro]
\RequirePackage[LY1]{fontenc}
\RequirePackage{textcomp}
\RequirePackage{xkeyval}
\RequirePackage{nfssext}
\def\@makefnmark{\hbox{\sustyle\@thefnmark}}
\providecommand*{\textfrac}[2]{%
  \textsu{#1}%
  \textfractionsolidus
  \textin{#2}}
\define@key{pmn}{scaled}[1.0]{\def\pmn@scaled{s*[#1]}}
\define@key{pmn}{family}[rm]{\def\pmn@family{#1}}
\DeclareOption*{%
  \begingroup
  \edef\x{\endgroup
    \noexpand\setkeys{pmn}{\CurrentOption}}%
  \x}
\newcommand*{\pmn@style}{j}
\DeclareOption{lining}{%
  \renewcommand*{\pmn@style}{x}%
}
\DeclareOption{oldstyle}{%
  \renewcommand*{\pmn@style}{j}%
}

\newcommand*{\pmn@default}{%
  \renewcommand*{\rmdefault}{pmn\pmn@style}%
}

\DeclareOption{rm}{%
  \renewcommand*{\pmn@default}{}%
  \renewcommand*{\rmdefault}{pmn\pmn@style}%
}

\DeclareOption{sf}{%
  \renewcommand*{\pmn@default}{}%
  \renewcommand*{\sfdefault}{pmn\pmn@style}%
}

\DeclareOption{tt}{%
  \renewcommand*{\pmn@default}{}%
  \renewcommand*{\ttdefault}{pmn\pmn@style}%
}

\ProcessOptions*
\pmn@default
\endinput
My question is, how do I select fonts in a similar manner to fontspec, after having generated the necessary files? For example, how would I do:

Code: Select all

\fontsize{18}{20}
\fontspec{Adobe Caslon Pro}
This is a different kind of text in my document
without the fontspec package? Basically: How do I use multiple fonts in a document?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
Post Reply