[lucida] need to manually specify bold/italic fonts with current fontspec

Bruno Voisin bvoisin at icloud.com
Mon Jan 21 19:08:28 CET 2019


> On 21 Jan 2019, at 18:30, Calum Mackay <calum.mackay at cdmnet.org> wrote:
> 
> hmm. For some reason, it's not finding the bold font (at least, in my PDF, normal and bold text look the same). It does find the italic and mono-spaced fonts.
> 
> Attached a minimal example.
> 
> Am I doing something wrong here, please?

\setmainfont[Scale=0.92]{Lucida Bright OT}

works in XeLaTeX but not LuaLaTeX. This is because the bold font is actually demibold.

XeLaTeX uses the OS font libraries to identify the fonts, and they seem to resolve this transparently.

LuaLaTeX works differently. It uses the luaotfload package and the associated luaotfload-tool script to create a font name database, associating (among other things) font names with file names, at (one The Mac, which your log implies you're using)

~/Library/texlive/2018/texmf-var/luatex-cache/generic/names/luaotfload-names.lua.gz

Here's the database content about Lucida Bright OT Demibold on my setup:

  {
   ["basename"]="LucidaBrightOT-Demi.otf",
   ["familyname"]="lucidabrightot",
   ["fontname"]="lucidabrightotdemibold",
   ["format"]="otf",
   ["fullname"]="lucidabrightotdemibold",
   ["fullpath"]="/usr/local/texlive/texmf-local/fonts/opentype/bh/lucidaot/LucidaBrightOT-Demi.otf",
   ["index"]=22,
   ["italicangle"]=0,
   ["location"]="texmf",
   ["pfmweight"]=600,
   ["plainname"]="Lucida Bright OT Demibold",
   ["psname"]="lucidabrightotdemibold",
   ["size"]=false,
   ["subfamily"]="demibold",
   ["subfont"]=false,
   ["version"]="Version 1.803",
   ["weight"]="demibold",
   ["width"]=5,
  },

You can see it's demibold not bold.

To avoid having to deal with such traps, the lucidaot distribution includes undocumented fontspec configuration files

/usr/local/texlive/texmf-local/tex/latex/lucidaot/lucidabrightot.fontspec
/usr/local/texlive/texmf-local/tex/latex/lucidaot/lucidaconsoledk.fontspec
/usr/local/texlive/texmf-local/tex/latex/lucidaot/lucidagrandemonodk.fontspec
/usr/local/texlive/texmf-local/tex/latex/lucidaot/lucidasansot.fontspec
/usr/local/texlive/texmf-local/tex/latex/lucidaot/lucidasanstypewriterot.fontspec

There's a small doc at the start of lucidabrightot.fontspec that explains how this works. In short, just write

\setmainfont{LucidaBrightOT}

and you're all set for Lucida Bright OT, and similar for the other fonts. As far as I remember, it's not mentioned in the main doc because those were experimental fontspec features at the time the files were added, with the fontspec syntax changing often. I don't know whether it's considered stable now.

I don't remember how this works in combination with [Scale=0.92], which your earlier message says you're using.

As for me, I tend to do things manually, for example writing

\ifthenelse{\isundefined{\Umathchar}}%
  {\usepackage[utf8]{inputenc}
   \usepackage[T1]{fontenc}
   \usepackage{textcomp}
   \usepackage[expert,lucidasmallscale,vargreek]{lucidabr}
   \DeclareEncodingSubset{TS1}{hlh}{1}
   \DeclareTextSymbolDefault{\textbullet}{OMS}}
  {\usepackage{fontspec}
   \defaultfontfeatures{Scale=.9}
   \usepackage{unicode-math}
   \unimathsetup{math-style=ISO}
   \setmainfont{LucidaBrightOT.otf}[%
     ItalicFont=LucidaBrightOT-Italic.otf,
     BoldFont=LucidaBrightOT-Demi.otf,
     BoldItalicFont=LucidaBrightOT-DemiItalic.otf,
     Ligatures=TeX]
  \setsansfont{LucidaSansOT.otf}[%
    ItalicFont=LucidaSansOT-Italic.otf,
    BoldFont=LucidaSansOT-Demi.otf,
    BoldItalicFont=LucidaSansOT-DemiItalic.otf,
    Ligatures=TeX]
  \setmonofont{LucidaSansTypewriterOT.otf}[%
    ItalicFont=LucidaSansTypewriterOT-Oblique.otf,
    BoldFont=LucidaSansTypewriterOT-Bold.otf,
    BoldItalicFont=LucidaSansTypewriterOT-BoldOblique.otf,
    ]
  \setmathfont{LucidaBrightMathOT.otf}[%
    RawFeature=+ss04]
  \setmathfont{LucidaBrightMathOT-Demi.otf}[%
    version=bold,
    RawFeature=+ss04]
  }

Also, Herbert has written a package to deal transparently with such things (and add kerning). It's at

https://ctan.org/pkg/lucida-otf

Bruno


More information about the lucida mailing list