Skip to main content

Using the API in your program

Follow the general steps below to use the Equation Composer in your program.

Setting the License

Before an equation image can be rendered, a valid MathFlow SDK license for the Equation Composer must be supplied to the EquationComposer class (note that this is available in 32- and 64-bit versions for Windows). This is accomplished by using the SetLicense method and passing in either the path and file name of a FlexNet license or the license string for a Design Science key.

Specifying the Input

To pass a MathML string to be rendered into the Equation Composer, use the SetMathML method. For a MathML file containing math markup, pass the path and file name into the LoadMathML method.

Defining the Output

The methods that define where the equation image will generated and what type of image it will be are:

  • SetImageName

  • SetImageType

  • SetImageFolder

Setting Rendering Options

The methods that determine how an equation will be rendered are:

  • SetPointSize

  • SetDPI

  • SetForeground

  • SetBackground

  • SetBreakWidth (Java only)

  • SetPadding (Java only)

  • SetUseAntialias

Using Fonts

Java

Use this method to select which font mapping file is used (see Java Rendering Engine for more information):

  • SetFontMapping

Windows

Use these methods to select which fonts are used (see Windows Font Configuration for more information):

  • SetFontConfig

  • SetFontInfo

  • SetBaseFont

When the EquationComposer DLL (note that this is available in 32- and 64-bit versions for Windows) is first loaded, it looks for the font configuration file and the font info file. If either file is present, it is used in the same way as the analogous configuration file passed via the -fontinfo or -fontconfig parameter by the command line component.

Saving Your Options

At any point in your program, you can save the options you have defined using SaveOptions. To load options previously saved, you would use ReadOptions.

Generating an Image File

Once the parameters have been set, an equation image can be generated with the GenerateImageFile method. In addition, with the Java version of the Equation Composer, it is possible to generate and return an equation image to the calling program by using the GenerateImageData method or to render an equation for the current MathML with the PaintEquation method. (Background transparency is currently implemented only for the GenerateImageFile method.)

Getting Image Information

The following methods are used to retrieve information about the equation image that was generated:

  • GetAscent

  • GetHeight

  • GetWidth

  • GetBaseline

  • GetBreakWidth

  • GetLineMetrics

Getting Additional Information

Use the GetLastMessage method to obtain the latest message string and ClearLastMessage to reset it. The SetVerbosity method specifies the amount of information that will appear in processing messages. These will be displayed to the console unless they are redirected to a log file with the SetLogFile method.