I am new to TeX, working on an iPhone/iPad app that displays pages from a collection of PDF documents. Every PDF document in the collection contains one or more math expressions. Each PDF file is fairly small, but the overall collection has thousands of files.
Using a default LaTeX configuration, each file ends up containing about 3 - 8 subsetted Postscript Type 1 fonts (Latin Modern, Computer Modern, etc.), and there is a lot of repetition of fonts from file to file.
I'm trying an experiment to see if we can decrease the overall size of the document collection (note that another obvious solution, merging the small PDF files into larger PDF files is problematic for reasons I won't go into here):
Starting with iOS 13, apps are allowed to install fonts. I may be able to decrease the size of the overall collection by not embedding any fonts in the individual PDF documents. Instead, my app would install the fonts that are needed and, hopefully, iOS' PDF display framework (PDFKit) will pick up on all fonts needed to display the PDF documents from its environment. (In the PDF spec, viewers are supposed to default to searching for fonts in the display environment if they cannot be found within the document.)
One limitation is that iOS' new font management framework only works with what Apple calls "modern" fonts: TrueType and OpenType. Several of the fonts that TeX uses by default (Computer Modern, Latin Modern, etc.) cannot be installed because they are Postscript Type 1 fonts, which Apple apparently considers to be a non-"modern" 1980's technology.
For this experiment, I created a simple test file that uses unicode-math and OpenType fonts (which required switching from using LaTeX to LuaLaTeX). I'm not sure it was necessary to use unicode-math, but it was an easy way to bring in several OpenType font packages:
\documentclass{article}
\usepackage{fontspec}
\setmainfont{texgyrepagella-regular.otf}
\usepackage{unicode-math}
\usepackage{mathtools}
\setmathfont{texgyrepagella-math.otf}
\begin{document}
Here comes a math expression:
\[x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}\]
\end{document}
I am running into some snags, and need help with the following questions:
Question 1: When I generate a PDF file using the source above, then look at it with the Properties/Fonts dialog in Acrobat Reader, I do see the TeXGyrePagella fonts listed, but they are described as "Type 1 (CID)". I was expecting the description to say something like "OpenType". I assume that "Type 1 (CID)" is a more specific description of one kind of OpenType font. Can anyone confirm my assumption? (See screenshot at the end of this question.)
Question 2: How can I generate a PDF file in which the fonts are not embedded at all? I see a lot of advice on tex.stackexchange about how to generate PDF files where the entire font is embedded with no subsetting, but I want to do the opposite: I don't want any fonts to be embedded.
Question 2b: Experimenting with LaTeX, I was able to eliminate some of the embedded fonts by using the \pdfcompresslevel=0
and \pdfobjcompresslevel=0
commands. What is the equivalent of these commands in the LuaLaTeX environment?