Skip to content

fontlab.ExportControl

ExportControl

Font export configuration.

What is ExportControl?

When you export a font (File → Export Font As), FontLab reads a set of parameters: which export profile (OpenType PS, Variable TTF, etc.), where to put the files, how to handle conflicts. ExportControl lets scripts access and modify these parameters programmatically.

The most common use is in automation scripts that export many fonts to a predictable location: set the profile, set the folder, set conflictMode = 0 (overwrite), then call the export command. This is the scripting equivalent of clicking through the Export Font dialog.

Tutorial

import fontlab as fl
from fontlab import ExportControl

# ============================================================
# Set up a clean export configuration for batch use.
# This is the scripting equivalent of filling in the
# Export Font As dialog and clicking OK.
# ============================================================

ec = ExportControl()
ec.init()   # always start from clean defaults

# Choose the export profile:
ec.profileName = "OpenType PS"   # OTF with CFF outlines

# Tell FontLab where to put the exported files:
ec.destinationMode   = 1                      # 1 = custom folder
ec.destinationFolder = "/tmp/exported_fonts/" # absolute path

# Don't ask about conflicts — just overwrite:
ec.conflictMode = 0   # 0 = overwrite existing files

# Export the full font (not just selected glyphs):
ec.contentMode = 0   # 0 = full font

# Organise output by family name (all styles in one folder):
ec.groupFamily = True

print(f"Export config: '{ec.profileName}' → '{ec.destinationFolder}'")

# ============================================================
# Save settings so they persist for next time.
# ============================================================
ec.store()
print("Settings saved.")

# ============================================================
# Load previously saved settings and adjust one field.
# Useful if you want to preserve most settings but change the
# profile for this run.
# ============================================================
ec2 = ExportControl()
if ec2.load():
    print(f"Loaded profile: '{ec2.profileName}'")
    ec2.profileName = "Variable TTF"  # override just the profile
    print(f"Changed to: '{ec2.profileName}'")
else:
    print("No saved settings found — starting from defaults.")

Common Scripting Patterns

Export to OTF and UFO in one pass

from fontlab import ExportControl

# Export OTF:
ec = ExportControl()
ec.init()
ec.profileName       = "OpenType PS"
ec.destinationMode   = 1
ec.destinationFolder = "/tmp/exports/otf/"
ec.conflictMode      = 0
ec.store()
# fl.ExportFont(ec)   # call the export command

# Export UFO:
ec.profileName       = "UFO"
ec.destinationFolder = "/tmp/exports/ufo/"
ec.store()
# fl.ExportFont(ec)

Export only selected glyphs

from fontlab import ExportControl

ec = ExportControl()
ec.init()
ec.profileName    = "OpenType PS"
ec.destinationMode = 1
ec.destinationFolder = "/tmp/subset_export/"
ec.contentMode    = 1   # 1 = selected glyphs only
ec.conflictMode   = 0

Constructors:

Native bases: object

Captured native MRO: ExportControl, object

Native new allocation evidence (not an init overload): (args, *kwargs) Create and return a new object. See help(type) for accurate signature.

Supplemental documentation: An export control record. The captured declaration exposes the attributes conflictMode, contentMode, contentName, destinationFolder, destinationMode, groupFamily, groupProfiles, profileId and profileName, and the methods init, load and store. load returns a bool.

Source: FontLab Proteus API documentation

Source: generated/fontlab.py: ExportControl captured declaration

Complete member index

Every captured member retains its own identity. Identical captured declaration text is linked once; this does not establish native inheritance or interchangeable objects.

Member Kind Signature Summary
__init__ function (self, /, *args: Any, **kwargs: Any) -> None Initialize self. (shared captured text)
conflictMode attribute Any How to handle existing files with the same name.
contentMode attribute Any What to include in the export.
contentName attribute Any String contentName
destinationFolder attribute Any
destinationMode attribute Any Where to write the exported files.
groupFamily attribute Any If True, all styles of the same font family are grouped into a family-named subfolder.
groupProfiles attribute Any If True, files from different export profiles are grouped into profile-named subfolders within the destination.
init function (self) -> Any Resets all properties to their factory default values.
load function (self) -> bool Loads previously stored settings from preferences.
profileId attribute Any The numeric ID of the export profile.
profileName attribute Any The name of the export profile — exactly as it appears in the export dialog.
store function (self) -> Any Saves the current settings to FontLab's preferences storage so they persist across application restarts.