# [OS X TeX] Using FontBook to help XeTeX find TeXLive/MacTeX distributed fonts

jfbu jfbu at free.fr
Sun Jan 31 10:10:33 CET 2016

Le 31 janv. 2016 à 02:51, Michael Sharpe <msharpe at ucsd.edu> a écrit :

>>
>> [...]
>>
>> Else, under LaTeX+fontspec one must load fonts via filenames, and one then has to specify explicitly the filenames for Bold, Italic, BoldItalic. Which is annoying. Also it makes testing/contributing posts to places like tex.stackexchange.com cumbersome, as people there are not generally using Mac OS X.
>
> Many font packages in the TeXLIve distribution which contain Opentype fonts also contain one or more .fontspec files, usually located in a .../tex/latex/ branch, that work on all platforms and reduces the effort involved in font selection under xelatex. Just as an example, though not a good one typographically,
>

Michael,

This is very interesting indeed, and I had seen it before, probably from reading the documentation of one of your font packages, but I had forgotten about it !

> \usepackage{fontspec}
> \defaultfontfeatures{Mapping=tex-text}
> \setromanfont{erewhon} % reads erewhon.fontspec, extension of 'Utopia'
> \setsansfont[Scale=MatchLowercase]{zhv} % reads zhv.fontspec in nimbus15, 'Helvetica'
> \setmonofont[Scale=MatchLowercase]{zco} % reads zco.fontspec in nimbus15, 'Courier' Medium
>
> You can easily create your own .fontspec files along the model of erewhon.fontspec, and no fiddling with FontBook or moving fonts to a Mac font folder is needed.

For people interested:

texmf-dist\$ find . -name '*.fontspec'
./tex/latex/erewhon/erewhon.fontspec
./tex/latex/fbb/fbb.fontspec
./tex/latex/heuristica/heuristica.fontspec
./tex/latex/inconsolata/Inconsolatazi4.fonatspec
./tex/latex/newpx/TeXGyrePagellaX.fontspec
./tex/latex/nimbus15/nimbusmono.fontspec
./tex/latex/nimbus15/nimbussans.fontspec
./tex/latex/nimbus15/nimbusserif.fontspec
./tex/latex/nimbus15/zco.fontspec
./tex/latex/nimbus15/zcoN.fontspec
./tex/latex/nimbus15/zhv.fontspec
./tex/latex/nimbus15/ztm.fontspec
./tex/latex/tempora/tempora.fontspec
./tex/latex/xcharter/XCharter.fontspec

I am not mistaken all those (of whom a vast majority, if not all of them, is among Michael's contributions to CTAN) come with LateX font packages and NFSS font definition files for 8bit encodings.

The "*.fontspec" files seem much easier to set up than the "*.fd/*.sty" files, and perhaps an effort (don't look at me ;-) ) should me made to accompany _all_ OpenType TeXLive distributed fonts with matching ".fontspec" configuration files ?

This could originate with TeXLive itself or come with "fontspec" or possibly be a separated package ?

A master in perl (surely bash scripting is enough) could write a script examining the filenames in texmf-dist/fonts/opentype and make the creation of all those .fontspec files semi-automatic ...

Jean-François

----------- Please Consult the Following Before Posting -----------
TeX FAQ: http://www.tex.ac.uk/faq
List Reminders and Etiquette: https://www.esm.psu.edu/~gray/tex/
List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
https://email.esm.psu.edu/pipermail/macosx-tex/
TeX on Mac OS X Website: http://mactex-wiki.tug.org/
List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex