sfnedit.md 11 KB

Scalable Screen Font 2.0 Editor

[[TOC]]

This is a font converter and editor with a GUI for SSFN font files.

Command Line

Has only optional arguments.

./sfnedit [-l <language>] [-t <theme>] [font file]

-l <language>   override autodetected language, uses two letter codes, like "en", "hu", "es", "de" etc.
-t <theme>      loads a theme from a GIMP palette file
<font file>     loads the font on application start

It uses the same libsfn as the converter tool, it can open SSFN (.sfn) and ASC (.asc) fonts; but it's also able to import virtually all existing font formats out there: .sfd, .pfa, .pfb, .ttf, .otf, .woff, woff2, .bdf, .pcf, .psf, .fnt, .fon, .ft2 etc.

It saves in SSFN and ASC formats.

The editor is multilingual, and autodetects the language from the environment. If you want to use a different language than your OS' default, you can specify it in the LANG environment variable:

$ LANG=hu ./sfnedit

Or use the -l flag.

For Windows users: right-click on sfnedit.exe, and select "Create Shortcut". Then right-click on the newly created ".lnk" file, and select "Properties". On the "Shortcut" tab, in the "Target" field, you can add the command line flags.

User Interface

All windows are splited vertically into a tab navigation bar (on the top), and a tab area (the rest, bigger part of the window). By clicking on the tab icon in the navigation bar, you can switch the tab area.

These keyboard shortcuts work in all windows and in all tabs.

Key Combination Description
F1 Context dependent built-in help
Esc Close the window
Ctrl+s Quick Save the font
Shift+Ctrl+s Save As
Tab Switch to next field
Shift+Tab Switch to previous field

Main Window

There's only one main window per font. If you want to edit more fonts in paralell, then you have to start more instances of sfnedit. If you close this window, then all windows will be closed and the application quits. If there are unsaved modifications on the font, then you will be asked if you want to save them.

About

Shows the About page for sfnedit, with a clickable link to the rpository and the copyright. Also shows the UNICODE name database's date and GNU unifont's version that were built into sfnedit.

Load Font

Here you can import glyphs from fonts. Normally only empty slots are loaded, unless you check replace glyphs. You can also limit the import to a certain range.

Save Font

Similar to load, but for saving the font. You can specify the format (if you check ASC then the font will be saved in ASC otherwise in SSFN).

Properties Tab

This tab shows the properties of the font.

Blocks Coverage Tab

This tab gives an overview of which UNICODE character blocks have glyph definitions in the font.

By clicking "Show uncovered blocks" then blocks with absolutely no glyphs will be shown too. It is possible to have more than 100% coverage if glyphs are defined for code points that are undefined by UNICODE Inc.

You can search for UNICODE block names (both normal and short versions).

Characters Tab

Here you can see the characters for which the font has glyphs. If you have came here by clicking on a UNICODE block, then that block will be selected for you. You can also make selections by left clicking and moving the mouse. Simple left click will open the glyph window (see below). Light background with a dark, low-res bitmap glyph representation means the code point is specified by UNICODE, but has no glyph in the font. Dark background with light glyphs are generated from the font, and are real-time representations of all modifications you may have done on the font.

This tab has its own toolbar.

These are for: vectorization (converting bitmap font into scalable one), rasterization (the opposite, converting scalable font into a bitmap font at a given size), zoom in and out, cut, copy and paste selected range, and finally, drop selected range.

Key Combination Description
Down / Up Scroll the list
left click and move Select a range
Ctrl + c Copy the selection to clipboard
Ctrl + x Cut out the selection and store it to clipboard
Ctrl + v Paste a range from clipboard started at selection
left click Open glyph window for the character
any other key Start a search

You can search for a UNICODE code point name, for an UTF-8 character, or with a "U+" prefix and hex number for a particular code point.

Glyph Windows

You can have as many of these windows as you want, but only one per character. In this window you can edit and modify the properties of a glyph.

Metrics Tab

In this tab you can set the glyph's width and height; modify the advances, overlap and other metrics. You can also set the global baseline and underline here.

This tab also shows the UNICODE code point, as well as the UTF-8 and decimal representation of the character. If you click on this info, then the UTF-8 version of the character will be placed on the clipboard, you'll be able to paste it into another application, like into a text editor.

Quite a few transformation utilities are availalbe, like rotating (moving) the glyph, flipping vertically and horizontally, make it italic or non-italic, recalculate the bounding box etc.

On the left you can see the overall glyph representation with all the metrics as guide lines.

Layers Tab

This is the main editing tab. This also has its own toolbar, the usual zooming and cut, copy and paste icons. On the right, you can see three icons for adding new layers: vector contour layer, bitmap layer and pixel map layer.

Below that is the list of current layers. Only one layer can be active at a time, and it is highlighted in the main editor area.

At the bottom there are again three icons: layer's color (this means pixel color for pixel layers), color picker (only for pixel layers), and drop layer.

On the left, in the big part of the window, is the layer editor area.

Key Combination Description
h Flip layer horizontally
v Flip layer vertically
Ctrl + c Copy the active layer to clipboard
Ctrl + x Cut out the active layer and store it to clipboard
Ctrl + v Paste a layer (or layers) from clipboard to new layer(s)
Del Delete active layer
left click Select a point, or toggle point for bitmap and pixmap layers
left click + move Without a selected point, move the canvas
left click + move With a selected point (either on-curve or control), move that point
Shift + left click Add a line to contour
Ctrl + left click Add a cubic Bezier curve to contour
Ctrl + right click Add a quadratic Bezier curve to contour
Backspace Remove last contour command from path
wheel zooming in or out

Control points (green X) and on-curve points (blue dots) cannot be moved beyond the bounding box of the layer, defined on the Metrics tab. The editor forces this. When you move a contour point around, guide lines will pop up to help you with the alignment.

Hint: when you add new contour commands to the path, the new command is shown as soon as you press the left button. But it won't be finalized until you release the mouse button, meaning you can move it around. For example Shift + left click will show a new line from the last path point to the current cursor position. You can move that, and the line will change. When you release the left button, only then will be the line with the current coordinates appended to the path.

Kerning

In this tab you can set up relative character pair offsets. Unlike advances, you can set up both horizontal and vertical offsets for the same pair. This is very handy in glyph composition, when you need to place an accent above or below a base glyph.

On the right you have the search box, and beneath the list of specified kerning pairs. By default only characters with non-zero kerning are shown. When you search for a character, then characters with zero kerning pop up in the list too.

At the bottom, you have three icons: setting Right-to-Left and Left-to-Right direction (only available if the glyph hasn't got an Y advance set in the Metrics tab), and a drop kerning pair icon.

On the left, in the big area, you'll see the choosen character pair. Depending whether the glyph has vertical or horizontal advance, the pair is shown horizontally or vertically. Most scripting systems (including Latin, Cyrillic, Greek, etc.) are left-to-right horizontal. This distinction between horizontal and vertical is stored within the font file.

Unfortunatelly just by the UNICODE code point, you can't always tell if the glyph has to be written in Right-to-Left direction. Therefore sfnedit tries to figure it out, but lets the user change that by clicking on the "RTL" icon. This distinction between Left-to-Right and Right-to-Left is NOT stored within the font file, and requires a BiDi state machine to be applied when rendering the font. Read more on this in the API documentation.

Key Combination Description
Left / Right set horizontal kerning
Up / Down set vertical kerning
any other key Start a search

Note: you can only move the layer if you click on the layer. The paired character might have a similar background, but you can't click on that. Watch for the layer's measure lines on the top and on the left.