Search code examples
c#windowsimagemathgdi

How to draw math symbols?


I need draw some pictures and save it into a JPG file.

I know that the C# GDI can draw string with method Graphics.DrawString.

But what troubles me is that I need draw some math symbols, like below:

some math symbols

So are there some libraries can help me to do that? How can I get the math symbols with GDI?


Solution

  • In case you don't find a pure .NET solution, I would look for a command-line tool or a native DLL library which can render standard formattings like MathML or LaTeX math expressions. You will find plenty of FOSS stuff for these and I don't think it would be too hard to integrate. In case you work with bitmaps, you can just tell the 3rd party to render a given size bitmap. If you need vectorized drawings, then you could aim to produce your entire output in LaTeX or maybe you can turn MathML/LaTeX formulas to RTF/HTML.