Skip to content

Latest commit

 

History

History
203 lines (171 loc) · 16.8 KB

README.md

File metadata and controls

203 lines (171 loc) · 16.8 KB
this_file examples/samples/README.md

Samples: GUI scripts for FontLab 9

106 single-file PythonQt dialogs for everyday font work: anchors, metrics, kerning, outlines, masters, names, guides, font info, features, hinting, cleanup, generators, reports and proofs. Each one works on the current font and offers a master scope where that makes sense; most list what an Apply will change before you press it, and a few (such as mark-colour swatches) apply on click. Report, browser and proof scripts change no font data (some select glyphs, copy to the clipboard or export files). Many glyph-editing tools group their edits into one Undo step, but Undo coverage varies. Seven metrics scripts warn that moved stem hints are not restored, and font-wide data (font info, OpenType features, master settings) is written directly: Italic Angle (Masters) states that Undo does not restore its change. Read each script's notes before applying changes.

Copy any file into FontLab's Scripts folder (for example Scripts/Samples) and run it from the Scripts menu, or open it in the Scripting panel. A script needs only FontLab 9 and its bundled PythonQt; nothing else is installed. Dialogs are modeless, so the Font window stays usable, and every dialog disconnects its signals when closed.

Each script was run in FontLab 9.0.9783 through its menu path on disposable copies of GetGo fonts, with screenshots and before/after reads of the changed glyphs. Edits on glyphs used by automatic composites warn first: FontLab may rebuild those composites' anchors and locks, and Undo does not restore that rebuild.

Cleanup (2)

Script What it does
Remove Empty Auxiliary Layers Delete empty auxiliary layers (no outlines, anchors, guides, note or other data) from the selected glyphs.
Select Unreferenced Glyphs List unencoded glyphs that nothing references, and select them in the Font window for review.

Font Info (6)

Script What it does
Bump Font Version Bump the numeric version and version name; optionally append a dated font note.
Calculate Vertical Metrics Set hhea, Win (and optionally OS/2 typo) vertical metrics to enclose every glyph, per master.
Glyph Order Preview & Export Sort by Unicode, name or Unicode script; export one glyph name per line for the whole font.
Master Metrics Table Edit ascender, descender, x-height and cap-height across masters; diagram follows the selected row.
Names & Credits Edit family, style, credits and version naming for the current font.
Unicode Ranges & Codepage Hints Report OS/2 range bits and complete printable codepage coverage from every glyph encoding; no font changes.

Generators (6)

Script What it does
Outline Effect Turn the selected glyphs into outlined (hollow) letters.
Placeholder Glyphs Create empty placeholder glyphs from pasted glyph names or characters, on every master.
Shadow Copy Add a shifted copy of the selected glyphs' outlines as a separate shadow element.
Small Caps from Capitals Create small-cap glyphs (h.sc, a.sc ...) from the selected capitals, on every master.
Superior & Inferior Figures Create superior (.sups) or inferior (.subs) copies of the selected figures, on every master.
Tabular Figure Copies Create tabular (.tf) copies of the selected figures, on every master.

Guides (6)

Script What it does
Clear Glyph Guides Remove glyph guides from the selected glyphs by direction and name.
Copy Guides Between Masters Copy the glyph guides of one master to the other masters of the selected glyphs.
Font Guides Panel Show the font's guides and add one named guide to every master of the selected glyphs.
Grid Generator Add a regular grid of named glyph guides: N lines every S units from an origin.
Guide List Editor Edit the glyph guides of one glyph as a table: X, Y, angle and name per master.
Metric Reference Lines Add named horizontal glyph guides at the font's vertical metrics, plus an offset.

Hinting (3)

Script What it does
Autohint Selected Layers Run FontLab's PostScript autohinter on the selected glyphs, per master.
Remove PostScript Hints Remove PostScript stem hints from the selected glyphs, horizontal and/or vertical, per master.
Suggest Zones from Overshoots Set PostScript alignment zones from the overshoots of H/O (baseline, caps) and x/o (x-height).

Kerning (12)

Script What it does
Classes Browser Browse kerning classes: their side, members, and every pair that uses them on each master.
Compare Masters Line up every kerning pair across all masters and flag the ones that look inconsistent.
Copy Between Masters Copy the kerning of one master to other masters, optionally scaled.
Exceptions Finder Find kerning exceptions: pairs that override a class pair, and remove the ones you tick.
Missing Pairs List the combinations of two glyph groups that no kerning pair covers on a master.
Pair Editor Edit every kerning pair that involves one glyph, with one column per master.
Pair List Browse every kerning pair of a master: filter, sort by any column, export to CSV.
Pairs from Text Type a word, see each adjacent pair's kerning on every master, and set the ones you tick.
Remove Small Pairs Delete kerning pairs whose value is smaller than a threshold, on one or all masters.
Round Values Round kerning values to a step (5, 10 …) on one or all masters, previewing every change.
Scale Values Scale all kerning values by a percentage on one or all masters.
Text Preview Set text from the font's outlines with its kerning applied, per master, at any size.

Masters (13)

Script What it does
Back Up Master Layers Copy the master layers of the selected glyphs to named backup layers before risky edits.
Compatibility Check Check that every master of each glyph can interpolate: same contours, nodes, anchors, components.
Copy Layer Between Masters Copy the outline (and optionally anchors and advance width) from one master to others.
Copy Outline to Mask Copy the outline of each selected glyph's master layer into its mask layer, for reference.
Glyph Weight Chart Bar chart of the ink area of the selected glyphs in every master.
Interpolation Preview Preview a glyph between two masters with a slider, from the masters' own nodes.
Italic Angle Read and set the italic angle of every master, with a painted gauge comparing them.
Layer Cleanup List the non-master layers of the selected glyphs (masks, backups, others) and delete the ticked ones.
Master Switcher A small palette with one button per master: click to make that master current.
Masters Overview One table of all masters: axis location, vertical metrics and italic angle.
Restore Backup Layer Restore a backup layer (such as "Regular backup") into the master it was taken from.
Sync Sidebearings Copy side-bearings from a reference master to the other masters, proportionally or as-is.
Width Chart Line chart of the advance widths of the selected glyphs across masters.

Metrics (13)

Script What it does
Alignment Zones Edit the PostScript alignment zones (blue zones) of each master in a table.
Centre in Advance Centre the outlines of the selected glyphs in their advance width, optionally with a new width.
Copy from Reference Give the selected glyphs the sidebearings or the advance width of a reference glyph.
Equalize Sidebearings Make the left and right sidebearings of the selected glyphs equal, on one or all masters.
Italic Sidebearings Report and set sidebearings measured along the italic angle, not straight up.
Round Advances Round advance widths to a step (2, 5, 10 … units), keeping every outline where it is.
Scale Advances Scale the advance widths of the selected glyphs by a percentage, each outline staying centred.
Sidebearings Tuner Set, add to or scale the side-bearings of the selected glyphs on one or all masters.
Spacing String Preview Render a spacing control string such as HOHnono from the font's own outlines and advances.
Tabular Width Give figures (and optionally currency signs) one shared advance width, each outline centred.
Vertical Metrics Diagram See and edit ascender, cap height, x-height and descender of every master in one diagram.
Width Table Advance widths of the selected glyphs across all masters, sortable, with odd progressions flagged.
Zero-Width Marks Set the advance width of combining marks to zero, keeping or re-placing their outlines.

Names (12)

Script What it does
Batch Rename Find and replace in glyph names (plain text or regular expression) with a live preview.
Case Pairs Find the upper- or lowercase counterparts of the selected glyphs and select them.
Character Info A live panel describing the character of the glyph selected in the Font window.
Charset Compare Paste a text or a character set and compare it with the font's encoded characters.
Duplicate Unicodes Find code points assigned to more than one glyph and remove them from the extra glyphs.
Glyph Finder Type to find glyphs by name, character or code point; Enter selects them in the Font window.
Glyph Notes Read and edit the note of the selected glyph, and browse every glyph that has a note.
Glyph Tags View, add and remove glyph tags across the selected glyphs.
Mark Color Palette Click a colour swatch to mark the selected glyphs with it (or clear the mark).
Select by Mark Select glyphs in the Font window by their mark colour.
Suffix Tool Add, remove or replace a glyph-name suffix (.ss01, .sc, .alt…) on the selected glyphs.
Unicode from Names Assign Unicode code points derived from glyph names, with a preview first.

OpenType (6)

Script What it does
Alternate Glyph Proof Compare a base glyph and its suffixed alternates in each master. Read-only; outlines share one scale per row.
Feature Code Inspector Read-only feature source for the whole font. Choose a feature and search its code.
Ligature Recipe Finder Find underscore-named glyphs and existing input glyphs. Name-derived recipes do not imply outline components.
OpenType Class Browser Browse feature classes and their members. Filter by class name or glyph; font-wide across masters.
Suffix Feature Report Suffix inventory across the whole font. Suggestions are naming hints; review the generated code.
Suffix Substitution Builder Preview a font-wide suffix substitution. Append to source only; compile and test in the Features panel.

Outlines (14)

Script What it does
Add Extremes Insert on-curve nodes at the horizontal and vertical extremes of curve segments.
Contour Order View Show every master of a glyph side by side with numbered contours, start points and directions.
Correct Contour Direction Set PostScript contour direction on the selected glyphs and report what changed per master.
Delete Duplicate Contours Find contours drawn twice in the same layer and keep only the first copy.
Delete Small Contours Remove contours whose area is below a threshold: stray specks left by drawing or tracing.
Fix Zero Handles Find curve handles that sit on their own node and clean them up.
Node Coordinates Panel A small live panel listing the selected nodes of the current glyph with coordinates.
Node Statistics Contours and nodes per glyph and master in one table, with incompatible glyphs flagged.
Optimize Start Points Move every contour's start node to its bottom-left on-curve node, consistently across masters.
Remove Overlap Remove overlaps on the chosen masters of the selected glyphs, master compatibility checked first.
Round Coordinates Round node coordinates of the selected glyphs to a grid, optionally anchors and component offsets.
Slant Slant (skew) the selected glyphs by an angle, optionally the font's italic angle.
Straighten Short Curves Turn short curve segments whose handles lie on the chord into straight lines.
Transform Scale, skew, rotate and move the outlines of the selected glyphs with a live preview.

Proofs (4)

Script What it does
Glyph Grid Show the selected glyphs on every master side by side, drawn from their outlines.
Text by Master Render the same text once per master, stacked, to compare weight and width at a glance.
Waterfall Render a line of text in a cascade of sizes, drawn straight from the glyph outlines.
Word Finder Find real words to proof with: words the font can set, that use the letters you are working on.

Reports (8)

Script What it does
Empty Glyphs List glyphs that have no outlines and no components on some or all masters, and select them.
Font Overview A one-screen dashboard of the current font: glyphs, encoding, masters, kerning, composites.
Glyph Info Live A live panel for the glyph you are working on: widths, side-bearings, bounds and counts per master.
Glyph Table CSV A sortable table of glyphs (name, Unicode, width per master, contours, components) with CSV export.
Label Statistics Count glyphs by mark colour and by name suffix (.sc, .ss01, .loclPLK…); click a row to select them.
Nodes Near Zones Find on-curve nodes that sit within a few units of a vertical metric but not on it.
Open Contours Find open contours on every master and select the glyphs that have them.
Unicode Coverage Unicode coverage of the current font, block by block, with progress bars.

Utilities (1)

Script What it does
Batch Glyph Notes Set or append a note on every selected glyph at once.