# [tex-live] Font features linked with fontspec-preparse-external apparently broken in fontspec

Bruno Voisin bruno.voisin at legi.cnrs.fr
Wed Oct 15 06:49:32 CEST 2014

> Le 15 oct. 2014 à 01:21, Akira Kakuto <kakuto at fuk.kindai.ac.jp> a écrit :
>
> Maybe a solution is:
>
> [...]
> \setmainfont[Color=Blue,%
> [...]
>
> If you use a font name, it is simpler:
>
> [...]
> [...]

Dear Akira,

Thanks for this. I should have provided more background: calling fonts by name is indeed the simplest, it works with LuaLaTeX whether the fonts are installed at the OS level or in the texmf trees, but with XeLaTeX only when the fonts are installed at the OS level.

Hence the idea was to create .fontspec config files shipped with the Lucida OpenType fonts, such that a user, not willing to install them at the OS level, could simply call LucidaBrightOT.otf say without having to specify explicitly the associated Bold/Italic/BoldItalic fonts.

Here's what Will Robertson wrote at the time fontspec v2.4 was beta-tested (on the MacTeX list), regarding the new config file mechanism:

"Its intended use is to help fonts from CTAN so they can be set up easily, since in XeTeX you have to specify bold, etc., for all fonts loaded by filename."

Based on the fontspec doc, this should work writing a file LucidaBrightOT.fontspec say containing

\defaultfontfeatures[LucidaBrightOT]
{
Extension = .otf,
BoldFont = LucidaBrightOT-Demi,
ItalicFont = LucidaBrightOT-Italic,
BoldItalicFont = LucidaBrightOT-DemiItalic
}

and then calling the font in a XeLaTeX/LuaLaTeX document via either

\setmainfont{Lucida Bright OT}
\setmainfont{LucidaBrightOT}

Except it doesn't: there are error messages about the Extension, BoldFont, etc. keys being unknown.

Looking closer, it seems \defaultfontfeatures doesn't accept keys defined through fontspec-preparse-external in fontspec-{xetex,luatex}.sty, such as Extension/BoldFont/ItalicFont/BoldItalicFont/Path/ExternalLocation. I think this is a fontspec bug, but couldn't get any confirmation so far.

My mistake largely: as a beta-tester of fontspec v2.4 I should have caught this by then, but didn't, and now Will's probably busy with other stuff.

Bruno