Drawing formulas with Quartz 2d

In my iPhone application, I would like to draw some formulas. How can I control this with 2d quartz? Is there a way to build formulas, for example, in latex? Or is there any existing framework? Thanks.

+3
iphone cocoa-touch quartz-2d latex formula
source share
2 answers

As a developer, an iPhone app that does just that , trust me when I say that typing equations are not a trivial thing. In my case, I used Core Animation layers to build sub-elements of the analyzed equation. The equations are hierarchically constructed, and the operations that make them up are laid out as such. Each operation is contained in its parent working layer and is set in accordance with the rules of this particular operation.

To visualize the elements within the equation, I used Quartz to draw lines, characters, etc., but most of the drawing was just text drawn inside CALayer, using the NSString text drawing extensions.

I redefined the standard CALayer rendering architecture for generating PDF files from these equations, because CALayers do not display vector elements by default. For an example of how this rendering works in my application, see the Core Plot project, which does the same thing at its basic level.

I deduced in LaTeX from the equations that it is quite simple after you have analyzed them in a hierarchical data structure, but parsing them from LaTeX into this structure will be a little more complicated.

To enter and evaluate simple text equations, you can find Graham Cox GCMathParser .

+10
source share

There is no real Tex mechanism for Cocoa touch I've heard about, but there is a lightweight JavaScript JavaScript layout engine: jsMath .

+2
source share

All Articles