NanoMichael / MicroTeX

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

Make a template version of the latex parser that doesn't use `wchar_t` #82

Open appetrosyan opened 3 years ago

appetrosyan commented 3 years ago

Hi. Most LaTeX is not possible to use as UTF-16, so the wchar_t support seems mostly to be needed for the internationalisation support, and not LaTeX.

As it stands, it may be worth exploring a code path that doesn't rely on wchar_t and instead directly uses UTF-8 strings. In my case, this would significantly reduce the memory footprint, (embedded systems need to be miserly with the RAM), so I was wondering if you'd accept a PR that did that?

NanoMichael commented 3 years ago

so I was wondering if you'd accept a PR that did that?

Yes, your PR is very welcome. I'm planning to replace the std::wstring with the plain old UTF-8 strings. Because the parser needs to iterate over the string to get the Unicode codepoint of the character, I've followed the most intuitive and easy way :sweat_smile: .

NanoMichael commented 2 years ago

There's no wchar_t anymore, please take a look at the branch openmath.