olsak / tex-nutshell

TeX in a Nutshell -- A short document about TeX principles
4 stars 2 forks source link

some small changes #1

Closed itmm closed 3 years ago

itmm commented 3 years ago

I moved the \fontfam so that I can build the file with MMTeX without the default font installed. All but the last changes are only suggestions that I feel read more clearly than the original. Feel free to ignore them. But I believe that the should in the last change must be optional instead.

vlasakm commented 3 years ago

Just for fun, I see the number 300 repeated a lot as the number of primitives, but in LuaTeX it is actually about 700 (with more than hundred being the new math primitives). This number also doesn't really include the different PDF specific primtives (\pdfliteral, etc.) which are folded into just three primitives (\pdfextension, \pdfvariable, \pdffeedback).

vlasakm commented 3 years ago

By the way, to clarify the issue with \fontfam vs \report order:

In the MMTeX distribution, there is currently only one important change compared to upstream OpTeX: no fonts are preloaded. This means that any try to resize the fonts, before \fontfam is used, tries to resize the nullfont, which of course fails:

$ mmoptex '\report \fontfam[lm] \bye'
This is LuaHBTeX, Version 1.13.2 (mmtex v20210626)
This is OpTeX (Olsak's Plain TeX), version <1.03+ Jun.2021>
! Font \_tenbf=nullfont at 11pt not loadable: metric data not found or bad.

In the long term, I think that it would be best to not preload any fonts in upstream OpTeX. Preloaded fonts are problematic, because they are very limited -- only 256 characters and in a weird encoding (compared to input, which is encoded in Unicode). This is not what OpTeX promotes:

There are no old obscurities concerning various 8-bit encodings and various engines. We are using only Unicode and only LuaTeX. OpTeX provides a powerful font selection system (for Unicode font families, of course).

The split between old preloaded fonts and new fonts was (at least in my opinion) the root cause of many issues:

I currently don't have a satisfactory solution for loading fallback font, when \fontfam isn't used. But maybe there shouldn't be a fallback -- all font setting should be explicit.

Also, the OpenType fonts in general also take language into context. This is not currently implemented in OpTeX, but may be desirable in the future. Personally I would advise all documents to start with

\<some>lang
\fontfam[<some-font>]

Until anything better, special error will be raised when resizing of nullfont happens in MMTeX, which should make the root cause more clear.