[XeTeX] Using relative font size in XeLaTeX

Gareth Hughes garzohugo at gmail.com
Fri Feb 6 17:46:49 CET 2009


Andy Black wrote:
> Hello,
> 
> I have another question to ask and, since it is slightly different, I'm 
> making a new thread.
> 
> I'm new to dealing with fonts in XeLaTex.  I'm using MiKTeX 2.7 on 
> Windows XP.
> 
> For my purposes, I'm converting an XML representation of linguistic 
> papers to XeLaTeX.  A user may say that a given piece of mark-up is to 
> use a font at a relative font size, using a percentage value.  For 
> example, they might say to use the "Courier New" font at 95% or "Charis 
> SIL" font at 100% or they may say to use "Abyssinica SIL" at 120% or 
> Scheherazade at 140%.  This piece of mark-up may appear within the text 
> of a paragraph, in a section title (and, hence, in a header) or as a 
> cell in a table, among other possibilities.
> 
> One reason for using this percentage (instead of an absolute point 
> value) is so that whether this mark-up appears in a section title or in 
> a footnote, the marked-up material will come out correctly.  That is, if 
> the context is a large font size, then the material is proportionately 
> large or if the context is in a small font size, then the marked-up 
> material is proportionately small.
> 
> My question is this: is it possible to do this in XeLaTeX?  I'm aware 
> that LaTeX has the \tiny, \scriptsize, ..., \huge, \Huge commands, but 
> I'm after a particular percentage of the current font size.
> 
> Thanks!
> 
> --Andy

If you use the fontspec package (automatically loaded by using the
xltxtra package) with XeLaTeX, you can use the Scale feature to define a
scaling. Thus, Scheherazade at 140% would be defined by:

\fontspec[Scale=1.4]{Scheherazade}

or, in this specific case,

\fontspec[Scale=1.4, Script=Arabic]{Scheherazade}

to turn on Arabic-script features.

Gareth.

-- 
Gareth Hughes

Department of Eastern Christianity
Oriental Institute
Pusey Lane
Oxford
OX1 2LE

+44 (0)1865 610227


More information about the XeTeX mailing list