Comments (8)
it is trying to get a bunch of font files which it can't find.
I had added a note on this at mathjax/MathJax-demos-web#3 (the copy-webpack plugin helps), I guess I should've posted it here.
It seems that the font paths are hardcode
Yes but #67 will allow you to configure the URL (should be in the next alpha release).
I got the impression that the font references were being dynamically constructed so that they could be lazily loaded. Is that right?
Yes insofar as the stylesheet is generate on the fly (so webpack won't pick up on it). Given the size of the stylesheet, it doesn't make much sense to have it separate.
from mathjax-src.
I had added a note on this at mathjax/MathJax-demos-web#3 (the copy-webpack plugin helps), I guess I should've posted it here.
Thanks - I saw that but couldn't remember where. That's copying those files to where they will be looked for in the demo. In our case (as a JupyterLab plugin), we don't get to modify the webpack config (as the plugin system now stands). It would be great if there was a way for webpack to understand where those files were.
Yes but #67 will allow you to configure the URL (should be in the next alpha release).
That helps, but still doesn't enable webpack to automatically find the fonts and package them up.
Given the size of the stylesheet, it doesn't make much sense to have it separate.
I'm curious about this - are you saying it is too large or too small?
Are you lazily loading the fonts because you are optimizing for loading time, or because the things you are loading are not known at compile time, or for some other reason? If the former, maybe we can do things in a more webpack-friendly manner. If the latter, then of course webpack won't know either, so we'll have to figure out something else.
from mathjax-src.
In our case (as a JupyterLab plugin), we don't get to modify the webpack config (as the plugin system now stands).
Right. We need to work out something that helps in such a case.
It would be great if there was a way for webpack to understand where those files were.
For the time being, maybe try a custom stylesheet specifying just the font-face
rules?
That helps, but still doesn't enable webpack to automatically find the fonts and package them up.
If not all fonts need to be local, then a CDN copy could do the trick temporarily?
I'm curious about this - are you saying it is too large or too small?
Too large.
Are you lazily loading the fonts because you are optimizing for loading time, or because the things you are loading are not known at compile time, or for some other reason?
I don't think lazy loading of fonts specifically has been considered much. (Our performance issues used to overshadow such details.) The stylesheet is generated and injected at render time; I suspect the main reason is that MathJax has simply always done that.
The stylesheet could be generated server-side (and in static content, could be optimized to only include rules needed for the given content but that won't help your use case I suspect).
However, the stylesheet is quite large as a lot of rendering logic has moved into CSS rules. We've already discussed potential shifts in the approach if that turns out to be too problematic.
Of course, browsers should only load the fonts when they're used and you can preload the fonts yourself should you want to (again, a partial, custom stylesheet should do the trick).
from mathjax-src.
Davide discussed this in the Technical Advisory committee meeting. What we decided was (feel free to correct me!):
- use a custom output jax class that generates the fontface css file, which you then capture and save to a css file. This is done once, before anything is running. Put this css file on the page however you want (for example, by including it directly with a style tag).
- Subclass the output jax to not insert the fontface URLs on the page dynamically, and pass that new output jax into the system somehow.
@dpvc said he'd work on a short example illustrating this.
from mathjax-src.
Just to add: this will be based on the new 3.0.0-alpha.2 (which is out).
from mathjax-src.
The examples are in the limited-css
branch (based off the alpha
branch), and are discussed in the developer's forum.
from mathjax-src.
Thanks! I've added a note to jupyterlab/jupyter-renderers#69 indicating we can move forward again.
from mathjax-src.
The fontURL
option is in the 3.0.0 release, so I'm closing this.
from mathjax-src.
Related Issues (20)
- Upgrading from alpha 1 to latest beta, Fira font-config HOT 4
- algebra manipulation tool HOT 3
- How is a character's height/depth retrieved? HOT 6
- "ReferenceError: window is not defined" when dev page reloaded. HOT 1
- Multiple Typescript Errors HOT 9
- delete arguments.callee HOT 2
- support for \oiint and \oiiint HOT 1
- v4: DefaultFont.js not CJS HOT 2
- how do i customize the the latex defined by myself, and change it to mathml defined by myself HOT 1
- Overlapping output when using serveral expressions on the same page HOT 3
- SVG StyleList unused styles? HOT 3
- Reverse process HOT 1
- Integrate better tooling infra into mathjax
- ES6 class keyword used in "ES5" code due to bundled speech-rule-engine dependency HOT 6
- use mathjax3 in andriod5 show error "getExplicit of null" HOT 1
- Build directions don't work for v4-update branch HOT 3
- MathJax-Fonts repository private HOT 9
- Can I use a custom font in version 3.2?
- ts/util/asyncLoad/node.js needs ESM version HOT 15
- installation of v4 not working with yarn HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mathjax-src.