Make tex font packages work with \require #1075
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR makes the changes needed to the font extension infrastructure to allow a TeX font package to be loaded via
\require
(e.g.,\require{dsfont}
) and have it load the needed font.The
components/mjs/input/tex/extension.js
file exports a function that does the work of loading and adding a font extension, simplifying thedsfont
,bbm
andbboldx
component files. This sets up the needed path for the extension, and the load hook that loads the font extension and adds it into the output jax when it is loaded.To do this, the common output jax gets a new
addExtension()
function that looks up the font extension and adds it to the current font for that output jax. The chtml output jax overrides this so that it can add the needed CSS rules to load the fonts needed for the extension, if any. These come from a modifiedaddExtension()
in theChtmlFontData
object, which produces the needed@fontface
rules and passes them back so that the output jax'saddExtension()
can insert the rules into the chtml stylesheet.The common FontData object now saves the complete
FontExtensionData
object so that it can be used in the common output jax'saddExtension()
to add the extension to its existing font.Finally, the
bboldx
extension is modified to configure thetextmacros
packages in itsconfig()
method rather than via itsoptions
setting. This is because when you use\require{bboldx}
, this forces thetextmacros
package to be loaded and configured beforebboldx
is, and so thetextmacros
packages have already been processed beforebboldx
adds its package. So this allowsbboldx
to adds the package after the fact. You need to merge thetextcomp-textmacros
branch in order for this to work, since it includes changes totextmacros
that are needed for theconfig()
method to work (thetextConf
object).I'm sorry to be adding yet another PR for beta.5, but since we are including the font extensions, it is probably best to have them work with
\require
.