[lltx] LuaTeX and macOS Sierra (was "Re: Removed support of dfont format in luaotfload")

Bruno Voisin bvoisin at icloud.com
Thu Jan 26 11:34:21 CET 2017


Hi Philipp,

Following is a message I posted a few days ago to the MacTeX list (private, for the group of people preparing the MacTeX distribution every year).

It's mostly about a systematic testing of the fonts in macOS 10.12 (Sierra) with both XeTeX and LuaTeX. Two conclusions in it are of direct relevance to luaotfload, and I thought might interest you:

- As a rule, luaotfload v2.7 fares much much better with the macOS fonts than v2.6. With 2.6, a number of fonts crashed LuaTeX. With 2.7, only two fonts crash it, and these are malformed.

- Sierra introduces a new "downloadable font asset" category, of fonts which are referenced by the OS but not installed. They are downloaded from Apple when requested by the user or by an app. They are then installed (on my setup at least) inside /System/Library/Assets/com_apple_MobileAsset_Font3/. Setting

	OSFONTDIR=/System/Library/Assets/com_apple_MobileAsset_Font3

in texmf.cnf then running "luaotfload-tool --update --force" allows LuaTeX to use them.

More details in the message.

I'm forwarding this in case it can be useful to you at some point. There is absolutely no need to answer this message, and I won't have the time nor opportunity to pursue the matter anyway.

Best,

Bruno


> De: Bruno Voisin <bvoisin at me.com>
> Objet: Sierra fonts
> Date: 23 janvier 2017 à 17:39:46 UTC+1
> À: "MacOS X and TeX." <mactex at tug.org>
> 
> As a New Year treat, here is an update of my macOS font catalog for Sierra. I'd been hoping to prepare it ever since Sierra went to Public Beta, but couldn't find the time. The immediate incentive came from last week's TeX Live update of jfontmaps into ptex-fontmaps: among the changes was the mention of Sierra Japanese fonts toppanbunkyu-sierra.
> 
> The most significant change in Sierra font-wise, is the introduction of "downloadable font assets": fonts which are referenced in the OS but aren't installed with it, and instead are downloaded individually at will from the Apple servers.
> 
> These fonts are listed in Font Book, which shows them greyed out and provides links to download them:
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Capture d?e?cran 2017-01-19 a? 14.11.45.png
Type: image/png
Size: 398625 bytes
Desc: not available
URL: <http://tug.org/pipermail/lualatex-dev/attachments/20170126/f794e708/attachment-0002.png>
-------------- next part --------------
> 
> The situation is described in greater detail in Apple's list of Sierra fonts at <https://support.apple.com/en-us/HT206872>.
> 
> My first encounter with downloadable fonts was when launching Mozilla Thunderbird and Adobe Illustrator CC for the first time after installing Sierra: for Thunderbird, a message popped up requesting approval for downloading and installing Osaka; for Illustrator, the same occurred for LiHei Pro, Hei and STHeiti.
> 
> Similarly, a XeTeX document calling a downloadable font produces a request like
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Capture d?e?cran 2017-01-19 a? 02.46.41.png
Type: image/png
Size: 101405 bytes
Desc: not available
URL: <http://tug.org/pipermail/lualatex-dev/attachments/20170126/f794e708/attachment-0003.png>
-------------- next part --------------
> 
> 
> Opening a Pages document (from a previous macOS version) with text in a downloadable font causes the font to be downloaded without asking for the user's permission first.
> 
> The way this seems to work is as follows:
> 
> - Font stand-ins (used probably for the greyed-out samples in Font Book) are installed with the OS at
> 
> 	/System/Library/Frameworks/ApplicationServices.framework/Frameworks/ATS.framework/Support/FontSubsets/
> 
> - When asked for, the fonts are downloaded from http://appldnld.apple.com/ios10.0/.
> 
> - They are installed in
> 
> 	/System/Library/Assets/com_apple_MobileAsset_Font3/
> 
> in directory hierarchies with random-like paths (or maybe checksum-based), one for each font file, of the form
> 
> 	/System/Library/Assets/com_apple_MobileAsset_Font3/[...].asset/AssetData/
> 
> For example
> 
> /System/Library/Assets/com_apple_MobileAsset_Font3/3abf40766b4cf50b77ebd28e6affbd1849ea61c6.asset/AssetData/Baoli.ttc
> 
> In total, that makes 48 font files and directory hierarchies.
> 
> I do not know the rationale for creating the downloadable font category. Maybe the size: the downloadable font are mostly CJK fonts; once downloaded, they amount to about 1 GB compared with 500 MB for the fonts in /System/Library/Fonts and 225 MB for those in /Library/Fonts.
> 
> With XeTeX, no problem: CoreText is aware of the downloaded fonts so XeTeX finds them. With LuaTeX, there is a problem: as mentioned in the luaotfload doc, LuaTeX doesn't look there. Based on the doc, I ended up setting
> 
> 	OSFONTDIR=/System/Library/Assets/com_apple_MobileAsset_Font3
> 
> in /Library/TeX/Local/web2c/texmf.cnf then ran "luaotfload-tool --update --force" and that worked. (Before that I had tried to use ~/Library/texmf/web2c/texmf.cnf but for some reason that didn't work.)
> 
> Other than that, I have changed the presentation of the catalog to make things more visible. The incentive this time came from LuaTeX's ditching of \mag, which implied a rewrite of my plain TeX code anyway.
> 
> Ideally the catalog should have become a table, but there was no time so I settled for the clarity and simplicity of plain TeX's tabbed alignments. Here's an extract:
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Pages from sierra-fonts-by-script-luatex.pdf
Type: application/pdf
Size: 163271 bytes
Desc: not available
URL: <http://tug.org/pipermail/lualatex-dev/attachments/20170126/f794e708/attachment-0001.pdf>
-------------- next part --------------
> 
> 
> Fonts which are "hidden" (present but not exposed by the OS) are shown greyed out.
> 
> One interesting result of this experiment is that version 2.7 of luaotfload is much more robust than the previous version 2.6. Only two macOS fonts crash it, and these are malformed: "Apple SD GothicNeo ExtraBold" and "Songti SC Light". Both belong to TrueType .ttc collections in which two distinct subfonts, with different indices, share erroneously the same full name (as revealed by FontForge).
> 
> Other than that, LuaTeX sometimes doesn't display the font (but doesn't crash). This happens for all .dfont suitcases (like Courier.dfont), but also for some other fonts. The tedious details of those bugs are given in a PS.
> 
> Font name calls in some cases proved unreliable, and had to be adjusted by hand (sometimes removing Regular from the name, sometimes using the PS name instead, sometimes using the file name and subfont index). There is no definite XeTeX vs. LuaTeX rule in this respect, sometimes XeTeX fares better, other times it's LuaTeX.
> 
> The .tex input files, their outputs with both XeTeX and LuaTeX, together with a Pages look-alike for comparison, can be downloaded (31 MB) from
> 
> https://servbox.legi.grenoble-inp.fr/file.php?h=R05e50c8c2d0c551f6769cb4f61d66a8c
> 
> Enjoy!
> 
> Bruno
> 
> 
> PS  Now the errors. For XeTeX, as before, bitmap fonts cannot be processed and end up blank. The typical messages and the fonts are
> 
> kpathsea:make_tex: Invalid fontname `Apple Color Emoji', contains ' '
> Font \testfont="Apple Color Emoji" at 11.0pt not loadable: Metric (TFM) file or installed font not found.
> 
> 	Apple Color Emoji		/System/Library/Fonts/Apple Color Emoji.ttc(0)
> 	.Apple Color Emoji UI		/System/Library/Fonts/Apple Color Emoji.ttc(1)
> 
> 	GB18030 Bitmap			/Library/Fonts/NISC18030.ttf
> 
> In addition, for three new fonts only the first character in a string "ABCDEFGHIJKLM" are displayed, with no error message. These are
> 
> 	.SF NS Display			/System/Library/Fonts/SFNSDisplay.ttf
> 	.SF NS Text			/System/Library/Fonts/SFNSText.ttf
> 	.SF NS Text Italic		/System/Library/Fonts/SFNSTextItalic.ttf
> 
> For LuaTeX, as already mentioned, two fonts crash it. The error messages and fonts are
> 
> ! error:  (file /System/Library/Fonts/AppleSDGothicNeo.ttc) (type 2): invalid TTC index number -1 (0..17), using index 0 for font AppleSDGothicNeo-ExtraBold
> !  ==> Fatal error occurred, no output PDF file produced!
> 
> 	Apple SD GothicNeo ExtraBold	/System/Library/Fonts/AppleSDGothicNeo.ttc(14)
> 
> 	Songti SC Light			/Library/Fonts/Songti.ttc(3)
> 
> In addition, .dfont suitcases together with the variable TrueType axes in Skia.ttf cannot be processed and yield blank output. The error messages and fonts are
> 
> luaotfload | db : Reload initiated (formats: otf,ttf,ttc); reason: "Font Courier not found.".
> luaotfload | resolve : sequence of 3 lookups yielded nothing appropriate.
> Font \testfont=Courier at 11pt not loadable: metric data not found or bad.
> 
> 	/System/Library/Fonts/Courier.dfont
> 	/System/Library/Fonts/Geneva.dfont
> 	/System/Library/Fonts/Helvetica.dfont
> 	/System/Library/Fonts/HelveticaNeue.dfont
> 	/System/Library/Fonts/Monaco.dfont
> 	/System/Library/Fonts/Times.dfont
> 
> 	Skia Black			/Library/Fonts/Skia.ttf
> 	Skia Black Condensed		/Library/Fonts/Skia.ttf
> 	Skia Black Extended		/Library/Fonts/Skia.ttf
> 	Skia Bold			/Library/Fonts/Skia.ttf
> 	Skia Condensed			/Library/Fonts/Skia.ttf
> 	Skia Extended			/Library/Fonts/Skia.ttf
> 	Skia Light			/Library/Fonts/Skia.ttf
> 	Skia Light Condensed		/Library/Fonts/Skia.ttf
> 	Skia Light Extended		/Library/Fonts/Skia.ttf
> 
> Finally, some fonts yield blank output and message like
> 
> Missing character: There is no A (U+0041) in font "Apple Symbols"!
> 
> in the log (not in the console). I checked in FontForge, the missing glyphs are there in the font indeed. For some fonts there is no error message at all in the LuaTeX console
> 
> 	Apple Color Emoji		/System/Library/Fonts/Apple Color Emoji.ttc(0)
> 	.Apple Color Emoji UI		/System/Library/Fonts/Apple Color Emoji.ttc(1)
> 	Apple Symbols			/System/Library/Fonts/Apple Symbols.ttc
> 	Heiti SC Light			/System/Library/Fonts/STHeiti Light.ttc(1)
> 	Heiti SC Medium			/System/Library/Fonts/STHeiti Medium.ttc(1)
> 	Heiti TC Light			/System/Library/Fonts/STHeiti Light.ttc(0)
> 	Heiti TC Medium			/System/Library/Fonts/STHeiti Medium.ttc(0)
> 	LastResort			/System/Library/Fonts/LastResort.ttf
> 
> 	Big Caslon Medium		/Library/Fonts/BigCaslon.ttf
> 	GB18030 Bitmap			/Library/Fonts/NISC18030.ttf
> 	Webdings			/Library/Fonts/Webdings.ttf
> 	Wingdings			/Library/Fonts/Wingdings.ttf
> 	Wingdings 2			/Library/Fonts/Wingdings 2.ttf
> 	Wingdings 3			/Library/Fonts/Wingdings 3.ttf
> 
> 	LiHei Pro			/System/Library/Assets/[...]/AssetData/儷黑 Pro.ttf
>  	LiSong Pro			/System/Library/Assets/[...]/AssetData/儷宋 Pro.ttf
> 	STFangsong			/System/Library/Assets/[...]/AssetData/华文仿宋.ttf
> 	STHeiti				/System/Library/Assets/[...]/AssetData/华文黑体.ttf
> 	STXihei				/System/Library/Assets/[...]/AssetData/华文细黑.ttf
> 	Yuanti SC			/System/Library/Assets/[...]/AssetData/Yuanti.ttc(0)
> 	Yuanti SC Light			/System/Library/Assets/[...]/AssetData/Yuanti.ttc(4)
> 	Yuanti SC Bold			/System/Library/Assets/[...]/AssetData/Yuanti.ttc(2)
> 
> For others there are error messages, namely
> 
> luaotfload/fontloader-2016-06-16.lua:8284: table index is nil.
> Font \testfont=Avenir at 11pt not loadable: metric data not found or bad.
> 
> 	Avenir				/System/Library/Fonts/Avenir.ttc(11)
> 
> 	Cochin Bold			/Library/Fonts/Cochin.ttc(1)
> 	Cochin Bold Italic		/Library/Fonts/Cochin.ttc(3)
> 	Cochin Italic			/Library/Fonts/Cochin.ttc(2)
> 
> Font \testfont=Lao Sangam MN at 11pt not loadable: metric data not found or bad.
> 
> 	Lao Sangam MN			/Library/Fonts/Lao Sangam MN.ttf
> 	Sinhala Sangam MN		/Library/Fonts/Sinhala Sangam MN.ttc(0)
> 	Sinhala Sangam MN Bold		/Library/Fonts/Sinhala Sangam MN.ttc(1)
> 
> 	Osaka-Mono			OsakaMono.ttf
> 
> That's all folks!



More information about the lualatex-dev mailing list