Successfully implemented Phase 3 "Specialized Features" from the FontLab API roadmap. These provide advanced professional font production capabilities through the MCP server.
fontlab://glyph/{name}/anchors- Get anchor points for a specific glyph- Returns: name, x, y coordinates for each anchor
- Used for mark positioning and composite glyph construction
fontlab://glyph/{name}/layers- Get layer information for a specific glyph- Returns: index, name, visible state, shapes count, advance dimensions
- Supports multi-layer glyph design
-
fontlab://font/guides- Get all global guides in the font- Returns: position, angle, name for each guide
- Used for alignment and design consistency
-
fontlab://font/zones- Get alignment zones (hint zones) for the font- Returns: PostScript blue values and other blues
- Used for hinting and vertical metrics
Total New Resources: 4
-
add_anchor- Add an anchor point to a glyph- Parameters:
glyph_name,anchor_name,x,y - Validates anchor name doesn't already exist
- Essential for mark-to-base and mark-to-mark positioning
- Parameters:
-
remove_anchor- Remove an anchor from a glyph- Parameters:
glyph_name,anchor_name - Removes specified anchor by name
- Parameters:
-
move_anchor- Move an existing anchor to a new position- Parameters:
glyph_name,anchor_name,x,y - Updates anchor coordinates
- Returns both old and new positions
- Parameters:
-
add_layer- Add a new layer to a glyph- Parameters:
glyph_name,layer_name - Creates new flLayer object
- Enables multi-layer glyph construction
- Parameters:
-
remove_layer- Remove a layer from a glyph by index- Parameters:
glyph_name,layer_index(0-based) - Prevents removal of the only layer
- Validates layer index range
- Parameters:
-
add_guide- Add a global guide to the font- Parameters:
position,angle(optional),name(optional) - Uses fontgate fgGuide class
- Supports horizontal (0°) and vertical (90°) guides
- Parameters:
-
add_zone- Add an alignment zone (hint zone) to the font- Parameters:
zone_type("blue" or "other_blue"),bottom,top - Adds to PostScript hint zones
- Validates bottom < top
- Parameters:
Total New Tools: 7
Added to fontlab_bridge.py:
get_glyph_anchors(glyph_name)- Accesses glyph.anchors collectionget_glyph_layers(glyph_name)- Returns layer metadata with visibility and dimensionsget_font_guides()- Accesses fg_font.guides via fontgateget_alignment_zones()- Returns PostScript blue values from font.info
- All glyph names validated for dangerous characters
- Numeric ranges enforced for coordinates and positions
- String length limits for names (255 chars)
- Anchor/layer existence checks
- Zone validation (bottom < top)
- Layer removal protection (cannot remove only layer)
- Comprehensive try/catch in all bridge scripts
- Validation errors logged and returned to user
- Font existence checks
- Glyph/anchor/layer existence checks
- Duplicate prevention for anchors
- Index range validation for layers
- Uses
glyph.anchorscollection for anchor operations - Uses
flAnchor()class for creating new anchors - Uses
flLayer()andglyph.addLayer()for layer management - Uses
fgGuide()from fontgate for guide creation - Accesses
font.info.postscriptBlueValuesandpostscriptOtherBluesfor zones - Calls
glyph.update()andfont.update()for persistence
Before Phase 3:
- 20 tools + 13 resources
- ~25% of FontLab API (after Phase 2)
After Phase 3:
- 27 tools + 17 resources
- ~30-35% of FontLab API
Added:
- Complete anchor management system
- Layer creation and removal
- Global guide management
- Alignment zone (hinting) support
Categories Improved:
- Anchors: 0% → 60% (3/5 core tools)
- Layers: 0% → 50% (2/4 tools)
- Guides & Zones: 0% → 50% (2/4 tools)
- Add anchors to base glyphs (e.g., "top", "bottom")
- Add anchors to mark glyphs (e.g., "_top" for combining marks)
- Programmatically position marks using anchor coordinates
- Auto-generate mark-to-base and mark-to-mark features
- Create color layer fonts
- Manage master layers for interpolation
- Work with construction layers
- Organize glyph variants across layers
- Add horizontal guides for cap height, x-height, baseline
- Add vertical guides for sidebearing consistency
- Use guides for optical alignment
- Programmatic guide management for consistent spacing
- Define alignment zones for baseline, x-height, cap height
- Set up hint zones for better screen rendering
- Configure PostScript hinting zones
- Maintain consistent vertical metrics across families
- Batch add anchors to glyph sets
- Programmatic layer management for variable fonts
- Guide-based glyph construction
- Zone setup for font families
-
src/resources.py- Added 4 new resource definitions
- Added URI handlers for anchors, layers, guides, and zones
- Enhanced URI parsing with proper validation
-
src/fontlab_bridge.py- Added 4 new bridge methods with FontLab Python scripts
- Implemented anchor access via glyph.anchors
- Implemented layer metadata extraction
- Implemented guide access via fontgate
- Implemented zone access via font.info
-
src/tools.py- Added 7 new tool definitions with detailed schemas
- Added 7 new tool handlers
- Implemented 7 complete tool functions with validation
- Used flAnchor, flLayer, and fgGuide classes
-
src/utils/validation.py(existing)- Used existing validation infrastructure
- All inputs validated before script execution
# Get anchors for a glyph
fontlab://glyph/A/anchors
# Returns: {"anchors": [{"name": "top", "x": 300, "y": 700}, ...], "count": 1}
# Get layers for a glyph
fontlab://glyph/A/layers
# Returns: {"layers": [{"index": 0, "name": "Layer", "visible": true, ...}], ...}
# Get all guides
fontlab://font/guides
# Returns: {"guides": [{"position": 700, "angle": 0, "name": "Cap height"}, ...], ...}
# Get alignment zones
fontlab://font/zones
# Returns: {"zones": [{"type": "blue", "bottom": -10, "top": 0}, ...], ...}# Add anchor
add_anchor(
glyph_name="A",
anchor_name="top",
x=300,
y=700
)
# Add layer
add_layer(
glyph_name="A",
layer_name="Bold Master"
)
# Add guide
add_guide(
position=700,
angle=0, # horizontal
name="Cap height"
)
# Add alignment zone
add_zone(
zone_type="blue",
bottom=-10,
top=0
)To test these features, you'll need:
- FontLab 7 or 8 installed
- A font open in FontLab
- The MCP server running and connected
Test scenarios:
- Anchors: Add "top" anchor to base glyphs, add "_top" to marks
- Layers: Create a new layer for a glyph, remove it
- Guides: Add cap height (700), x-height (500), baseline (0) guides
- Zones: Add blue zone for baseline (-10, 0), add zone for x-height (490, 510)
Remaining in Roadmap:
- Phase 3 (partial): Application Control (workspace, preferences, action sets) - 2 resources + 7 tools
- Phase 4: Automation & Specialty
- Batch Operations - ~6 tools
- Color Fonts - 1 resource + 4 tools
- Hinting - ~3 tools
Future Enhancements:
- Complete anchor tools:
auto_anchor,generate_mark_feature - Complete layer tools:
copy_layer,merge_layers - Complete guide tools:
remove_guide,add_stem - Variable font support (masters, axes, instances)
- Font validation tools
- Import/export enhancements
Status: ✅ Phase 3 Core Implementation Complete
Total Progress:
- Resources: 17 (was 4 initially)
- Tools: 27 (was 6 initially)
- API Coverage: ~30-35% (was ~10% initially)
- Phases Complete: 1 (Quick Wins), 2 (Professional), 3 (Specialized - core)