The MathML renderer is taken from the former Qt solutions package. I'm not sure how complete and powerful it is myself - but AFAIR the package ( no idea where to find it today ) contained a more advanced formula.
Uwe
The MathML renderer is taken from the former Qt solutions package. I'm not sure how complete and powerful it is myself - but AFAIR the package ( no idea where to find it today ) contained a more advanced formula.
Uwe
Hello,
So, you would say that my implementation is right, but the engine cannot display that formula?
Thanks, Tobast
Your code is o.k. - at least the way how you use Qwt - so I would expect to find the reason in the syntax of the string you are passing. To be honest I have forgotten about the details of this renderer and - as I said before - it would be best to find the example in the Qt solution package.
But as I'm interested myself I will try to write an example using MathML labels, so that it won't get lost anymore.
Uwe
Tobast/Uwe,
I was wondering whether any of you guys had managed to get the MathML renderer to work 'properly' using Qwt's MathML engine? FWIW, I was able to get things to work fine using QtMmlWidget (but I have decided to drop it in favour of Qwt).
Cheers, Alan.
FWIW, the MathML code given by Tobast is content MathML while it would seem that Qwt's MathML engine only accepts presentation MathML, which would explain the rendering Tobast got...
Uwe, I have had another look at the MathML renderer in Qwt and spotted several issues with it. I know it has never been fully tested, so it doesn't come as a big surprise to me.
Still, since you are interested in this issue, I was wondering whether you had had a chance to do anything about it or are planning to do something about it? It's just that I really need the MathML renderer to work in Qwt. So, either I wait for you to fix things or I do it myself (and then send you the code, of course, for possible revision and inclusion in Qwt). Just let me know.
This code is a leftover from the former Qt solutions package - all I did is to make it available as an option for being used as a QwtText plugin. In fact I don't know much about MathML myself and the quality of this renderer.
Unfortunately I havn't seen any better option for rendering formulas for Qt so far.
Please go ahead with whatever you believe that improves the implementation.So, either I wait for you to fix things or I do it myself (and then send you the code, of course, for possible revision and inclusion in Qwt). Just let me know.
Uwe
Ok, I had a bit of time yesterday to look into it and I now have Qwt's MathML renderer working with QwtTextLabel in a way which is similar to what could be done with the now discontinued QtMmlWidget.
You can find 'my' version of Qwt's MathML renderer at https://github.com/opencor/opencor/t...engines/mathml. I 'cleaned' the code a bit, but nothing major.
I have tried the renderer with some presentation MathML code and it's working fine. At least, as fine as QtMmlWidget. Indeed, I noticed some issues with the renderer itself (see https://github.com/opencor/opencor/issues/225). I will try to fix them when I have a bit more time.
I had a quick look at your changes and IMHO it seems to me like you are working around issues that have to do with rounding errors because of an integer based implementation. Your patches somehow fix these problems by adding some margins here changing a factor there. This might be a solution when using a formula with QwtTextLabel, but when scaling comes into the game ( f.e. a formula on the canvas painted with QwtPlotRenderer to PDF ) your approach will not be enough.
IMO a more promising approach would be to modify the renderer being completely floating point based ?
Uwe
I must confess that, so far, I have been working on getting the original QtMmlWidget's MathML renderer to work within Qwt (which is now the case). From there, I have been working on fixing some issues I have found with the original MathML renderer (still working on it).
This being said, I agree that a floating point based approach would be better. Maybe I should go through the code and, who knows, it might mean I don't have 'patch' certain things. Then again, there are some factors that were just plain wrong, so I had no choice but to 'fix' them. For example, say that you have x with i as a sub-script and j as a super-script. In this case, the MathML render uses g_script_size_multiplier to scale those scripts. However, the original value of g_script_size_multiplier is such that i and j would always overlap, hence I modified that value to 0.5 (from 0.7071) and as expected now everything is fine.
Anyway, it's still very much work in progress, but I am hoping to be done with it within the next few days. (I can't afford to spend too much time on this.) From there, I leave it to you to incorporate 'my' version of the MathML render to Qwt or not. What is certain is that you are better placed than I am to test the renderer for use within Qwt (my use of Qwt is somewhat limited).
What about starting this way: I will set up a test application ( in qwt/playground/mathml ), where a MathML text is displayed in the center of a widget using the MathML renderer in its paint event. It will be using a transformation, that can be modified by the mouse ( scale factor + maybe a rotation ). Your contribution would be to set up a reasonable collection of MathML formulas, that can be loaded into the application.
Then we can see easily where the renderer needs polishing.
Uwe
Seems like a sensible approach to me. We should start by using a version of QtMmlWidget's MathML renderer that works with Qwt, but doesn't contain my 'fixes'/'patches'. From there, we should convert the code to use a floating point based approach. Finally, based on the results we get from the test application, we can see whether any of my 'fixes'/'patches' are still needed.
I suggest we leave the forum and continue by Email. Please send me a couple of MathML formulas I can use as a start for the test application.
Uwe
Bookmarks