Giter VIP home page Giter VIP logo

Comments (8)

pkra avatar pkra commented on June 19, 2024

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.

jasongrout avatar jasongrout commented on June 19, 2024

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.

pkra avatar pkra commented on June 19, 2024

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.

jasongrout avatar jasongrout commented on June 19, 2024

Davide discussed this in the Technical Advisory committee meeting. What we decided was (feel free to correct me!):

  1. 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).
  2. 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.

pkra avatar pkra commented on June 19, 2024

Just to add: this will be based on the new 3.0.0-alpha.2 (which is out).

from mathjax-src.

dpvc avatar dpvc commented on June 19, 2024

The examples are in the limited-css branch (based off the alpha branch), and are discussed in the developer's forum.

from mathjax-src.

jasongrout avatar jasongrout commented on June 19, 2024

Thanks! I've added a note to jupyterlab/jupyter-renderers#69 indicating we can move forward again.

from mathjax-src.

dpvc avatar dpvc commented on June 19, 2024

The fontURL option is in the 3.0.0 release, so I'm closing this.

from mathjax-src.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.