LaTeX forum ⇒ XeTeXCan't get fontspec package to work

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

Can't get fontspec package to work

Postby efroselli » Tue Oct 29, 2013 1:14 pm

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:
  1. \newfontface\labelfont{Garamond}
  2. \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?
  1. \newfontface\labelfont[Letters=Uppercase]{Garamond}


Why can't I change the colour in any way?
  1. \usepackage{xcolor}
  2. \newfontface\labelfont{Garamond}
  3. \defaultfontfeatures[Garamond]{Color=444422}


or
  1. \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

Tags:

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

Postby efroselli » Wed Oct 30, 2013 5:37 pm

Replying to myself:
Today the line of code that did not work in yesterday's post:
  1. \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.:
  1. \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

Postby efroselli » Wed Oct 30, 2013 8:39 pm

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: 1974
Joined: Sat Apr 16, 2011 7:27 pm
Location: Germany
Contact:

Postby cgnieder » Thu Oct 31, 2013 11:26 pm

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:

  1. \newfontface\labelfont{Garamond}
  2. \newcommand*{\menuitem}[1]{{\labelfont\TexUppercase{#1}}}


Regards
Clemens
------------------------------
chemmacros · chemformula · leadsheets · xsim


Return to “XeTeX”

Who is online

Users browsing this forum: No registered users and 1 guest