[XeTeX] Asterisks in fontspec (Was re: How to specify Fontin Sans?)

Joel C. Salomon joelcsalomon at gmail.com
Thu Aug 19 00:01:14 CEST 2010


(Ignore previous version; subtle but bad typo.)

On 08/18/2010 04:25 PM, Philip Taylor (Webmaster, Ret'd) wrote:
> I also followed Khaled's suggestion (after downloading
> and installing the font, and finding that it still
> didn't find it), and Khaled's suggestion also worked
> for me, but my code is very different to yours.  Can
> you explain how your's works, and why the asterisks
> and spaces ?  Mine reads :
> 
>     \documentclass [aps] {revtex4}
>     \usepackage {fontspec}
>     \setmainfont[
>          UprightFont    = FontinSans-Regular,
>          BoldFont    = FontinSans-Bold,
>          ItalicFont    = FontinSans-Italic,
>          BoldItalicFont    = FontinSans-BoldItalic,
>          SmallCapsFont    = FontinSans-SmallCaps,
>          Ligatures = TeX
>          ]{Fontin Sans}
> 
>     \begin {document}
>     The quick brown fox
>     \end {document}

Well, the font name (as opposed to the font file name) is “Fontin Sans”,
and it comes in many styles.  Actually, given the font name, fontspec
can synthesize the Bold, Italic, & Bold Italic variants automatically.
But since fontspec prefers to select small-caps by turning on an
OpenType feature, we need to tell it to select another font instead.

The font we choose has the file name “Fontin_Sans_SC_45b.otf” (or
whatever it is on your system), and has the font name “Fontin Sans”
––same as the regular version––and has the style “Small Caps” (with the
space).

As a convenience, when using the [<style>Font = <whatever>] style,
fontspec allows an asterisk, which it substitutes with the font name.
So, the invocation
	\setsansfont[SmallCapsFont = * Small Caps]{Fontin Sans}
will do everything we need; the BoldFont = … etc. is not even needed.
(See the fontspec manual §6.1.1 “Input Shorthands”.)

There is an oddity with the related Fontin (a semi-serif font); the
small-caps font has the font name “Fontin SmallCaps” and style
“Regular”.  Under LuaTeX the invocation
	\setmainfont[SmallCapsFont = * Small Caps]{Fontin}
still works, but under XɘTeX this won’t compile; there will be a
complaint about an invalid fontname that “contains ' '”.  So we get rid
of the space, and try this minimal document:
	\documentclass {minimal}
	\usepackage {fontspec}
	\setmainfont[SmallCapsFont = * SmallCaps]{Fontin}
	
	\begin {document}
	regular \textit{italic} \textbf{bold} \textsc{small-caps}
	\end {document}
Looks good… except the word “regular” is set in small-caps.

OK, next try; change the invocation to this:
	\setmainfont[UprightFont = * Regular,
		SmallCapsFont = * SmallCaps]{Fontin}
XɘTeX will now complain about the invalid fontname “Fontin Regular
SmallCaps”––wait, what?

The invocation needed under XɘTeX is this:
	\setmainfont[UprightFont = * Regular,
		SmallCapsFont = Fontin SmallCaps]{Fontin}
Why?  I don’t know.  It’s partly the fault of the font file, but why
does it work fine under LuaTeX?

—Joel Salomon


More information about the XeTeX mailing list