6

My high level goal is to get a good, free Baskerville font working that supports smallcaps and "rare" ligatures. I have achieved this, apart from rare ligatures, using the baskervillef package. The documentation for baskervillef seems to suggest that I should be able to get rare ligatures using the fontspec package, but this doesn't seem to work and the process of debugging this has revealed that I don't really understand how fontspec is supposed to interact with my other code. How am I supposed to use fontspec to set options for the baskervillef font?

Here is a minimum working example that successfully loads and uses the baskervillef font:

\documentclass{article}
\usepackage{lipsum}
\usepackage{baskervillef}

\begin{document}
\section*{This Is a Section Header With a Number (1995)}
\lipsum[1][1-7]

\textfrac[3]{7}{8}

\textfrac{54}{71}

\normalfont gravestone inscription (test rare ligatures)

\itshape gravestone inscription (test rare ligatures)

\normalfont \scshape Put the Queen back in the drawer

\end{document}

I compile this using xelatex which results in this output:

Enter image description here

The official documentation includes the following example code on page 2, which looks like a way to get rare ligatures:

\usepackage{fontspec}
\defaultfontfeatures[\rmfamily,\sffamily]{Ligatures=TeX}\setmainfont{baskervillef}
You could add the feature Ligatures=Rare to turn on all available ligatures for the entire document

However, whenever I load the fontspec package, either before or after loading the baskervillef package, the font stops working (output reverts to the default latex font rather than baskervillef). This occurs even if I just load the fontspec package, as well as if I include the full code (with defaultfontfeatures and setmainfont) from the documentation.

Doing so produces errors such as the following in the log file:

LaTeX Font Warning: Font shape `TU/BaskervilleF-TLF/b/n' undefined
(Font)              using `TU/BaskervilleF-TLF/m/n' instead on input line 7.


LaTeX Font Warning: Font shape `TU/BaskervilleF-LF/m/n' undefined
(Font)              using `TU/lmr/m/n' instead on input line 10.

No file TUBaskervilleF-Sup.fd.
No file TUBaskervilleF-Dnom.fd.

...

LaTeX Font Warning: Some font shapes were not available, defaults substituted.

...

And this is what the output looks like:

Enter image description here

Tangentially, the swash option mentioned in the documentation doesn't seem to be supported. This could just be that the docs documentation is of date, but I mention it because the swash option is also related to ligatures.

Here is some information about versions and my TeX setup, in case that is useful:

$ xelatex --version
XeTeX 3.14159265-2.6-0.999992 (TeX Live 2020)
kpathsea version 6.3.2
Copyright 2020 SIL International, Jonathan Kew and Khaled Hosny.
There is NO warranty.  Redistribution of this software is
covered by the terms of both the XeTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the XeTeX source.
Primary author of XeTeX: Jonathan Kew.
Compiled with ICU version 65.1; using 65.1
Compiled with zlib version 1.2.11; using 1.2.11
Compiled with FreeType2 version 2.10.1; using 2.10.1
Compiled with Graphite2 version 1.3.13; using 1.3.13
Compiled with HarfBuzz version 2.6.4; using 2.6.4
Compiled with libpng version 1.6.37; using 1.6.37
Compiled with poppler version 0.68.0
Using Mac OS X Core Text and Cocoa frameworks

And I think this includes the version of my baskervillef package (this is the first few lines of the baskervillef.sty file I could find contained in /usr/local/texlive/2020):

%%
\NeedsTeXFormat{LaTeX2e}
\def\fileversion{1.043}
\def\filedate{2017/03/10}
\ProvidesPackage{baskervillef}
    [\filedate\space v\fileversion.  Style file for BaskervilleF.]
4
  • Welcome to TeX.SE.
    – Mico
    Jan 24, 2021 at 18:56
  • don't use the baskervillef package with xelatex, it is pdflatex only. Use only fontspec. Jan 24, 2021 at 18:57
  • 1
    @UlrikeFischer while your comment is more or less in line with the answer I accepted below, it seems to conflict with the fact that I can use the baskervillef package with xelatex and it successfully changes the font, as shown in the first mwe above.
    – Vermoulian
    Jan 24, 2021 at 20:02
  • it works in the sense that is doesn't explode, but it setups the wrong font encoding for xelatex. You are only using english in your text so you don't see the problems, but try to input Grüße. See also tex.stackexchange.com/a/470987/2388 Jan 24, 2021 at 20:07

1 Answer 1

7

On page 2 of the package's user guide, one finds the instruction to run

\usepackage{fontspec}
\defaultfontfeatures[\rmfamily,\sffamily]{Ligatures={TeX,Common,Rare}}
\setmainfont{baskervillef}

in order to use the font with the fontspec package, under both XeLaTeX and LuaLaTeX, while activating "Rare" ligatures.

enter image description here

\documentclass{article}
\usepackage{fontspec}
\defaultfontfeatures[\rmfamily,\sffamily]{Ligatures={TeX,Common,Rare}}
\setmainfont{baskervillef}

\begin{document}
off fit fly office baffle often, fj ffj fb ffb fh ffh fk ffk fft

stop act spy

\itshape
off fit fly office baffle often, fj ffj fb ffb fh ffh fk ffk fft

stop act spy
\end{document}
2
  • Perfect; thanks! (Minor note: you could remove the lipsum from your answer code to make it simpler.)
    – Vermoulian
    Jan 24, 2021 at 20:00
  • @Vermoulian - Thanks -- I've deleted the instruction from the preamble.
    – Mico
    Jan 24, 2021 at 23:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .