NanoMichael / MicroTeX

A dynamic, cross-platform, and embeddable LaTeX rendering library
MIT License
403 stars 67 forks source link

meson GDI support + (missing qt exmaple) #94

Closed sp1ritCS closed 2 years ago

sp1ritCS commented 2 years ago

now it is possible to build the gdi lib from meson too (but I've only tested with gcc & mingw, not microsoft's libs).

However gdi is not yet fully fixed yet. The new path methods of the Graphics2D class are not yet implemented, but I think one could implement it (https://docs.microsoft.com/en-us/windows/win32/gdiplus/-gdiplus-constructing-and-drawing-paths-use)

However at least on wine it still doesn't run, as it throws:

terminate called after throwing an instance of 'std::runtime_error'
  what():  locale::facet::_S_create_c_locale name not valid

one can work around this, by replacing locale("en_US.UTF-8") with locale("C") in lib/utils/utils.cpp, but then the window only pops up for a frame, after which it throws:

terminate called after throwing an instance of 'tex::ex_invalid_state'
  what():  Cannot load font file Z:\usr\share\fonts\texlive-lm-math\latinmodern-math.otf

the c.AddFontFile(wfile.c_str()) in graphic_win32.cpp returns 3 as status, which (if I have understood correctly) implies OutOfMemory. And OutOfMemory gets returned, when mono/gdiplus fails to convert the filepath from utf16 to utf8: https://github.com/mono/libgdiplus/blob/94a49875487e296376f209fe64b921c6020f74c0/src/font.c#L234 , but I didn't investigate further.