Skip to content

fontpr · declarations 001

Back to fontpr

available

available(*args: Any, **kwargs: Any) -> Any

Return True when MCP tools are ready.

build_glyph

build_glyph(*, glyph_name: str, recipe: str, font_id: int | None = None, font_name: str | None = None, direction: str | None = None, layer_name: str | None = None, replace: bool | None = None, auto_layer: bool | None = None, dry_run: bool | None = None) -> Any

Build a glyph from a bounded explicit recipe using FontLab's construction engine. Use get_glyph detail=construction when source anchors, layers or placement facts are not yet known. Syntax: =ligature+mark@top_2[_top] or =base&second+mark@top[_top]. No expressions or implicit mark positioning. Validates dependencies and builds a temporary layer before committing. One exact master layer only; preserves other layers. Replaces target shapes/components/anchors and width. New glyphs are unencoded. Does not create OpenType substitutions. Returned resolved_components group numbers follow recipe order, not visual RTL order. Undo supported.

Parameters:

  • font_id (float, optional): Optional package id.
  • font_name (str, optional): Optional font name.
  • glyph_name (str, required): Exact target glyph name, existing or new.
  • recipe (str, required): Explicit = recipe in logical reading order, at most 32 components and 4096 characters. Source aliases are resolved to actual font names.
  • direction (str, optional): ltr (default) or rtl. RTL places logical groups right-to-left without reflecting outlines; only one-time builds (auto_layer=false).
  • layer_name (str, optional): Exact master layer; active target layer or current master for a new glyph.
  • replace (bool, optional): Allow replacing existing target layer content, after inspection. Default false.
  • auto_layer (bool, optional): Keep as an automatically rebuilt recipe layer. Default false (one-time build).
  • dry_run (bool, optional): Validate and return staged construction without modifying the target. Default false.

Effect: glyph mutation; dry_run is read-only staging.

Returns: {status:"validated",glyph_name,construction,resolved_components} for dry_run; {status:"ok",created,glyph_name,construction,resolved_components} otherwise

Notes:

  • Requires existing source glyphs, an exact master layer, and explicit base/mark anchors. dry_run defaults false; replace and auto_layer default false.
  • Syntax: =A+acutecomb@top[_top]; =f&i; =base&second+mark@top[_top]. An optional named attachment base uses mark@baseGlyph:top[_top], referencing an earlier component in the same + group.
  • No expressions or implicit mark placement. Target names match [A-Za-z_.][A-Za-z0-9_.-]*, up to 255 characters. Recipes <=4096 characters and <=32 components; dependency depth <=32 and <256 visited/active nodes, aggregate shape budget 4096, node budget 50000, anchors <=256 per source/generated layer.
  • Replaces target shapes/components/anchors/width on one master layer; other layers survive. Existing body/components require replace:true. New glyph is unencoded. Undo supported. Does not add OpenType substitutions.
  • resolved_components has glyph_name, group (1-based recipe order), non_spacing and transform; recipe order is not visual RTL order.
# Example
result = fontpr.build_glyph(font_id=101, glyph_name='Aacute', recipe='=A+acutecomb@top[_top]', layer_name='Regular', dry_run=True)

Source: FontLab MCP specification

call

call(name: str, /, **kwargs: Any) -> Any

call(name, **kwargs) - invoke an MCP tool.

Call an MCP tool by its name with keyword arguments.

name must be a str, otherwise TypeError is raised. Example: fontpr.call("list_glyphs", font_id=1).

Source: FontLab MCP specification

close_font

close_font(*, font_id: int | None = None, font_name: str | None = None, save: bool | None = None) -> Any

Close the active or requested font without prompting, discarding unsaved changes by default. With save:true, first save to its known native location; fail and keep the font open if saving needs a path or fails.

Parameters:

  • font_id (float, optional): Optional FontLab package id.
  • font_name (str, optional): Optional font name match.
  • save (bool, optional): Save before closing; default false.

Effect: close font; discards unsaved edits by default. Destructive.

Returns: {status:"ok",font:font_summary}

Notes:

  • save defaults false: no prompt. save:true first uses the known native save location and keeps the font open if saving fails.
  • After save_font(path), the source location is unchanged. Verify the saved copy, then close with save:false. Do not close preexisting user fonts in batch cleanup.
# Example
result = fontpr.close_font(font_id=101, save=False)

Source: FontLab MCP specification

compile_features

compile_features(*, revision: str, font_id: int | None = None, font_name: str | None = None, dry_run: bool | None = None) -> Any

Compile current Features text with Classes panel data, then publish GSUB/GPOS/GDEF as one undoable change. On failure retain source and the last good tables. Does not regenerate visual Lookups. Returns compiler warnings. dry_run validates and reports candidate table sizes/hashes without publishing.

Parameters:

  • font_id (float, optional): Optional font id.
  • font_name (str, optional): Optional font name match.
  • revision (str, required): Required current get_features revision; rejects stale source/classes/glyph order.
  • dry_run (bool, optional): Compile without publishing; default false.

Effect: undoable publication of compiled GSUB/GPOS/GDEF; dry_run is read-only.

Returns: {status,published,warnings,tables:[{tag,size,sha256}],revision}

Notes:

  • Uses current Features text plus Classes panel data. Requires the current get_features revision. Compiles in isolation and commits only after success, preserving last good tables on failure.
  • dry_run:true reports candidate tables and warnings without publishing or creating Undo. Successful publication is one Undo command and does not regenerate visual Lookups.
  • Empty source deliberately compiles to empty layout tables. Compiler warnings are returned as text. Existing compiler limits apply; the MCP tool does not bypass them.
# Validate current source
result = fontpr.compile_features(font_id=101, revision='<get_features revision>', dry_run=True)

Source: FontLab MCP specification

delete_all_kerning_classes

delete_all_kerning_classes(*, font_id: int | None = None, font_name: str | None = None, master_name: str | None = None, all_masters: bool | None = None, undo: bool | None = None) -> Any

Delete all kerning classes from one or more font masters.

Parameters:

  • font_id (float, optional): Optional FontLab package id.
  • font_name (str, optional): Optional font name match.
  • master_name (str, optional): Optional master/layer name. Defaults to active master.
  • all_masters (bool, optional): Delete classes from all masters. Default false.
  • undo (bool, optional): Create undo history. Default true.

Effect: destructive kerning mutation; undo defaults true. Destructive.

Returns: {status,deleted_classes,class_names,masters}

Notes:

  • all_masters defaults false. true targets all masters. Already empty classes return zero.
# Example
result = fontpr.delete_all_kerning_classes(font_id=101, master_name='Regular')

Source: FontLab MCP specification

delete_all_kerning_pairs

delete_all_kerning_pairs(*, font_id: int | None = None, font_name: str | None = None, master_name: str | None = None, all_masters: bool | None = None, undo: bool | None = None) -> Any

Delete all kerning pairs from one or more font masters.

Parameters:

  • font_id (float, optional): Optional FontLab package id.
  • font_name (str, optional): Optional font name match.
  • master_name (str, optional): Optional master/layer name. Defaults to active master.
  • all_masters (bool, optional): Delete pairs from all masters. Default false.
  • undo (bool, optional): Create undo history. Default true.

Effect: destructive kerning mutation; undo defaults true. Destructive.

Returns: {status,deleted_pairs,masters:[affected master names]}

Notes:

  • all_masters defaults false. true targets all masters. An already empty selection succeeds with zero deleted_pairs.
# Example
result = fontpr.delete_all_kerning_pairs(font_id=101, master_name='Regular')

Source: FontLab MCP specification

delete_kerning_class

delete_kerning_class(*, class_name: str, font_id: int | None = None, font_name: str | None = None, master_name: str | None = None, undo: bool | None = None) -> Any

Delete a kerning class from a font master by class name.

Parameters:

  • class_name (str, required): Kerning class name without @ prefix.
  • font_id (float, optional): Optional FontLab package id.
  • font_name (str, optional): Optional font name match.
  • master_name (str, optional): Optional master/layer name. Defaults to active master.
  • undo (bool, optional): Create undo history. Default true.

Effect: destructive kerning mutation; undo defaults true. Destructive.

Returns: {status,master,deleted_class}

Notes:

  • Class must exist. Native group deletion can affect pairs that reference it; inspect pairs afterward.
# Example
result = fontpr.delete_kerning_class(font_id=101, class_name='A_Left', master_name='Regular')

Source: FontLab MCP specification

delete_kerning_pair

delete_kerning_pair(*, left: str, right: str, font_id: int | None = None, font_name: str | None = None, master_name: str | None = None, undo: bool | None = None) -> Any

Delete a kerning pair from a font master. Use @GroupName for kerning classes.

Parameters:

  • left (str, required): Left glyph name or @class.
  • right (str, required): Right glyph name or @class.
  • font_id (float, optional): Optional FontLab package id.
  • font_name (str, optional): Optional font name match.
  • master_name (str, optional): Optional master/layer name. Defaults to active master.
  • undo (bool, optional): Create undo history. Default true.

Effect: kerning mutation; undo defaults true. Destructive.

Returns: {status,master,left,right,deleted_value}

Notes:

  • Missing pair is an error. This handler explicitly scopes the deletion to the resolved master.
# Example
result = fontpr.delete_kerning_pair(font_id=101, left='A', right='V', master_name='Regular')

Source: FontLab MCP specification

edit_glyph_components

edit_glyph_components(*, glyph_name: str, layer_name: str, operations: list[dict[str, Any]], font_id: int | None = None, font_name: str | None = None, dry_run: bool | None = None) -> Any

Atomically add, set_transform or remove live component elements on one existing non-Auto unlocked layer, with Undo. Preserves outlines, masks/other layers, hints, anchors, metrics and metadata. Indices are original zero-based shape indices, not component ordinals. Each existing index may occur once. Additions append in operation order. Use get_glyph detail=construction to inspect components; editable live components carry shape_index. Dry run validates all operations before any changes. Matrices are absolute [a,b,c,d,tx,ty], x'=ax+cy+tx; y'=bx+dy+ty. No Python or whole-glyph replacement needed.

Parameters:

  • font_id (float, optional): Optional font package id.
  • font_name (str, optional): Optional font name.
  • glyph_name (str, required): Exact existing destination glyph.
  • layer_name (str, required): Exact existing destination layer.
  • dry_run (bool, optional): Validate without changes, default false.
  • operations (list[dict[str, Any]], required)

Effect: mutate one layer with Undo; dry_run is read-only.

Returns: {status:"validated",operations} or {status:"ok",glyph_name,layer_name,components:[{shape_index,glyph_name,source_layer,matrix}]}

Notes:

  • All operations validate before application. Only live component instances are targeted. Non-component shapes, hints, anchors, metadata, metrics and other layers remain unchanged.
  • Existing targets use original shape indices, each at most once. New components append. set_transform assigns an absolute affine matrix; automatically attached components cannot have their transform overridden.
  • Sources must exist and have the specified layer; cyclic and over-budget dependency graphs are rejected. Auto or locked destinations are rejected.
# Preview a component placement
result = fontpr.edit_glyph_components(glyph_name='composite.example', layer_name='Regular', dry_run=True, operations=[{'op': 'add', 'glyph_name': 'A', 'matrix': [1, 0, 0, 1, 20, 30]}])

Source: FontLab MCP specification

edit_glyph_nodes

edit_glyph_nodes(*, glyph_name: str, operations: list[dict[str, Any]], font_id: int | None = None, font_name: str | None = None, layer_name: str | None = None, dry_run: bool | None = None) -> Any

Apply 1..256 sequential native node/curve edits to one existing non-Auto layer, atomically with Undo. No Python needed. Indices refer to the result of preceding operations; process original indices descending for insert/delete batches. Inspect first. Returns changed contours with fresh indices. Coordinates and vectors are shape-local font units. Supports on endpoints, off quadratic controls and curve cubic controls. duplicate_extrema selects existing extrema on the specified axis and follows contour direction automatically. smart_corner sets a node radius (negative for ink traps) and manages the live filter. Smart Corners filters expose source node indices; other components/groups must be edited at their source.

Parameters:

  • glyph_name (str, required): Exact existing glyph name.
  • font_id (float, optional): Optional package id.
  • font_name (str, optional): Optional font name.
  • layer_name (str, optional): Exact layer; defaults to active layer.
  • dry_run (bool, optional): Validate and return staged geometry without editing. Default false.
  • operations (list[dict[str, Any]], required)

Effect: mutate one glyph layer; Undo supported.

Returns: {status,glyph_name,layer_name,contours} with fresh node indices

Notes:

  • All operations run on cloned contours and validate before committing. dry_run returns the same staged geometry without changing the glyph.
  • Indices refer to the geometry after preceding operations. Duplicate/delete original indices from highest to lowest or re-inspect. add inserts before node_index; node count appends.
  • duplicate requires an on-curve node. Its dx/dy vector is the total original-to-copy separation. centered=true splits the displacement equally. move_handles defaults true; incoming control follows original, outgoing control follows copy.
  • set changes only supplied coordinates/type/smooth; it never implicitly moves handles. transform affects exactly node_indices, or the whole contour if omitted.
  • split performs an exact, unrounded de Casteljau split on the outgoing line/quadratic/cubic segment. It replaces that segment’s old control nodes; their custom node metadata is not carried over. Endpoints and other nodes are preserved.
  • On endpoints, Off quadratic handles and Curve cubic handles are supported. At least two explicit on-curve nodes; cubics require two Curve handles; quadratic Off chains preserve implied knots; open endpoints must be on-curve. Auto layers, components and groups are rejected. No automatic decomposition. Unedited contour metadata, other contours/layers and metrics are preserved.
  • Up to 256 operations and 10000 source nodes per call. Coordinates must remain finite within +/-10000000.
  • duplicate_extrema selects existing differentiable extrema, excluding corners, open endpoints and flat plateaus. axis=y separates top/bottom extrema horizontally, axis=x separates left/right extrema vertically. distance is the total centered separation; the vector follows contour tangent direction. It does not insert missing extrema. Axes are shape-local.
  • split requires explicit line, single-quadratic or cubic segments. It rejects quadratic chains rather than treating them as cubic controls.
  • smart_corner requires node_index and nonzero radius; positive rounds, negative creates an ink trap. smooth=true enables G2 rounding. Inapplicable nodes are rejected atomically. Creates/reuses the live Smart Corners filter; subsequent reads and edits address source nodes. Other filters are not replaced.
# Duplicate all existing vertical extrema and separate pairs horizontally by 5 units
result = fontpr.edit_glyph_nodes(glyph_name='C', operations=[{'op': 'duplicate_extrema', 'shape_index': 0, 'contour_index': 0, 'axis': 'y', 'distance': 5}])

Source: FontLab MCP specification

edit_layer_hints

edit_layer_hints(*, glyph_name: str, operations: list[dict[str, Any]], font_id: int | None = None, font_name: str | None = None, layer_name: str | None = None, dry_run: bool | None = None) -> Any

Atomically add, set, move or delete stored PostScript hints in one existing non-Auto glyph layer with Undo. No Python or full glyph replacement needed. Read get_layer_hints first. Indices refer only to hints (not guidelines) and to the result of preceding operations; delete original indices descending. Coordinates are layer font units. Ordinary widths must be positive; native ghost widths are -20 top or 21 bottom and require horizontal orientation. Linked/expression geometry needs explicit detach=true, which freezes the hint and does not move outlines. Existing hint identities, unrelated guides/anchors/outlines, other layers and TrueType instructions are preserved. Locked hints must be unlocked in FontLab first.

Parameters:

  • font_id (float, optional): Optional package id.
  • font_name (str, optional): Optional font name.
  • glyph_name (str, required): Exact existing glyph name.
  • layer_name (str, optional): Exact layer name; defaults to active layer.
  • dry_run (bool, optional): Validate and preview without changing the glyph. Default false.
  • operations (list[dict[str, Any]], required)

Effect: mutate one layer; Undo supported.

Returns: {status,glyph_name,layer_name,hint_count,hints,offset,next_offset,truncated,tth_command_count}

Notes:

  • Stages all operations as plain data before changing the live model. Invalid batches and dry runs do not modify hints, linked nodes or expressions. One recursive glyph Undo notification per committed batch.
  • Indices refer only to hints and are sequential. add appends; delete original indices descending. Returned hints contain the first page of final records; use get_layer_hints for further pages.
  • add requires orientation, position and width. set patches supplied fields; move requires delta and preserves width. Ordinary width must be positive. ghost=true requires horizontal orientation and width -20 (top) or 21 (bottom).
  • Changing driven geometry requires detach=true. This freezes linked coordinates and clears the position expression on that hint only. Metadata-only name edits preserve links; outline nodes never move. Locked hints require unlocking in FontLab.
  • Existing edited hint identities and metadata are preserved. Unrelated guides, zones, glyph anchors, outlines, other layers and TrueType instructions remain intact. Deleting a hint uses native removal to clean up references to that hint.
  • Requires a non-Auto layer. Supports 1..256 operations; finite numbers within +/-10000000 and single-line names up to 128 characters.
# Add a horizontal stem hint
result = fontpr.edit_layer_hints(glyph_name='H', layer_name='Regular', operations=[{'op': 'add', 'orientation': 'horizontal', 'position': 300, 'width': 60}])

Source: FontLab MCP specification

explain

explain(*, query: str | None = None, id: str | None = None, section: str | None = None, limit: int | None = None, max_chars: int | None = None) -> Any

Search FontLab Quick Help content loaded in the current workspace. Use this first for explain, how-to, tutorial, UI control, tool, panel, setting, and action questions. For exact Quick Help/status-tip ids, pass id such as 'bar_glyph.valueLSB' or '@bar_glyph.valueLSB'. For natural-language topics, pass a short query. This tool is read-only and never changes font or editor state.

Parameters:

  • query (str, optional): Natural-language topic to search, for example remove overlap, auto layer recipe, or axis graph.
  • id (str, optional): Optional exact Quick Help/status-tip id, with or without the @ prefix.
  • section (str, optional): Optional Quick Help id section/prefix filter, for example bar_glyph or axiswidget.
  • limit (float, optional): Maximum matches to return. Default 8, max 25.
  • max_chars (float, optional): Approximate maximum text characters to return across matches. Default 12000, max 60000.

Effect: read.

Returns: {status,mode,id?,query?,entries:[{id,text,score,...}],count,total_entries,matched_count?}

Notes:

  • id accepts an optional @ prefix; exact lookup and query modes differ. Empty matches are not evidence that a feature does not exist. Content depends on loaded Quick Help.
  • limit defaults 8, clamps 1–25. max_chars defaults 12000, clamps 500–60000; individual entries may be truncated.
# Example
result = fontpr.explain(query='auto layer recipe', limit=5)

Source: FontLab MCP specification

geometry

geometry(*, op: str, a: dict[str, Any] | None = None, b: dict[str, Any] | None = None, points: list[dict[str, Any]] | None = None, t: float | None = None) -> Any

Pure geometry calculations, no font mutation. vector returns b-a, distance, unit vector, perpendicular and angle in degrees. curve evaluates/splits a line, quadratic or cubic Bezier at t and returns point, derivative, unit tangent and left/right control polygons.

Parameters:

  • op (str, required; one of vector, curve)
  • a (dict[str, Any], optional): vector: start point {x,y}.
  • b (dict[str, Any], optional): vector: end point {x,y}.
  • points (list[dict[str, Any]], optional): curve: ordered control polygon of 2..4 points {x,y}.
  • t (float, optional): curve: parameter 0..1.

Effect: pure calculation.

Returns: vector: vector/length/unit/normal/angle_degrees; curve: point/derivative/unit_tangent/left/right

Notes:

  • Zero vectors and zero derivatives return null unit vectors rather than dividing by zero.
  • curve accepts 2..4 ordered control points and t in [0,1]. Does not modify glyph geometry.
# Compute a direction and distance
result = fontpr.geometry(op='vector', a={'x': 0, 'y': 0}, b={'x': 3, 'y': 4})

Source: FontLab MCP specification

get_active_font

get_active_font() -> Any

Return the active font.

Parameters: none.

Effect: read.

Returns: font_summary directly (NOT {font:...})

Notes:

  • Errors when no font is active.
# Example
result = fontpr.get_active_font()

Source: FontLab MCP specification

get_active_glyphs

get_active_glyphs() -> Any

Deprecated alias for get_current_glyphs. Return current glyphs using flWorkspace::instance().getSelectedGlyphs(glyphs).

Parameters: none.

Effect: read (deprecated alias).

Returns: Same as get_current_glyphs

Notes:

  • Use get_current_glyphs in new clients.
# Example
result = fontpr.get_active_glyphs()

Source: FontLab MCP specification

get_current_glyphs

get_current_glyphs() -> Any

Return current glyphs using flWorkspace::instance().getSelectedGlyphs(glyphs): the active glyph when a glyph window is active, or selected glyphs when a font window is active. Use this for questions like 'what is the name of current glyph?' or 'which glyphs are selected?'.

Parameters: none.

Effect: read shared UI selection.

Returns: {glyph_count,glyphs:[glyph_facts],current_glyph?:glyph_facts}

Notes:

  • Active Glyph window → its active glyph; Font window → selected glyphs. No font selector; errors for no selection. current_glyph appears only for a single result.
# Example
result = fontpr.get_current_glyphs()

Source: FontLab MCP specification

get_features

get_features(*, font_id: int | None = None, font_name: str | None = None, output_path: str | None = None, format: str | None = None, overwrite: bool | None = None) -> Any

Read Features panel source as data:{text:string}, with a revision covering source, shared classes and glyph order. Optional file exchange writes the data object as UTF-8 JSON or the source as .fea text. Does not decompile or compile tables.

Parameters:

  • font_id (float, optional): Optional font id.
  • font_name (str, optional): Optional font name match.
  • output_path (str, optional): Optional absolute export file path.
  • format (str, optional): json (default) or fea. fea requires output_path.
  • overwrite (bool, optional): Replace an existing output file; default false.

Effect: read; optional file export.

Returns: {version,font_id,revision,data:{text}} or {version,font_id,revision,data_path,format,size}

Notes:

  • Reads the Features panel source without decompiling binaries. Revision covers source, shared OpenType classes, glyph order and open-font identity.
  • output_path exports either data:{text} as a data-only JSON object, or plain UTF-8 FEA when format=fea. Keep version and revision separately for set_features. Existing files require overwrite:true.
# Read Features source
result = fontpr.get_features(font_id=101)

Source: FontLab MCP specification

get_font_hinting

get_font_hinting(*, font_id: int | None = None, font_name: str | None = None, master_name: str | None = None, kind: str | None = None, offset: int | None = None, limit: int | None = None) -> Any

Read font-level alignment zones and standard stems directly, without glyphs, kerning, features or Python. Returns paged exact records for one master, plus available master names. Distinguishes PostScript, TrueType and family zones. PostScript zones match Font Info's guideline-derived values. Use this for 'list/show my font's zones/stems'; get_layer_hints is glyph-level and is not a replacement. Follow next_offset when has_more=true.

Parameters:

  • font_id (float, optional): Optional FontLab package id.
  • font_name (str, optional): Optional font name match.
  • master_name (str, optional): Exact master name; defaults to current master. Reading preserves the active font/master.
  • kind (str, optional): all (default), zones, or stems.
  • offset (float, optional): Zero-based record offset, default 0.
  • limit (float, optional): Maximum records per page, default 50, maximum 100. Results also have a JSON byte budget.

Effect: read only.

Returns: Paged font-level alignment-zone and standard-stem records, with master names and pagination metadata.

Notes:

  • Reads one master without changing the active font or master. Follow next_offset when has_more is true.
  • Use get_layer_hints for glyph-level hints instead.
# Read font zones
result = fontpr.get_font_hinting(kind='zones')

Source: FontLab MCP specification

get_font_info

get_font_info(*, font_id: int | None = None, font_name: str | None = None, detail: str | None = None, master_name: str | None = None, kind: str | None = None, offset: int | None = None, limit: int | None = None) -> Any

Return package-level font info JSON without glyph outlines. Full metadata can be large because it includes kerning, groups, features and lib data. For alignment zones and standard stems use get_font_hinting instead, or detail='hinting'; no Python required. Use set_font_info for metadata patches.

Parameters:

  • font_id (float, optional): Optional FontLab package id.
  • font_name (str, optional): Optional font name match.
  • detail (str, optional): full (default) or hinting for compact native zone/stem records without kerning.
  • master_name (str, optional): For detail=hinting: exact master name; defaults to current master.
  • kind (str, optional): For detail=hinting: all, zones, or stems.
  • offset (float, optional): For detail=hinting: record offset.
  • limit (float, optional): For detail=hinting: page size, default 50, maximum 100.

Effect: read.

Returns: VFJ package-info object directly; no glyph outlines

Notes:

  • Read payload structure before using it. Includes more information than set_font_info can write. It is NOT the schema for set_font_info.
# Example
result = fontpr.get_font_info(font_id=101)

Source: FontLab MCP specification

get_font_metrics

get_font_metrics(*, font_id: int | None = None, font_name: str | None = None) -> Any

Return font-level metrics for the active or requested font: UPM, ascender, descender, x-height, cap height, line gap, italic angle, weight, and width.

Parameters:

  • font_id (float, optional): Optional FontLab package id.
  • font_name (str, optional): Optional font name match.

Effect: read.

Returns: font_metrics directly

Notes:

  • Returns current master and master-name list. No master_name parameter.
# Example
result = fontpr.get_font_metrics(font_id=101)

Source: FontLab MCP specification

get_glyph

get_glyph(*, glyph_name: str, detail: str | None = None, layer_name: str | None = None, mark_glyph: str | None = None, component_index: int | None = None, nodes_format: str | None = None, font_id: int | None = None, font_name: str | None = None) -> Any

Read one glyph. detail=construction returns compact layer names, anchors, component identities/transforms and width. Omit detail for full writable VFJ, including outlines and metadata. Choose the representation needed for the operation; construction is not a replacement payload. For indexed node edits use get_glyph_nodes. Full contours use nodes_list with x, y, type and flags.

Parameters:

  • glyph_name (str, required): Glyph name.
  • detail (str, optional): construction for compact recipe, anchors, component references/transforms and width; otherwise full writable VFJ. Construction summaries cannot be passed to set_glyph; use get_vfj_schema for writable definitions.
  • layer_name (str, optional): Exact layer to inspect for construction detail; defaults to active layer.
  • mark_glyph (str, optional): With detail=construction, find matching anchor pairs for this mark. Supports descriptive aliases and imported b./m. anchor classes; returns offsets, recipe suffixes and above_base_ink evidence.
  • component_index (float, optional): Optional logical ligature position (1..32) for attachment candidates; recognizes top_2 and imported *_ligComponent_2 names.
  • nodes_format (str, optional): Optional: list for nodes_list output, or compact/nodes for legacy nodes strings. Default list.
  • font_id (float, optional): Optional FontLab package id.
  • font_name (str, optional): Optional font name match.

Effect: read.

Returns: Full VFJ glyph object OR {glyph_name,construction}

Notes:

  • Omit detail for full VFJ; nodes_format defaults list. compact or nodes requests legacy compact strings. Full VFJ is not restricted by layer_name.
  • Construction-only inspection limits include 256 anchors and 4096 shapes per layer; complex sources can fail with a budget error. The response omits outlines.
  • Full VFJ embeds PNG image bytes for portable get/set round trips. Construction summaries are read-only projections, not valid set_glyph payloads.
  • Construction summaries include shape_index for editable live component instances; reuse it with edit_glyph_components without fetching full VFJ or node data. Legacy component records may lack an editable shape_index.
# Example
result = fontpr.get_glyph(font_id=101, glyph_name='H', detail='construction', layer_name='Regular')

Source: FontLab MCP specification

get_glyph_metrics

get_glyph_metrics(*, glyph_name: str, font_id: int | None = None, font_name: str | None = None) -> Any

Return glyph metrics: advance width, LSB, RSB, and metrics expressions for the active or requested glyph.

Parameters:

  • glyph_name (str, required): Glyph name.
  • font_id (float, optional): Optional FontLab package id.
  • font_name (str, optional): Optional font name match.

Effect: read.

Returns: glyph_metrics directly

Notes:

  • Metrics concern current glyph/layer context; inspect active_layer_name. No layer_name parameter.
# Example
result = fontpr.get_glyph_metrics(font_id=101, glyph_name='H')

Source: FontLab MCP specification

get_glyph_nodes

get_glyph_nodes(*, glyph_name: str, font_id: int | None = None, font_name: str | None = None, layer_name: str | None = None, shape_index: int | None = None, contour_index: int | None = None) -> Any

Inspect indexed nodes in one glyph layer without full VFJ. Coordinates are local to each shape; shape_transform maps them to layer coordinates. Indices are zero-based storage indices. type=on is an endpoint, curve is an ordinary cubic Bezier handle, off is a quadratic handle. Returns vertical_extrema (y extrema) and horizontal_extrema (x extrema) indices of existing smooth curve extrema. Smart Corners filters expose their editable source nodes with smart_radius and smart_corner_applicable; other components/groups are unsupported. Use before edit_glyph_nodes.

Parameters:

  • glyph_name (str, required): Exact glyph name; use get_active_glyphs to resolve the current glyph.
  • font_id (float, optional): Optional package id.
  • font_name (str, optional): Optional font name.
  • layer_name (str, optional): Exact layer; defaults to active layer.
  • shape_index (int, optional): Optional zero-based shape filter.
  • contour_index (int, optional): Optional zero-based contour filter; requires shape_index.

Effect: read.

Returns: {glyph_name,layer_name,shapes:[{shape_index,shape_transform,editable,contours}]}

Notes:

  • Coordinates are shape-local. Apply shape_transform for layer-space geometry. All indices are zero-based and include handles.
  • Inspection is bounded to 10000 nodes and 1024 contours/shapes; use shape_index and contour_index filters. Smart Corners filters expose editable source nodes; other components/groups are reported rather than expanded.
  • type=curve is an ordinary cubic Bezier handle; type=off is a quadratic handle. Contours include vertical_extrema (y) and horizontal_extrema (x) indices for existing differentiable extrema. Nodes include smart_corner_applicable and smart_radius (null for ordinary nodes). The top-level edit_tool names edit_glyph_nodes.
# Inspect the active layer of C
result = fontpr.get_glyph_nodes(glyph_name='C')

Source: FontLab MCP specification

get_kerning_pair

get_kerning_pair(*, left: str, right: str, font_id: int | None = None, font_name: str | None = None, master_name: str | None = None) -> Any

Return the kerning value for a left/right pair on a font master. Use @GroupName for kerning classes.

Parameters:

  • left (str, required): Left glyph name or @class.
  • right (str, required): Right glyph name or @class.
  • font_id (float, optional): Optional FontLab package id.
  • font_name (str, optional): Optional font name match.
  • master_name (str, optional): Optional master/layer name. Defaults to active master.

Effect: read.

Returns: {master,left,right,has_value,value,mark}

Notes:

  • Use @ClassName for a class side. has_value:false returns value:0; this is not the same as an explicitly stored zero or necessarily the effective class-fallback kerning.
# Example
result = fontpr.get_kerning_pair(font_id=101, left='A', right='V')

Source: FontLab MCP specification

get_layer_hints

get_layer_hints(*, glyph_name: str, font_id: int | None = None, font_name: str | None = None, layer_name: str | None = None, offset: int | None = None, limit: int | None = None, include_tth: bool | None = None) -> Any

Read stored PostScript stem/ghost hints on one glyph layer without outlines or whole-glyph JSON. These are actual hints, not detected preview stems. Returns zero-based hint_index, orientation, position, width, ghost, name, lock/link/expression state, pagination and tth_command_count. Horizontal position is y, vertical position is x, in layer font units. No Python needed. include_tth optionally reads native TrueType command strings; this tool pair edits PostScript hints only.

Parameters:

  • font_id (float, optional): Optional package id.
  • font_name (str, optional): Optional font name.
  • glyph_name (str, required): Exact glyph name; resolve current selection with get_active_glyphs.
  • layer_name (str, optional): Exact layer name; defaults to active layer.
  • offset (int, optional): Zero-based hint offset, default 0; use next_offset to continue.
  • limit (int, optional): Hints per page, 1..100, default 50, also bounded to 40 KB.
  • include_tth (bool, optional): Also return read-only TrueType command strings, up to 512 commands and a 60 KB response. Default false.

Effect: read one layer.

Returns: {glyph_name,layer_name,hint_count,hints,offset,next_offset,truncated,editable,edit_tool,tth_command_count,tth?}

Notes:

  • Returns actual stored PostScript hint records, excluding ordinary guidelines, zones and detected preview stems. hint_index is zero-based within the hint list only.
  • Horizontal position is y; vertical position is x. width is native signed perpendicular thickness; ordinary stem edits use positive widths. Native horizontal ghost widths are -20 (top) or +21 (bottom). The latter exports to PostScript -21 with the native boundary-position conversion.
  • Reports linked_start, linked_end, linked_direction, expression, locked and geometry_editable. Geometry-editable is false for driven, locked or diagonal records. Metadata previews may truncate names/expressions at 1024 characters with explicit flags.
  • Pages contain 1..100 hints (default 50) and at most 40 KB. Total layer budget: 4096 hints / 10000 guidelines.
  • include_tth=true optionally returns up to 512 TrueType command strings within a 60 KB response. TrueType editing is not part of edit_layer_hints.
# Inspect Regular layer hints
result = fontpr.get_layer_hints(glyph_name='H', layer_name='Regular')

Source: FontLab MCP specification

get_lookups

get_lookups(*, font_id: int | None = None, font_name: str | None = None, output_path: str | None = None, overwrite: bool | None = None) -> Any

Read the editable Lookups panel document as versioned JSON, including glyph classifications, classes, scripts/features, lookup rules, flags and anchors. Works with the panel closed. Return data unchanged except intended edits to set_lookups with the returned revision. Does not compile or change Features text. For large fonts use output_path to export data as a local JSON file instead of returning it inline.

Parameters:

  • font_id (float, optional): Optional FontLab package id.
  • font_name (str, optional): Optional font name match.
  • output_path (str, optional): Optional absolute local JSON file path. Writes the data object and returns its path, revision and byte count instead of inline data.
  • overwrite (bool, optional): Allow replacing output_path; default false.

Effect: read; optionally export a JSON file; initializes the same editable document as opening the Lookups panel.

Returns: {version,font_id,revision,issue,data} or {version,font_id,revision,issue,data_path,json_bytes}

Notes:

  • data is the complete editable visual model, not compiled GSUB/GPOS bytes or Features text. It includes glyphsList, groupsList, scriptsList, anchorsList and lookupsList plus optional compiler settings. Preserve all fields you do not intend to edit.
  • Lookup flags include process_ligatures: false for IgnoreLigatures. Omitted process_ligatures means true. Context rules, named lookup references and anchors remain structured JSON.
  • Use the returned font_id and revision in set_lookups. The revision is scoped to the open font and editable data; reread after changes, undo or reopening. issue reports existing import limitations without adding any UI label.
  • For large fonts use output_path. Noto Nastaliq lookup data is about 11 MB, exceeding the 8 MiB incoming MCP message limit for an inline replacement. The exported UTF-8 file contains only the data object. Edit that file locally, then use set_lookups with data_path, version and revision. File export refuses overwrite unless explicitly enabled.
# Read a complete Lookups document
result = fontpr.get_lookups(font_id=101)

Source: FontLab MCP specification

get_mcp_settings

get_mcp_settings() -> Any

Read global MCP Python execution settings, allowed ranges, defaults, and read-only transport settings. Includes the cooperative Python time budget, source/output character limits and retained output-log capacity. Does not expose authentication tokens or grant Python permission.

Parameters: none.

Effect: read.

Returns: {settings,constraints,transport,output_log_entry_limit_chars,note}

Notes:

  • Reads the effective global MCP settings, defaults, ranges and read-only transport state. It never returns authentication tokens.
  • Python timeout is cooperative, not a hard interruption of native calls. Transport response waiting is derived from the Python budget; an external client can still impose a shorter deadline.
# Read execution limits and ranges
result = fontpr.get_mcp_settings()

Source: FontLab MCP specification

get_opentype_tables

get_opentype_tables(*, font_id: int | None = None, font_name: str | None = None, tags: list[Any] | None = None, include_data: bool | None = None, output_path: str | None = None, format: str | None = None, overwrite: bool | None = None) -> Any

Inspect stored OpenType table bytes: tags, byte counts and SHA-256 hashes. These are last stored/published bytes, not a fresh font export; uncompiled Features/Lookups edits are not included. Optional base64 data or JSON file export; binary export requires exactly one tag. Never compiles or modifies the font.

Parameters:

  • font_id (float, optional): Optional font id.
  • font_name (str, optional): Optional font name match.
  • tags (list[Any], optional): Optional array of exact four-byte table tags, e.g. GSUB, GPOS, GDEF. Omit to list all stored tables; missing requested tags are errors.
  • include_data (bool, optional): Include base64 bytes; default false inline, true for JSON file export.
  • output_path (str, optional): Optional absolute output file path.
  • format (str, optional): json (default) or binary. binary requires output_path and exactly one selected table tag.
  • overwrite (bool, optional): Replace an existing export file; default false.

Effect: read; optional file export.

Returns: {version,font_id,source:"stored",tables:[{tag,size,sha256,data_base64?}],output_path?,format?}

Notes:

  • Lists raw tables currently stored in the font, not custom-table XML definitions and not a fresh font export. Tables can be absent if they have never been stored/published.
  • Without tags, lists all stored tables. Explicit absent tags are errors. Default inline response contains metadata only; include_data:true adds base64.
  • JSON output_path defaults to including base64 table data in the file; the tool response omits base64 to stay compact. format:binary requires exactly one explicit tag and output_path, and writes exact raw bytes.
  • Never compiles or edits the font; use compile_features first when fresh Features-generated GSUB/GPOS/GDEF bytes are wanted. Source changes alone do not update stored tables.
# Inspect all stored table sizes and hashes
result = fontpr.get_opentype_tables(font_id=101)

Source: FontLab MCP specification

get_preferences

get_preferences(*, query: str | None = None, keys: list[str] | None = None, offset: int | None = None, limit: int | None = None) -> Any

Read FontLab application preferences without an open font. Returns exact keys, values and types. Search keys with query or select exact keys. Credentials and unsupported value types are excluded. Use explain for preference meaning and allowed values.

Parameters:

  • query (str, optional): Optional case-insensitive key substring.
  • keys (list[str], optional): Optional exact keys returned by get_preferences.
  • offset (int, optional): Result offset, default 0.
  • limit (int, optional): Maximum results, default 50, maximum 200.

Effect: read.

Returns: {preferences:[{key,type,value}],total,offset,has_more}

Notes:

  • No open font needed. Offset defaults 0; limit defaults 50, range 1–200. Exact keys must all be exposed or the call fails.
  • Excludes credentials and arbitrary QSettings keys; mcp.enabled is controlled in the Aidus UI, not by set_preferences.
# Example
result = fontpr.get_preferences(query='font.ask', limit=50)

Source: FontLab MCP specification

get_vfj_schema

get_vfj_schema(*, topic: str | None = None, include_examples: bool | None = None, include_dependencies: bool | None = None) -> Any

Reference for VFJ inspection or authoring; tools with self-contained argument schemas do not require this lookup. Discover writable VFJ glyph JSON: complete glyph/layer hierarchy, outlines/nodes, components/transforms, anchors, guidelines/hints, groups/builders, images, paint, metadata and references. Request a known topic directly for field types, defaults, examples and native semantics; use overview only to discover topic names. Does not require an open font. Construction summaries are NOT writable VFJ.

Parameters:

  • topic (str, optional): Schema topic; default overview lists all topics. Returns one focused definition; plural topic aliases are accepted.
  • include_examples (bool, optional): Include examples, default true.
  • include_dependencies (bool, optional): Include full transitive definitions as self-contained schema; default false. Use this when referenced definitions are needed together; known topics can be requested directly.

Effect: read.

Returns: {topic,catalog_version,title,notes,definition?,related_topics?,schema?,examples?,topics?}

Notes:

  • Default responses contain one focused definition and related topic names. Plural aliases such as components are accepted.
  • Set include_dependencies:true to receive the full self-contained schema with transitive definitions. Ordinary component edits should use edit_glyph_components instead of replacing full VFJ.
# Discover construction topics
result = fontpr.get_vfj_schema()

Source: FontLab MCP specification

list_actions

list_actions(*, query: str | None = None) -> Any

Discover unresolved FontLab action ids for run_actions. Returns id (snake_case JSON key) and label (Tools > Actions menu name). Reuse a known id; query filters unknown names, for example overlap -> remove_overlap.

Parameters:

  • query (str, optional): Optional case-insensitive filter on id or label.

Effect: read.

Returns: {actions:[{id,label}],count}

Notes:

  • Empty query lists all actions. A nonempty query with no match is an error. Labels can be localized; use the returned stable id. No per-action parameter schema is returned.
# Example
result = fontpr.list_actions(query='overlap')

Source: FontLab MCP specification

list_aidus_files

list_aidus_files(*, root: str | None = None, path: str | None = None, offset: int | None = None, limit: int | None = None) -> Any

Discover or list the two allowed file folders under FontLab's user data folder: aidus=Aidus, scripts=Scripts/Aidus. No Python or open font required. With no arguments returns absolute roots; with root lists one directory, without recursion. Missing folders return exists=false; writes create parents. Links are listed but cannot be followed. Listing order is filesystem order; paginate without modifying the directory.

Parameters:

  • root (str, optional; one of aidus, scripts): Omit to discover the roots; choose aidus for output/data or scripts for Python scripts.
  • path (str, optional): Relative directory within root, with '/' separators. Omit or empty for the root itself.
  • offset (int, optional): Listing offset 0..10000. Default 0; use returned next_offset while truncated=true.
  • limit (int, optional): Maximum entries 1..500, default 50. Output also has a 40 KB budget.

Effect: read.

Returns: {roots,max_file_bytes,encoding} or {root,path,absolute_path,exists,entries,offset,next_offset,truncated}

Notes:

  • No arguments discovers the canonical user-data roots aidus=Aidus and scripts=Scripts/Aidus. Discovery does not create folders. No open font or Python opt-in required.
  • Directory listing is nonrecursive, including hidden entries. Symlinks are listed as inaccessible, never followed. Missing directories return exists=false and an empty list.
  • Use next_offset while truncated=true; offsets are bounded to 10000. Do not mutate a directory between listing pages. Results have a 40 KB entry budget.
# Discover the available folders
result = fontpr.list_aidus_files()

Source: FontLab MCP specification

list_fonts

list_fonts() -> Any

List open fonts.

Parameters: none.

Effect: read.

Returns: {fonts:[font_summary]}

# Example
result = fontpr.list_fonts()

Source: FontLab MCP specification

list_glyphs

list_glyphs(*, font_id: int | None = None, font_name: str | None = None, detail: str | None = None, query: str | None = None, limit: int | None = None, offset: int | None = None, min_contour_count: int | None = None, max_contour_count: int | None = None, min_component_count: int | None = None, min_bottom: float | None = None, max_bottom: float | None = None, has_unicode: bool | None = None, script: str | None = None) -> Any

List glyphs. For requests like 'glyphs with 3 or more contours', use min_contour_count with basic detail for compact results. For bottom/minY range requests, use min_bottom and max_bottom so the tool filters exactly. Use detail='facts' when glyph facts such as bounds.height are needed for comparisons. For comparisons, the caller must apply the numeric predicate exactly, e.g. taller than height 696 means bounds.height > 696 only. contour_count is real contours across glyph layers and is not shape_count.

Parameters:

  • font_id (float, optional): Optional FontLab package id.
  • font_name (str, optional): Optional font name match.
  • detail (str, optional): basic or facts.
  • query (str, optional): Optional substring matching actual glyph names or FontLab descriptive aliases (beh-ar matches uni0628 when mapped). Results always include actual names.
  • limit (float, optional): Maximum returned glyphs; default 100, maximum 500. Use offset for pagination.
  • offset (float, optional): Zero-based start offset.
  • min_contour_count (float, optional): Only glyphs whose contour_count is at least this value.
  • max_contour_count (float, optional): Only glyphs whose contour_count is at most this value.
  • min_component_count (float, optional): Only glyphs whose component_count is at least this value.
  • min_bottom (float, optional): Only glyphs whose bounds.minY/bottom is at least this value. Inclusive.
  • max_bottom (float, optional): Only glyphs whose bounds.minY/bottom is at most this value. Inclusive.
  • has_unicode (bool, optional): Only glyphs whose has_unicode value matches this.
  • script (str, optional): Only glyphs whose scripts array includes this Unicode script name, for example Greek.

Effect: read.

Returns: {font,offset,limit,total,total_matching,filtered,glyphs:[glyph_summary or facts plus index]}

Notes:

  • Defaults: detail basic, offset 0, limit 100; limit clamps to 1–500. query is a case-insensitive glyph-name substring. Pagination is over matches; total is unfiltered font glyph count.
  • Bounds/contour/component constraints are inclusive. If min_bottom > max_bottom, they are swapped. script matches case-insensitively.
  • Stop paging when offset + returned glyph count >= total_matching. Geometry inspection has a 1500 ms scan budget and at most 1000 fact inspections per call. Fact filters scan beyond the page to compute total_matching; decreasing limit alone may not avoid this limit. Narrow query or page basic names and inspect individual glyphs.
  • Basic results gain only the fact fields needed by requested filters. facts adds the full fact model. A strict height comparison is client-side bounds.height > threshold.
# Example
result = fontpr.list_glyphs(font_id=101, detail='basic', limit=100, offset=0)

Source: FontLab MCP specification

list_kerning_classes

list_kerning_classes(*, font_id: int | None = None, font_name: str | None = None, master_name: str | None = None) -> Any

List kerning classes for a font master, including member glyph names.

Parameters:

  • font_id (float, optional): Optional FontLab package id.
  • font_name (str, optional): Optional font name match.
  • master_name (str, optional): Optional master/layer name. Defaults to active master.

Effect: read.

Returns: {master,classes:[kerning_class],total_classes}

Notes:

  • No pagination. Class names in returned objects have no @ prefix.
# Example
result = fontpr.list_kerning_classes(font_id=101)

Source: FontLab MCP specification

list_kerning_pairs

list_kerning_pairs(*, font_id: int | None = None, font_name: str | None = None, master_name: str | None = None, left: str | None = None, right: str | None = None, limit: int | None = None, offset: int | None = None) -> Any

List kerning pairs for a font master. Use @GroupName syntax for kerning classes. Supports pagination and optional left/right filters.

Parameters:

  • font_id (float, optional): Optional FontLab package id.
  • font_name (str, optional): Optional font name match.
  • master_name (str, optional): Optional master/layer name. Defaults to active master.
  • left (str, optional): Optional left glyph or @class filter.
  • right (str, optional): Optional right glyph or @class filter.
  • limit (float, optional): Maximum returned pairs. Default 200.
  • offset (float, optional): Zero-based start offset.

Effect: read.

Returns: {master,pairs:[{left,right,value,mark}],total_pairs,offset,limit,returned}

Notes:

  • limit defaults 200, minimum 1, no maximum enforced here. left/right are case-insensitive substring filters, not exact matching.
  • total_pairs is unfiltered. Page until returned < limit (an exact-sized final page needs one empty follow-up). Keep the master/filter stable.
# Example
result = fontpr.list_kerning_pairs(font_id=101, master_name='Regular', limit=200, offset=0)

Source: FontLab MCP specification

list_tools

list_tools() -> Any

Return MCP tool metadata.

Return the MCP tool metadata dicts of the running build.

Each dict carries name, description and inputSchema. Blocked tools (run_python, get_python_output) are left out; the list is empty while the MCP tools are unavailable.

Source: FontLab MCP specification

new_font

new_font(*, family_name: str | None = None, style_name: str | None = None, encoding: str | None = None) -> Any

Create a new FontLab font containing .notdef only. The encoding sets the display repertoire; it does not create its glyphs.

Parameters:

  • family_name (str, optional): Optional family name.
  • style_name (str, optional): Optional style name.
  • encoding (str, optional): Optional FontLab encoding name; defaults to Latin Simple.

Effect: create font / change UI state.

Returns: {status,family_name,style_name,encoding,font:font_summary}

Notes:

  • Style defaults Regular; encoding defaults Latin Simple. The repertoire initially contains only .notdef. Existing family names can be made unique; use returned names and font.id.
# Example
result = fontpr.new_font(family_name='MCP Demo', style_name='Regular')

Source: FontLab MCP specification

open_font

open_font(*, path: str) -> Any

Open a font file in FontLab 9.

Parameters:

  • path (str, required): Absolute path to a font file.

Effect: open font / change UI state.

Returns: {status:"ok"|"error",path,errors:[{path,id}]}

Notes:

  • No font ID is returned. Compare list_fonts before/after opening; collections may open more than one font. Reopening an already open file may not create a new ID.
  • Import support follows the FontLab build. Error IDs are native load error enums; do not infer success from an empty errors array. Unlike save/close, this tool is not a general guarantee of dialog-free import for every format.
# Example
result = fontpr.open_font(path='/absolute/input.vfb')

Source: FontLab MCP specification