Previous Topic

Next Topic

Book Contents

Book Index

Creating a New Encoding

Creating a new font encoding is easy, but a bit tedious. Font encodings are defined using a text file that is placed in the same directory as the MathFlow DLL. For an example of what this file should look like, see Font encoding example.

The filename should follow these rules:

  • It must be unique within the directory that contains the MathFlow DLL
  • It should end with an .enc extension
  • It should be indicative of the name of the encoding (or identical to it).
  • The first line of the encoding file defines the name of the encoding. Here is an example:

    FontEncoding, 1.0, Byte, Symbol

Your encoding file's first line must start with exactly "FontEncoding, 1.0", which identifies this file as a font encoding file whose version number is 1.0. The rest of the line consists of either Byte or Word. This means that the MTCode value will be either two or four hexadecimal characters. For example, if you use Byte, then a MTCode value is expressed as "AE" (without the quotes). If you use Word, then that same number must be expressed as "00AE". The last part of this line is the name of your encoding. So for example, instead of "Symbol" you should use the name of your encoding (which is also what the name of the file should be, followed by .enc). The name of an encoding should be alphanumeric characters without any spaces or punctuation and starting with a letter (e.g. DatapageMath3).

Any blank lines are ignored. Any line that starts with # is a comment. For example:

# Purpose: Symbol font encoding

The rest of the file must contain lines that define the characters in the encoding. For example,

28,226E,NOT LESS-THAN

The three fields are (from left to right):

  • The position within the font as a hexadecimal value. This is shown in the MathType Insert Symbol dialog for the selected character in the Font position readout to the right of the character grid.
  • The MTCode (Unicode) value that uniquely defines a character. You can get this by using MathType Insert Symbol dialog to find the character in another font, then reading the value in the Unicode readout to the right of the character grid. Alternatively, you can find it in either MTCode Encoding Tables or the Font Encoding Tables.
  • A human readable character description. This does not define the character's description but it must match the description in the MTCode tables. This redundant information helps avoid many errors.

Note: These lines must be in order by the position in the font (the first field).

Previous Topic

Next Topic

Book Contents

Book Index


[Design Science Home]
Copyright © 1996-2016 Design Science, Inc. All rights reserved.