Estimated time: 30 minutes.
The Oberon system is also distributed with another font family named "Math" in the sizes 10, 12, 14, 16, 20 and 24 points of the normal style.
Open the FontEditor panel by executing the command:
Desktops.OpenDoc FontEditor.Panel
The top part of the panel presents a table of 256 buttons, one for each of the 256 8-bit combinations. Buttons are captioned with the corresponding displayable (or printable) character where applicable, and with the corresponding hexadecimal value otherwise. Note that only the buttons 00 to 7F are the standardized ASCII codes. The assignment of the buttons 80 to 96 (special language characters) is a property of Oberon.
Enter the name of one of the Oberon fonts, such as "Syntax12.Scn.Fnt", in the text field gadget below the table and (middle) click on the [Load] button.
Move the mouse focus onto one of the buttons of the table, and press the middle mouse key to select the corresponding character, which then appears in original size in the white area at the lower right of the panel. Drag on that key and watch how the various characters are previewed in the white area. Release the key when the mouse focus is positioned on the character to edit. A picture viewer is opened to edit the character.
The buttons in the lower part of the panel have the following meaning:
[Load] loads the font specified in the text field above the button. This font replaces the current one, if one is loaded, and it can now be inspected and modified.
[Store] stores the current font in the file named in the text field above the button. Font file names (must) have the following name suffixes:
- .Scn.Fnt for display (Sreen) fonts
- .Pr3.Fnt for printer fonts (applies to DOS Oberon only)
[Store Char *] stores the character appearing in the marked viewer in the current font. The viewer's nameplate must contain the character itself or its hexadecimal value for a displayable character. For a non-displayable character it must be its hexadecimal value.
[Show String] opens an unnamed picture viewer displaying the string entered previously in the text field at the right. It is a preview which may be zoomed and to some extent edited (select, move and copy), but changes cannot be saved. This is useful for verifying the modifications to the currently loaded font.
New Viewer: When this check box is checked, the result of any of the three operations described below is presented in a new picture viewer. If it is not, the result appears in the current viewer.
[Flip H] flips the selection around the median line.
[Flip V] flips the selection around the median line.
[Turn 90] rotates the selection anticlockwise by 90 degrees.
The imaging model of characters defines that a character is contained in a box defined by a set of metric data x, y, w, h and dx, in a system of coordinates represented by the two red orthogonal lines. The origin of the coordinates is called the reference point and the X-axis is called the base line. (x, y) is a vector from the current reference point to the origin of the box. w and h are the width and the height of the box, and dx is the distance to the reference point of the next character on the same base line, that is the abscissa of the blue line.
The metrics of a character can be retrieved by program, as is shown below:
PROCEDURE ShowC*;
VAR
dx, x, y, w, h: INTEGER;
pat: LONGINT;
ch: CHAR;
BEGIN
ch := "g";
Fonts.GetChar (Fonts.This("Syntax12.Scn.Fnt"),
ch, dx, x, y, w, h, pat);
Out.Int(x, 3), ....
(* Visualizing the values produces,
for the example letter in the example font,
x = 1, y = -3, w = 5, h = 10 and dx = 6 *)
END ShowC;
Fonts.height: the minimum distance between lines. This distance is modified when the Vertical offset is modified.
Fonts.minX, Fonts.maxX, Fonts.minY, Fonts.maxY: are the extremal values of the box enclosing all characters when their base points are aligned at (0, 0).
The metrics of a font can be retrieved by program, as is shown below:
PROCEDURE ShowF*;
VAR
F: Fonts.Font;
BEGIN
F := Fonts.This("Syntax12.Scn.Fnt");
Out.Int(F.height, 3); ...
(* Visualizing the values produces, for the example font,
F.height = 14, F.minX = 0, F.maxX = 13,
F.minY = -4 and F.maxY = 10 *)
END ShowF;
This is obtained by using the TextDocs.ChangeOffset command. In that case the distance to the neighbouring lines is not equal to Fonts.height anymore, but is increased.
[-] reduces the size of the character picture. The button may be clicked a maximun of 5 times in succession until the original size is restored, and not beyond.
[Pixel] When Pixel is selected, position the mouse focus on a square of the grid. If the square is white, it changes to black when the middle mouse key is clicked. If it is black, it changes to white. Instead of editing the pattern dot-wise, you may drag on the middle key to process all the dots on a trajectory. If you started on a black square, it and all further dots are changed to white, and conversely. Changes are immediately reflected in the small white area in the panel.
Useful hint: to ease character retouching, make a copy of the viewer first, then magnify either of the two views as required. Whatever is retouched in the zoomed picture will be reflected in the original.
[Metric] When Metric is selected, the colored metric lines can be moved. Position the mouse cursor at the proximity of the line to move, press the middle mouse key, and drag on it in the direction of the line until the line is "captured". From that moment, a vertical line can be moved sideways, or the horizontal line up and down, in discrete intervals of the snapping grid. Release the key when the line is correctly positioned.
The mouse commands otherwise comply with the Oberon standard.
Clicking the right mouse key (anywhere in the viewer) selects the entire picture. The cursor changes to a flat hand and the entire white area is surrounded by a fat frame. Clicking again, deselects the picture and restores the cursor.
Pressing the key and dragging on it, tracks the selection which is delimited by a rubber band rectangle. When the key is released, a fat selection frame is drawn. When copying a selection, the caret may be set in a picture viewer different from the viewer containing the selection.
Moving the white area in the viewer can be done in two ways. First, select the entire area with a right mouse click, then press the middle mouse key and drag. Second, if the area does not cover the viewer entirely, place the mouse focus outside the area, press the middle mouse key (the cursor changes to a flat hand), and drag. In both cases, when the white area is correctly positioned, release the key.
When editing is completed, close the picture viewer(s) and store the character in the current font.
The conversion is performed using the sole command in the FontRes module.
FontRes.Convert { OberonFontFile => [Path]WindowsFontFile} ~ | ^ processes a list of name pairs, separated by "=>". The Oberon display font file oberonFontFile is converted to a Windows FON resource. If the file already exists, it is overwritten. The name of a FON file consists of four parts: NNNNNSSF.FON where:
Note: The Windows .FNT file format used to produce the resource is documented in the Microsoft Windows Programmer's Reference, Vol. 4, Chapter 4: Font File Format.