MathType 5 SDK
Extracting Baseline Info from Macintosh PICT Data

Last Update: March 20, 2001

Products: MathType and Equation Editor for Macintosh

MathType (version 1.54 and later) and all versions of Equation Editor inserts a PICT comment describing the distance in points from the bottom of the frame rectangle to the baseline of the equation. For example:

This information can be made use of by word processors and similar applications to ensure proper alignment of the equation baseline with that of a text line in which it is pasted. Many Mac applications currently support this capability (Microsoft Word & Works, WriteNow, FullWrite, PageMaker, Nisus, to name a few).

This PICT comment is in the "Application Comment" format as described in Macintosh Technical Note #181. Specifically, an Application Comment is a long comment with a "kind" value of 100 and the creating application's four-character signature at the start of the data. The baseline comment contains the following 14 bytes of data:

            offset   length              data                 description                                          
            0          4                      '∑xpr'              application signature (∑ = Option-w, 183 decimal)
            4          2                      0                      local kind (baseline comment)
            6          2                      (base)              baseline delta in points (pixels)
            8          6                      ignore              ignore

When attempting to recognize a baseline comment, it is important to make sure the local kind value is zero. Although the baseline comment is the only application comment currently generated by MathType/Equation Editor, this may not always be the case. Also, MathType/Equation Editor generates other picture comments but they will not have a kind of 100, so they should not be recognized as Application comments.

Applications that support baseline positioning can process all objects at import/editing time by either scanning the PICT as described above or, if the object is an OLE object (Microsoft’s Object Linking and Embedding technology), performance may be increased by checking first to see if the object is a MathType/Equation Editor equation object. The proper way to do this is to check the object’s ProgId character string. All OLE 1.0 equations produced by MathType and Equation Editor have a ProgId of “equation”. All OLE 2.0 equations have a ProgId that begins with “equation.” followed by an arbitrary string that uniquely determines which version of MathType/Equation Editor owns the object. For example, Equation Editor 2.0’s ProgId is “Equation.2”. Code that checks ProgIds should do case-insensitive tests.

Future versions of MathType and Equation Editor may create high-resolution PICTs (version 2 extended PICTs). Although the coordinate system used in the drawing commands within the PICT will use the PICT's high-resolution coordinates, the baseline delta in the Application Comment will always be in points (72 dpi).

See Design Science SDK document Setting EPS Baselines (all platforms) for information on baseline positioning for Encapsulated PostScript files produced by MathType/Equation Editor, and Setting WMF Baselines (Windows) for baseline positioning in Windows Metafiles (WMF) equations produced by MathType/Equation Editor for Windows.

See also:

Extracting Baseline Info from EPS Files
Extracting Baseline Info from WMF (MS Windows)
Extracting Baseline Info from GIF Image Files

Copyright ©2000-2002 by Design Science, Inc. All rights reserved.