font installation

Bruno Voisin bvoisin at icloud.com
Fri Jun 21 20:40:06 CEST 2024


Peter Flynn wrote (speaking of fontconfig and fc-cache):

> What do people on Windows do without these utilities? I assume they 
> exist on Macs.


Norbert Preining answered:

> Mac - don't ask me, I have used it for years and still don't understand
> how this ....load of OS is actually working. Good Hardware, horrible
> Software.


Zdenek Wagner answered:

> I still do not know how to work with fonts on Mac, it sometimes works with
> symlinks, sometimes not. The old models of Raspberry have low power
> consumption so that they can be powered frm Macbook's USB and connected via
> an ethernet cable (Macbook detects the polarity so you do not care which
> type to use). My Raspberries are configured to get the IP address from DHCP
> thus I configured the DHCP server on Mac but only on ethernet, not on WiFi.
> Thus I know how to find the IP address of the Raspberry and can ssh to it.
> I have a SSH server running on Mac thus when I am on the Raspberry, I can
> mount a directory from the Mac via sshfs. I thus run TeX on the Raspberry
> using the mounted directory and use a text editor and PDF viewver on the
> Mac. And all my fonts are in texmf-local and due to limited space, I have
> only one version of TL on the Raspberry. My texmf-local is on my subversion
> server. Thus I install the fonts into texmf-local on one of my Linux
> computers, do "svn ci" and after "svn up" on the Raspberry fc-cache just
> happens and the fonts are known to Xe(La)TeX. I do not know how it works
> internaly but it works.


Seeing the above, I couldn't resist, and decided to chime in. I assume fontconfig and fc-cache can be installed on macOS (like with MacPorts or Homebrew), and TeX configured to use them, but they're not needed and TeX (as installed by MacTeX) does not use them by default.


Font locations
==============

Fonts on macOS are installed in either of

	~/Library/Fonts		-> user-specific fonts
	/Library/Fonts		-> local fonts, seen by all users
	/Network/Library/Fonts	-> network fonts

which can be modified by the user (depending on their admin rights), and

	/System/Library/Fonts	-> system fonts
	/System/Library/AssetsV2/com_apple_MobileAsset_Font7	-> downloadable fonts

which cannot be modified.

The downloadable fonts are system fonts which are not installed by default. They are alternative fonts, often for additional scripts (the precise list of installed fonts and scripts depends on the locale chosen at installation time), or soon-to-be deprecated fonts. They are visible in the Font Book application, in which they can be downloaded from the Apple servers. They are also downloaded automatically when you open a document or application that uses them.

As I write this on macOS 15 Sequoia Beta (the beta of the next macOS, to be released this fall), and does minimal testing, I realize the above might change, as one of the core OS fonts has been moved in this beta from

	/System/Library/Fonts/PingFang.ttc

to

	/System/Library/PrivateFrameworks/FontServices.framework/Resources/Reserved/PingFangUI.ttc

causing XeTeX to fail to use it.


LuaTeX
======

LuaTeX (via luaotfload) indexes all of 

	~/Library/Fonts
	/Library/Fonts
 	/System/Library/Fonts
	/Network/Library/Fonts

For it to also index the downloadable fonts directory, you need to add

	OSFONTDIR=/System/Library/AssetsV2/com_apple_MobileAsset_Font7//

to your /usr/local/texlive/texmf-local/web2c/texmf.cnf (that's what I do).


XeTeX
=====

For XeTeX, things depend on whether the fonts are called by font name or file name:

- For a font name call, XeTeX uses macOS to find the font (instead of fontconfig on Linux). Hence the font must be in the above directories, they can't be in the texmf trees (see later how to circumvent that). For example

	\font\testfont="Menlo" at 11pt
	\testfont Some text

- For a file name call, XeTeX searches the texmf trees and the current directory. The macOS font directories aren't searched, you need to use full paths, for example

	\font\testfont="[/System/Library/Fonts/Menlo.ttc:0]" at 11pt
	\testfont Some text

In order to call by name a font which isn't in the macOS font directories, you can

- Copy the font to these directories.

- Place a symlink to the font there. Last I tried (some time ago), this worked.

However, there is one drawback to this approach: imagine you do this for some TrueType or OpenType font from the texmf trees, this means luaotfload will index the font twice, for the original font in the texmf tree and for its copy or symlink in the macOS font directory.

Probably innocuous, but there is a way to avoid that: create a new library in the Font Book application, and add the font to it. macOS will see the font, hence XeTeX will be able to call it by name, but no file duplicate or symlink will be created.

This is what I do to make the Lucida OpenType fonts, which are installed in texmf-local, visible to macOS:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot 2024-06-21 at 17.23.35.png
Type: image/png
Size: 856141 bytes
Desc: not available
URL: <https://tug.org/pipermail/tex-live/attachments/20240621/7b147dae/attachment-0001.png>
-------------- next part --------------


Only thing to check with this approach: at times, an OS update may disable the fonts in the library, or remove them from it. You just have to re-enable or re-add the fonts.


Bruno Voisin



More information about the tex-live mailing list.