Description: Since HarfBuzz have been provided APIs to process the OpenType MATH table, LibreOffice could also display the mathmatical formulas with some fonts as Cambria Math and XITS, with help of these APIs. Steps to Reproduce: HarfBuzz version 1.3.3 is released on September 28, 2016, with some new APIs to parse the MATH table. See: https://github.com/behdad/harfbuzz/blob/master/NEWS Actual Results: - Expected Results: If LibreOffice handle these APIs, any fonts including MATH table would easy to be used to presenting mathmatical formulas. Reproducible: Always User Profile Reset: No Additional Info: User-Agent: Mozilla/5.0 (Android 4.3; Mobile; rv:49.0) Gecko/49.0 Firefox/49.0

We still need to produce valid ODF 1.2+ Math Formula This would probably be reasonable long term to reinstrument the Math Formula editor to make use of OpenType smart type features, but equally I would hope to implement LaTex syntax in addition to native We still need to produce valid ODF 1.2+ Math Formula Short answer is that the whole thing needs to be refactored, so using OpenType Math syntax and layout would come in a as part of a larger effort. One I assume would also get us GSUB and GPOS support when using OpenType fonts. So this by itself is a valid enhancment--but it will have to be done as a part of a broader refactoring of layout framework in LibreOffice. =-ref-= https://www.microsoft.com/typography/otspec/math.htm https://en.wikipedia.org/wiki/OpenType#Math

If you have no idea how to intergrate it, you can found an article for how does it work on Frédéric Wang’s website.

Again, point is we must continue to produce valid ODF 1.2+ Formulas and working with OpenType Math tables alone has no UI or input syntax to work with--it needs inline interpreting of MathML or LaTeX. Doing HarfBuzz API calls for inline support of OpenType smartfont features and MathML syntax for rendering formulas in text does not keep us ODF compliant if we abandon the Math formula editor. LaTex syntax markup is an equally viable approach (available now with TexMaths extension that requires an external LaTex instance but embeds formula as PNG or SVG and remains ODF compliant). So the Math Formula editor would have to be refactored to support OpenType Math table markup and presumably retain legacy StarMath/Math markup for ODF compatibility. While doing all that we would take care of (probably required) the rest of the OpenType smartfont feature support that folks have been asking for. And I would hope while doing so we'd implement UI support for inline LaTex syntax as well, even if using HarfBuzz and not shaping with TeX. Point being you really can't do anything with HarfBuzz APIs providing OpenType Math formulas without committing to the LO sm Math Formula editor being scrapped and starting over. This enhancement is valid, but I don't think anyone is volunteering to take on the refactoring needed.

You don’t need MathML to render fonts with OpenType math information. But anyway, ODF actually uses MathML to store math formulas (we currently also store the StarMath syntax in the MathML “annotation” tag and read it from there to I guess avoid roundtrip conversion).

So as I see there are several separate issues: 1) Encoding of math formulas MathML is the standard used in ODF for encoding mathematical formulas and we can attach semantics annotation to MathML formulas (e.g. StarMath or LaTeX). Currently we use MathML with StarMath annotation. Storing images of formula for ODF document would be a horrible solution IMHO but that can still be used for exporting to other formats (e.g. HTML). 2) Writing math formulas Of course MathML is not intended to be written by hand. Currently we have StarMath and a visual editor (disabled by default). It would make sense to add a LaTeX input method. 3) Abstract tree for rendering/navigation of math formulas Currently, this tree matches the StarMath syntax which is very poor compared to MathML or LaTeX. I think we should really have MathML as an internal format here, so that valid ODF import/export is straighforward and we can manage additional annotations (LaTeX and StarMath) for more input methods. IIUC, 3) is the topic discussed here. As Khaled said, using OpenType MATH is independent of the internal tree.

So focusing on 3), I agree that the StarMath-based code will need a big refactoring. Maybe a reasonable first step is to focus only on improving the rendering of stretchy and large operators using the MathVariants subtable. But otherwise, maybe instead of rewriting everything we just want to use a separate library such as libmathview (https://github.com/khaledhosny/libmathview/) or WebKit to provide a visual rendering of the formula that can also be navigated.

Thanks to Frédéric, I think he explained what we can do for this bug.

Bug 109142 have been fixed recently, which bring us HarfBuzz 1.4.8 with OpenType MATH table support, so we can started to working for this. And I suggest we need also adding this table into OpenSymbol font to make some brackets presented scaling.

(In reply to V Stuart Foote from comment #1) > We still need to produce valid ODF 1.2+ Math Formula > > This would probably be reasonable long term to reinstrument the Math Formula > editor to make use of OpenType smart type features, but equally I would hope > to implement LaTex syntax in addition to native We still need to produce > valid ODF 1.2+ Math Formula If ODF 1.2+ Math Formula is fully interoperable with MathML, I think we can try to create some sample files for test.

(In reply to V Stuart Foote from comment #1) > We still need to produce valid ODF 1.2+ Math Formula If ODF 1.2+ Math Formula is fully interoperable with MathML, I think we can try to create some sample files for test. > This would probably be reasonable long term to reinstrument the Math Formula > editor to make use of OpenType smart type features, but equally I would hope > to implement LaTex syntax in addition to native We still need to produce > valid ODF 1.2+ Math Formula The following resources provides some sample LaTeX codes can also be used for testing: https://github.com/khaledhosny/xits/tree/master/documentation/documentation-sources http://www.gust.org.pl/projects/e-foundry/tg-math

As a workaround, if you want to make use of mathmetical fonts in LibreOffice, you have to install XeLaTeX firstly, then install TexMaths extension (0.46 and newer) and configure it to call XeLaTeX for foumulas.

(In reply to V Stuart Foote from comment #1) > We still need to produce valid ODF 1.2+ Math Formula > > This would probably be reasonable long term to reinstrument the Math Formula > editor to make use of OpenType smart type features, but equally I would hope > to implement LaTex syntax in addition to native We still need to produce > valid ODF 1.2+ Math Formula Also, the following page set an good example of LaTeX2Mathml, also would be help for test. https://fred-wang.github.io/TeXZilla/