MicroTeX icon indicating copy to clipboard operation
MicroTeX copied to clipboard

Different fonts

Open lazingor opened this issue 4 years ago • 2 comments

Is there some documentation on how to go about using another font with this library?

I wonder if some more modern fonts might avoid the need for so many font files. For example, another library just has latinmodern-math.otf and xits-math.otf available. (See e.g. https://github.com/kostub/iosMath/tree/master/fonts )

MathJax and KaTeX have also done some nice work on math fonts for on-screen display, and it could be worth including these. (I think they've just fattened up some AMS fonts.)

Again, great work with this library!

lazingor avatar May 26 '20 14:05 lazingor

The Latin-modern-font family is based on the lm font package, we can use it, but there're some problems to deal with.

First, we should parse the *.tfm files to get the TeX font metrics (including extensions, ligatures and kerning), but currently, for historical reasons, the project doesn't support to do this (the TFM files were pre-parsed to C++ primitive arrays, please check out the folder src/res/font, and the original TFM files can be found at here).

And dynamic load fonts are also can be done, but only XML format files are supported now (for convenience) (actually, the first version of the built-in TFM files represented as XML files).

Anyway, we can support this, but it is another huge project.

NanoMichael avatar May 30 '20 13:05 NanoMichael

Excellent, thanks for those pointers. I'll have a go at it, perhaps with the MathJax fonts, when I get a chance. The rendering is already very nice in cLaTeXMath, so this is certainly low priority.

lazingor avatar Jun 02 '20 12:06 lazingor