Adjust Punctuation Spacing in FontForge
FontForge allows you to apply uniform spacing adjustments to all punctuation marks simultaneously through its batch metric transformation tools and Python scripting interface. This guide explains how to select multiple punctuation glyphs at once, uniformly modify their side bearings using the graphical interface, and automate the process across entire fonts.
Adjusting Spacing via the Graphical Interface
You can uniformly adjust the side bearings of multiple glyphs at the same time using FontForge's built-in metric transformation tools.
Step 1: Select the Punctuation Glyphs
- Open your font file in FontForge to access the Font View window.
- Locate the punctuation marks you want to adjust (such as period, comma, colon, semicolon, exclamation mark, and question mark).
- Hold down
Ctrl(orCmdon macOS) and click each punctuation glyph to select them simultaneously. You can also click and drag to select a contiguous block.
Step 2: Open the Transform Metrics Window
- With the glyphs selected, navigate to the top menu and select Metrics.
- Click on Transform Metrics....
Step 3: Configure the Spacing Adjustment
The Transform Metrics dialogue provides several options for uniform modification:
- Left Side Bearing (LSB): Select whether to set,
increment, or scale the left side bearing. To add uniform padding (for
example, 20 font units to every mark), choose Increment LSB
by and enter
20. To reduce spacing, enter a negative number (e.g.,-20). - Right Side Bearing (RSB): Select the corresponding rule for the right side bearing, applying the same increment or fixed value.
- Width: If you want all selected punctuation marks to share an identical overall advance width rather than uniform margins, select Set Width to and enter the desired unit value.
Click OK to apply the changes to all selected glyphs instantly.
Alternative: Using "Set LBearing" or "Set RBearing"
If you prefer fixed margins rather than relative increments:
- Select your target punctuation glyphs.
- Go to Metrics > Set LBearing....
- Enter the exact value in font units and click OK.
- Go to Metrics > Set RBearing..., enter your desired value, and click OK.
All selected punctuation marks will now possess the exact same side margin values.
Adjusting Spacing via Python Scripting
For precise control or recurring builds, you can apply uniform metric adjustments to punctuation marks using FontForge’s embedded Python engine.
- Go to File > Execute Script....
- Select the Python radio button.
- Enter the following code snippet to adjust specific punctuation glyphs:
import fontforge
font = fontforge.activeFont()
punctuation_list = [".", ",", ":", ";", "!", "?", "-", "(", ")"]
# Uniform margin increment in font units
spacing_adjustment = 15
for char in punctuation_list:
if char in font:
glyph = font[char]
glyph.left_side_bearing += spacing_adjustment
glyph.right_side_bearing += spacing_adjustment- Click OK to execute the script and update the metrics across the specified glyphs.