MicroTeX icon indicating copy to clipboard operation
MicroTeX copied to clipboard

Qt interface

Open jeremysanders opened this issue 4 years ago • 6 comments

Hi -

Are there any objections to looking at a possible Qt interface?

jeremysanders avatar Jun 04 '20 18:06 jeremysanders

Yes, basically you need to warp the Qt graphical backend to implement the interfaces declared in the file src/graphic/graphic.h (see the demo app in src/platform/cairo/graphic_cairo.cpp), and you can check the demo app src/samples/gtkmm_main.cpp to see how it works.

NanoMichael avatar Jun 09 '20 13:06 NanoMichael

Thanks very much. I've attempted to translate the graphics interface. I'm now trying to make a demo app to see if it works...

jeremysanders avatar Jun 09 '20 13:06 jeremysanders

That is awesome! Make me know if you have any problems. 😄

NanoMichael avatar Jun 09 '20 13:06 NanoMichael

The good news is that I'm getting an almost pixel-perfect copy of the Gtk output using my Qt backend for almost all of the samples. Unfortunately here are my current problems:

  1. I have an issue with the "\Omega" character. This is being displayed as a "«", unlike the other Greek letters. The code being passed in the wstring is 171, as the source implies. I can only imagine that Qt is doing something special with this character. I'll have to investigate in its internals... It's also not working with \bigtriangleup, \bigtriangledown, \rightleftharpoons (\dashleftarrow and \dashrightarrow don't work in the GTK version). These are also broken

    \begin{tabular}{*8l} \Lbag &\Rbag &\lbag & \rbag \ \llceil &\rrceil &\llfloor & \rrfloor \ \llbracket &\rrbracket \end{tabular}

  2. The wstrings passed to drawText have a zero character at the end. I have to strip these off as Qt renders them as a dotted box. Are they there for a reason?

  3. There are lots of deprecation warnings on building saying warning: dynamic exception specifications are deprecated in C++11 (gcc 9.3).

  4. The ASCII test has some non printable characters in the GTK version. What are they testing? "€‚ƒ". Qt doesn't render these, but GTK does.

  5. In the example with "\begin{align}" it looks a bit strange in the GTK version: image This looks quite different to the Qt version: image (note also the \Omega problem here). Is the GTK version correct? This section also seems to move right when I click the "rendering" button a second time (maybe something isn't initialised), and the page is very wide.

PS Thanks in advance for any help!

jeremysanders avatar Jun 12 '20 20:06 jeremysanders

Do you mind you create a PR include your Qt implementation to this repository? I'm trying to test these commands and to fix these issues.

Very appreciate!

NanoMichael avatar Jun 14 '20 13:06 NanoMichael

The PR was merged. The \Omega command is likely related to the TTF font file that cannot be rendered correctly on Qt graphical backend. Actually, I have met this problem on Android, modify the cmaptable (character to glyph map) finally solved this problem, but that is not a long-term solution.

I'm planning to transfer from plain ASCII TeX to Unicode-math font that can use these much modern OTF fonts (see issue #21), so this issue could be solved.

NanoMichael avatar Jun 17 '20 13:06 NanoMichael