COMPROMA.CNV AND COMPROMA.FTM (macro or stylizer FontLab 2.5)

(Before using or distributing COMPROMA, please read the paragraph "Distrubution", at the end of the present document)

Introduction

The macro COMPROMA.CNV and the stylizer COMPROMA.FTM are designed to do the same thing and contain the same code. Both allow to replace automatically outlines of composed characters (characters with accent) by a reference to the original characters, and to calculate the position of parts in the composed character.

Look at the character "à": it is composed of the character "a" and the accent "´". The program COMPROMA (macro or stylizer) will replace in the composed character "à" the two outlines of the character "a" by a reference to the character "a", by calculating the x and y position of this part (in general 0, 0), and will do the same thing for the acute accent "´" (in general, y = 0, x = <a positive value>). We will use henceforth the term referenced characters to refer to characters which are composed in this way.

The stylizer will work much faster, the macro can, on the other hand, be edited with the help of the FontLab 2.5 macro editor. The two files can be read and modified, in the way wich will be specified later, with the help of a text editor. About installation of one of both files, see the indications below.

Usefulness of COMPROMA

Generally speaking you can consider the usefulness of composed characters in two ways: regarding the font itself, composed characters allow to save memory, while composed character parts have not to be defined each time. More, the conversion of outlines into points by the Type1 or TrueType rasterizer will be the same in the original characters and in the composed characters. Relative to the font creation now, changes made on the original character shapes have not to be reproduced in the composed characters.

These advantages are however limited by a few restrictions, related to the different font formats, as well as to the font editors features (for instance FontLab versions 2.5 and 3.00 as well as Fontographer). Thus, possibilities of composed characters are much smaller in the Type1 format than in the TrueType format. In the Type1 format indeed, referenced characters can comprise only two parts, and are incompatible with non standard encodings. The TrueType format has not this restriction, and also allows to stretch or to reduce character parts. During the export into the Type1 format, the font editor will therefore sometimes convert referenced characters into corresponding outlines. In besides, the use of referenced characters in Type1 fonts entails a loss of precision in the accents position.

If referenced characters are useful during the modification of character outlines, they are not suitable to metric changes, because of the interference between the character parts offset and metric data. Edit characters "a" and "à" (referenced character) in the metric window of Fontographer or FontLab. Modify the left side bearing of the character "a": you will observe that the relative position of the accent with regard to the "a" is equally modified.

Therefore it is useful to have now characters with outlines, now referenced characters. Font editors allow to convert easily referenced character into corresponding outlines. They do not allow to do the opposite operation. COMPROMA fulfills this gap. You will be able thus not only to create easily referenced characters if you have equivalent outlines, but you will much less hesitate to replace references by outlines, when it is necessary. You will be able also to retrieve easily referenced characters created for instance with Fontographer, exported into the Type1 format (in short the best intermediate format between the different font editors) in FontLab 2.5, then in FontLab 3.00, notably to create high end Type1 or TrueType hints.

Possibilities and limits of COMPROMA

How does work COMPROMA

COMPROMA, after comparing in a rudimentary but usually efficient way outlines of the original characters and the composed one, identifies parts in the composed character, calculates their respective position, and create then referenced characters. Criteria of comparison are following: x and y dimension for the minimum containing rectangle of each outline, number of straight lines (lineto), number of Bézier curves (curveto). Theoretically, confusions are therefore always possible, but practically, they are improbable.

COMPROMA Possibilities

COMPROMA allows to create referenced characters for composed characters including up to five outlines. Beyond, the composed character will remain unchanged. COMPROMA allows also to combine outlines and references to original characters, by replacing outlines corresponding to the original characters by equivalent references, and by leaving unchanged the other outlines. COMPROMA allows also the user to decide if the program has to take into account the number of straight lines and curves (lineto, curveto). Outlines to which the user would have added some points are then equally recognized, but the risk of confusion is then slightly increased. It is also possible to choose the precision degree of the recognition (from 0 to 5 em units).

Options

By runing COMPROMA, after confirmation of the user, the program displays a dialog box allowing to set the precision degree of the recognition (Recognition prec.), by choosing a value between 0 and 5. The default value, wich will be fit in most cases, is 1, corresponding to the slight deformation of characters because of the hints and guide lines snapping in FontLab 2.5. Note that a too inaccurate recognition can entail confusions, but not reduce at all the calculation of the respective part positions in the composed character. The other option allows the user to decide if the program has to take into account the number of straight lines and curves (Count nodes): 1 corresponds to yes, 0 to no. Values superior to 1 are converted into 1.

Of what is composed COMPROMA

COMPROMA is essentially composed of two subroutines: on the one hand the subroutine cp, as well as dependent subroutines, and accessorily the subroutine cpbis, which will display the dialog box. This first part of the code has to remain unchanged. The second part of the program is the subroutine run. This subroutine includes on the one hand default values of recognition options, the call to the subroutine cpbis; on the other hand the list of composed characters and original characters wich have to be processed. You can modify the subroutine run according to your needs. The syntax of the subroutine run is explained below.

Syntax of the subroutine run

The run subroutine begins as follows:

{ :run label 1 1 :np def :prec def cpbis

In this line, the first 1 corresponds to the default precision of the recognition. The second 1 precise that the program has to take into account the number of straight lines and curves. At the end of the line, the command cpbis is a call to the subroutine of the same name, that throws the dialog box allowing the user to specify its preferences. This line can for instance be modified as follows:

{ :run label 3 0 :np def :prec def

Henceforth, the recognition will be made according to an error margin of 3 em units, and will not take into account the number of straight lines and curves. Moreover the program no longer allows the user to modify these default values (suppression of the command cpbis). You can therefore modify default values (but you can not suppress them), and you can suppress the launching of the dialog box.

Consider now the second line of the subroutine (all the other lines of the subroutine, except the last, apply the same syntax):

/Scaron /S /caron 2 cp

/Scaron is the name of the composed character, /S the name of the first original character, /caron the name of the second original character, 2 the number of original characters, cp the call to the main subroutine. Note that if you want to modify one of these lines (maybe you will do that especially if you use custom encodings), you have to begin inevitably WITH THE COMPOSED CHARACTER, and NOT TO FORGET TO SPECIFY THE NUMBER OF ORIGINAL CHARACTERS, that is to say OF PARTS.

It is altogether possible to create a referenced character with more than 2 parts, but note that the referenced character is no longer then in conformity with Type1 format rules. This possibility is however interesting for the TrueType format, especially if you open the *.vfa (FontLab 2.5) file with FontLab 3, to save it then into the *.vfb (FontLab 3) format. However you no longer have then the possibility to use COMPROMA, except if you export the font into the Type1 format, and import it again in FontLab 2.5.

Note also that in our example, characters are identified by their PostScript names. FontLab 2.5 allows also to identify them according to others criteria (decimal code, ASCII, Unicode), but with Postscript names, the program will not depend on a peculiar encoding. If the font has roman characters, and if characters exist in the font, the program will be fit for a macintosh encoding as well as a windows encoding.

Limits of COMPROMA

FontLab 2.5 is a PostScript oriented program, and COMPROMA can not therefore recognize scaled character parts (example: fractions, in some TrueType fonts). COMPROMA allows however, as it is specified above, to exceed the number of parts allowed in the Type1 format.

While COMPROMA allows to combine outlines and references, however the program will maybe suppress an outline without replacing it by a reference. That occurs because COMPROMA examine each contour, suppresses all contours wich are in both composed character and original character, but creates a reference only if the whole original character is in the composed character. It is therefore recommended to always check the result. However, a such error occurs usually only if the subroutine run includes errors. For example, the line

/icircumflex /i /circumflex 2 cp

entails this error, while the following line does not entail it:

/icircumflex /dotlessi /circumflex 2 cp

If this error still occurs, increase in dialog box (or in the first line of the subroutine run) the error margin.

Installation

Macro COMPROMA. CNV

Copy the file COMPROMA. CNV in FLW folder or in an other folder. If you want to find the macro in the macro editor pop-up of FontLab 2.5, modify the file FLW.INI in the FLW folder, as follows:

Find the section [macros]

In the line

macros=11

increase the number 11 (or any other number) by one unit

At the end of the section, add the next line:

macro12=Create Compo;comproma.cnv

or, if the file COMPROMA.CNV is not in the FLW folder, add the path before the file name:

macro12=Create Compo;<path>\comproma.cnv

You can also load the file COMPROMA.CNV from the macro editor, with the button "File..."

COMPROMA.FTM Stylizer

You have to copy the COMPROMA.FTM file in the FLW folder. Modify the FLW.INI file in the FLW folder, as follows:

Find the section [stylize]

In the line

stylizenum=24

increase the number 24 (or any other number) by one unit

At the end of the section, add the next line:

stylize25=Create Compo;comproma.ftm

Distribution

COMPROMA can be used and distributed freely, but only in its original form (COMPROMA.ZIP file, including the present document). The first part of the program has to be not modified. The run subroutine can be modified in the conditions described above.

©LeFoNDs