[XeTeX] XeLaTeX font selection

Will Robertson will at guerilla.net.au
Sat Oct 9 06:56:47 CEST 2004


(I've sent this to the XeTeX list for public comment; hope you don't 
mind!)

On 9 Oct 2004, at 11:44 AM, Jon Breitenbucher wrote:

> One minor problem with the fd files and extrafont.sty. It appears that 
> you used s for semibold, but I'm pretty sure standard naming uses sb. 
> In my files I used sb and so I get errors when using extrafont.sty. 
> Just a heads up. I'm not sure about the conventions for condensed, 
> black, extra bold, etc. I'll check my LaTeX books for some guidnance.

Hi Jon

I was afraid you'd bring up things like this :)
So far I've been a bit undecided about how rich font selection should 
work - LaTeX's NFSS is simply too limited to handle all these cases 
robustly. extrafont.sty was only supposed to be used for my own use, 
since I want every font package to define the extra commands they need 
and only those.

I'm going to ramble on here for a little bit, but William F Adams has 
promised that he's got some ideas on these things also, which he'll 
start work on again in the near future. So everything is subject to 
change ;(

Two things must be considered: 1) the low level interface: \ie, the 
codes used for \fontfamily, \fontseries, and \fontshape; and 2) the 
user interface: \ie, the commands like \bfseries, \itshape, etc. The 
hard thing for us is the series, because there are so many variations 
on weight and width (condensed/expanded).

My initial theory was to use the fontname codes (see pg. 84 in the 
fontinstallationguide.pdf)) for the the low-level interface and combine 
them for the series font selection commands. So:

Since \bfseries means "bold", I generalised this to the rule that an 
unexpanded font with some weight is selected with \Xfseries, where X is 
the fontname code of the weight in question. Thus for some common 
weights:

    \afseries = ultralight
    \lfseries = light
    \sfseries = semibold
    \bfseries = bold
    \cfseries = black
    \xfseries = extra black

I think this is -reasonably- straightforward for the user. I was going 
to set it up so that when you selected the font, the package would 
\typeout the extra commands it defines for you, so it the console 
output would be all the reference you need.

Continuing in this vein, if the font was -also- expanded or contracted, 
I'd use the fontname code of the width, Z, in \XZseries. So, Helvetica 
Neue has compressed bold and compressed black, for example. To select 
those weights respectively, you'd use the commands \bcseries and 
\ccseries.

There is a problem, however. There is no way this huge permutation of 
weights is going to be able to be used in the \textbf{} system. For 
example, \sfseries becomes \textsf{}, which clashes with sans serif. So 
then we could instead define \sbseries and \textsb{}, but that doesn't 
help because I'm sure someone will then find a condensed semibold font 
which of course becomes \textsc{}!

My more recent theory on how to organise this is to use -words- to 
describe the font properties. How novel! I don't believe the NFSS has 
any problem with things like \fontseries{bold}, or \fontshape{swash}, 
etc. So for now, I'm going to suggest that we write these .fd playing 
by ear, and let each fonts' .sty file enable the commands that we see 
fit.

If we get into a horrible mess, well, we can go back through and fix it 
all up :)

Will



More information about the XeTeX mailing list