XeTeXCan't get fontspec package to work

Information and discussion about XeTeX, an alternative for pdfTeX based on e-Tex
Post Reply
efroselli
Posts: 24
Joined: Wed Feb 20, 2013 1:24 pm

Can't get fontspec package to work

Post by efroselli »

I'm trying to get to grips with the Fontspec package to create some custom fonts. I'm finding the documentation extremely hard to understand and the examples provided don't seem to work for me. I'm using Lyx and compiling with XeTeX.

So: I want to create a special typeface to quote interface labels in a technical document. In my document preamble, I specify a font face, let's say Garamond:

Code: Select all

\newfontface\labelfont{Garamond} 
\newcommand*{\menuitem}[1]{{\labelfont #1}}
So far, so good. Wherever I have applied the command \menuitem in my document, it shows up in Garamond.

But I cannot modify the characteristics of Garamond in any way. I'd like it in SmallCaps but I realise that is a tall order, as it may not have a SmallCaps variant installed on my Windows. But why won't this work to get it into Uppercase?

Code: Select all

\newfontface\labelfont[Letters=Uppercase]{Garamond} 
Why can't I change the colour in any way?

Code: Select all

\usepackage{xcolor}
\newfontface\labelfont{Garamond} 
\defaultfontfeatures[Garamond]{Color=444422}
or

Code: Select all

\newfontface\labelfont[Color=blue]{Garamond} 
How would I go about affecting the size?

I'd like SmallCaps and a sans serif font if possible (not Garamond, obviously), but I cant get this thing to respond on even the most elementary level.

Thanks to anyone who can sort me out.

Cheers all,
EFR

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

efroselli
Posts: 24
Joined: Wed Feb 20, 2013 1:24 pm

Can't get fontspec package to work

Post by efroselli »

Replying to myself:
Today the line of code that did not work in yesterday's post:

Code: Select all

\newfontface\labelfont[Color=blue]{Garamond}
mysteriously works. Nothing else has changed, so I'm baffled as to why.

OTOH, the Letters option still has no effect, i.e.:

Code: Select all

\newfontface\labelfont[Color=orange,Letters=Uppercase]{Garamond}
will turn my letters orange, but not put them in caps. I find it hard to believe that there are no uppercase letters in Garamond!

God this stuff is hard! Cheers all,

EFR
efroselli
Posts: 24
Joined: Wed Feb 20, 2013 1:24 pm

Re: Can't get fontspec package to work

Post by efroselli »

Answering myself again for future reference:

- Some of these options (e.g. Letters) apply only to OpenType fonts which apparently Garamond, my trial example, is not.

- The key Letters=Uppercase, even if applied to an OpenType font, apparently does not put anything into Uppercase. The documentation says: "Note that the Uppercase option will (probably) not actually map letters to uppercase.
It is designed to select various uppercase forms for glyphs such as accents and dashes". (I know, RTFM.)

- I have had better success today applying color and rgb values, but no success at all with transparency, using either the Opacity key or the two digits at the end of the rgb value. (Yes, I am using xcolor package). So far transparency does _not_ work for me as described in documentation.

Cheers to all,

EFR
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Can't get fontspec package to work

Post by cgnieder »

Concerning the uppercasing or the small caps:

If the font does not have a small caps variant or you haven't installed the small caps variant on your computer you're out of luck of course for these but uppercasing should work with LaTeX's standard way:

Code: Select all

\newfontface\labelfont{Garamond}
\newcommand*{\menuitem}[1]{{\labelfont\TexUppercase{#1}}}
Regards
site moderator & package author
Post Reply