Extracting baseline info from a Mac PICT

MathType and all versions of Equation Editor insert 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 processor 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, Apple Pages, Nisus Writer, to name a few). See MathType SDK document Interpreting the baseline for information on how to convert this value for use in your application.

This PICT comment is in the "Application Comment" format as described in Mac Technical Note QD06. 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:

offsetlengthdatadescription
04'∑xpr'application signature (∑ = Option-w, 183 decimal)
420type (0 indicates baseline data to follow)
62(base)baseline delta in points (pixels)
86ignoreignore

When attempting to recognize a baseline comment, it is important to make sure the data type is zero, because the baseline comment is not the only application comment currently generated by MathType. Also, MathType generates other picture comments but they are not Application comments (that is, they do not have a kind of 100).

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 object. The proper way to do this is to check the object’s ProgId character string. All OLE 1.0 equations produced by MathType 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 owns the object. For example, MathType 6.x's ProgId is “Equation.DSMT4”. Code that checks ProgIds should do case-insensitive tests.

Future versions of MathType 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 Wiris SDK document Setting EPS baselines (all platforms) for information on baseline positioning for Encapsulated PostScript files produced by MathType, and Setting WMF baselines (Windows) for baseline positioning in Windows Metafiles (WMF) equations produced by MathType for Windows.

See also: