flWorkspace

fontlab.flWorkspace = class flWorkspace(object)

flWorkspace representation

Constructors:
  flWorkspace()
  flWorkspace(flWorkspace)
  flWorkspace(flObject)
  flWorkspace(objId id)
  flWorkspace(QString title)

Methods

__delattr__(...)
x.__delattr__('name') <==> del x.name
__eq__(...)
x.__eq__(y) <==> x==y
__ge__(...)
x.__ge__(y) <==> x>=y
__getattribute__(...)
x.__getattribute__('name') <==> x.name
__gt__(...)
x.__gt__(y) <==> x>y
__init__(...)
x.__init__(...) initializes x; see help(type(x)) for signature
__le__(...)
x.__le__(y) <==> x<=y
__lt__(...)
x.__lt__(y) <==> x

__ne__(...)
x.__ne__(y) <==> x!=y
__repr__(...)
x.__repr__() <==> repr(x)
__setattr__(...)
x.__setattr__('name', value) <==> x.name = value
activateEditor(...)
activateEditor(flVisualItem, QPointF canvas_pos)
activateNext(...)
activateNext()
activatePrev(...)
activatePrev()
addFamilyMembers(...)
bool addFamilyMembers(QList &packages[, bool match_subfamily = false])
addPackage(...)
addPackage(flPackage)
attachCanvas(...)
attachCanvas(flCanvas)
blockUpdate(...)
blockUpdate([int time = 2000])
canvases(...)
QList canvases()
changed(...)
changed()
checkInitHistoryState(...)
checkInitHistoryState(uint history_ix)
clearAboveHistory(...)
clearAboveHistory(uint history_ix)
clearFlag(...)
clearFlag(uint f)
clearFlags(...)
clearFlags()
clone(...)
Clone the object
closePackage(...)
closePackage(flPackage)
closeProject(...)
closeProject()
convertMouseEvent(...)
flMouseEvent convertMouseEvent(QEvent | QMouseEvent, QPoint)
createHistoryState(...)
createHistoryState(uint history_ix)
createNewProject(...)
createNewProject()
currentHistoryState(...)
currentHistoryIx()
deactivateEditor(...)
deactivateEditor()
destroyCanvas(...)
destroyCanvas(flCanvas)
doZoomIn(...)
doZoomIn([double s = 2.0])
doZoomOut(...)
doZoomOut([double s = 0.5])
exportCurrentFont(...)
exportCurrentFont()
exportFont(...)
exportFont(flPackage, ExportControl)
exportTo(...)
bool exportTo(QString filename, QString format=['EPS' | 'JPG' | 'PDF' | 'PNG' | 'SVG'])
findPackageId(...)
flPackage findPackageId(uint id)
flag(...)
flag(uint f)
getActiveCanvas(...)
flCanvas/Nothing getActiveCanvas()
getActiveTextBlock(...)
flTextBlockItem/Nothing getActiveTextBlock()
getBoundingRect(...)
QRectF getBoundingRect()
getCanvasForViewport(...)
flCanvas/Nothing getCanvasForViewport(QWidget*)
getCanvasUnderCursor(...)
flCanvas getCanvasUnderCursor()
getProperties(...)
Get object's properties list
getProperty(...)
getProperty('key') - get object property by 'key' or number
getPropertyFloat(...)
getPropertyFloat('key') - get float object property by 'key'
getPropertyInt(...)
getPropertyInt('key') - get int object property by 'key'
guidelinesUpdater(...)
flNotifier guidelinesUpdater()
hasHistoryState(...)
hasHistoryState(uint history_ix)
hasPackage(...)
bool hasPackage(const flPackage)
haveActiveEditor(...)
bool haveActiveEditor()
historyStates(...)
historyStates(bool accepted_state)
independedAll(...)
independedAll()
init(...)
init()
initialHistoryState(...)
initialHistoryIx()
isActiveCanvas(...)
bool isActiveCanvas(const flCanvas)
isEqual(...)
isEqual(flObject)
isRulersEnabled(...)
bool isRulersEnabled()
packages(...)
QList& packages()
previewRender(...)
bool previewRender()
readProject(...)
bool readProject(const QString)
release(...)
release()
remove(...)
remove([flObject])
removeChild(...)
removeChild(flObject)
removeProperty(...)
removeProperty('key')
resetToolCursor(...)
resetToolCursor()
restoreHistoryState(...)
restoreHistoryState(uint history_ix)
saveProject(...)
saveProject([QString]) | bool saveProject(QString, QList, QString ui_state
setActiveCanvas(...)
setActiveCanvas(flCanvas)
setActiveSketchboard(...)
setActiveSketchboard()
setAutoMode(...)
setAutoMode()
setFlag(...)
setFlag(uint f [, bool value])
setFocusToCanvas(...)
setFocusToCanvas(flCanvas)
setPreviewRender(...)
setPreviewRender(bool)
setProperty(...)
setProperty('key', value) - set object property by 'key' or number
setPropertyFloat(...)
setPropertyFloat('key', value) - set float object property by 'key'
setPropertyInt(...)
setPropertyInt('key', value) - set int object property by 'key'
setRenderMode(...)
setRenderMode(RenderMode)
setRulers(...)
setRulers(bool enabled)
setToolBrush(...)
setToolBrush()
setToolBucket(...)
setToolBucket()
setToolCursor(...)
setToolCursor(CursorId)
setToolEditor(...)
setToolEditor()
setToolEllipse(...)
setToolEllipse()
setToolGuidelines(...)
setToolGuidelines()
setToolKnife(...)
setToolKnife()
setToolMagnet(...)
setToolMagnet()
setToolMetrics(...)
setToolMetrics()
setToolOptimizer(...)
setToolOptimizer()
setToolPen(...)
setToolPen()
setToolPencil(...)
setToolPencil()
setToolRectangle(...)
setToolRectangle()
setToolRotate(...)
setToolRotate()
setToolScale(...)
setToolScale()
setToolScissors(...)
setToolScissors()
setToolShape(...)
setToolShape()
setToolSlant(...)
setToolSlant()
setToolSmartPen(...)
setToolSmartPen()
setToolText(...)
setToolText()
setToolTransform(...)
setToolTransform()
showFocus(...)
bool showFocus()
showSmallItems(...)
bool showSmallItems()
tag(...)
tag([string])
turnTextModeOff(...)
turnTextModeOff()
unblockUpdate(...)
unblockUpdate()
update(...)
update()
updateActiveViewport(...)
updateActiveViewport()
weAreOnPaper(...)
bool weAreOnPaper()

Static methods

cloneObject(...)
flObject cloneObject(const flObject&);
createObject(...)
flObject/Nothing createObject(int);
haveObject(...)
bool haveObject(uint);
instance(...)
flWorkspace instance()
instanceType(...)
int instanceType();

Descriptors

activeFontPanel
QWidget*
activeTextMode
EditMode
currentFontPanel
QWidget*
currentGlyph
flGlyphInfo
currentPackage
flPackage
cursorId
CursorId
defaultFontSize
int
hasChanges
bool
hasHistoryStates
bool
id
object id
isChanged
bool
isNull
bool
isPresent
bool
isReleased
bool
isValid
bool
mainWindow
QWidget*
name
object name
paintBrush
PaintBrush
paintColor
QColor
pen
QPen
penColor
QColor
refCnt
object references count
signedObjects
QMap
sketchboard
flCanvas, bool new_paper
type
object type
uiState
QString

Attributes

RenderMode = {'RenderIfActive': 0, 'RenderIfMaximized': 1}
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T
flObjectFlags = {'ofAnchored': 64, 'ofChanged': 2, 'ofHistory': 128, 'ofIgnore': 8, 'ofIgnoreChanges': 4, 'ofPassive': 16, 'ofReleased': 1, 'ofSlowUpdate': 32}

activateEditor

fontlab.flWorkspace.activateEditor = activateEditor(...)
activateEditor(flVisualItem, QPointF canvas_pos)

activateNext

fontlab.flWorkspace.activateNext = activateNext(...)
activateNext()

activatePrev

fontlab.flWorkspace.activatePrev = activatePrev(...)
activatePrev()

activeFontPanel

fontlab.flWorkspace.activeFontPanel
QWidget*

activeTextMode

fontlab.flWorkspace.activeTextMode
EditMode

addFamilyMembers

fontlab.flWorkspace.addFamilyMembers = addFamilyMembers(...)
bool addFamilyMembers(QList &packages[, bool match_subfamily = false])

addPackage

fontlab.flWorkspace.addPackage = addPackage(...)
addPackage(flPackage)

attachCanvas

fontlab.flWorkspace.attachCanvas = attachCanvas(...)
attachCanvas(flCanvas)

blockUpdate

fontlab.flWorkspace.blockUpdate = blockUpdate(...)
blockUpdate([int time = 2000])

canvases

fontlab.flWorkspace.canvases = canvases(...)
QList canvases()

changed

fontlab.flWorkspace.changed = changed(...)
changed()

checkInitHistoryState

fontlab.flWorkspace.checkInitHistoryState = checkInitHistoryState(...)
checkInitHistoryState(uint history_ix)

clearAboveHistory

fontlab.flWorkspace.clearAboveHistory = clearAboveHistory(...)
clearAboveHistory(uint history_ix)

clearFlag

fontlab.flWorkspace.clearFlag = clearFlag(...)
clearFlag(uint f)

clearFlags

fontlab.flWorkspace.clearFlags = clearFlags(...)
clearFlags()

clone

fontlab.flWorkspace.clone = clone(...)
Clone the object

cloneObject

fontlab.flWorkspace.cloneObject = cloneObject(...)
flObject cloneObject(const flObject&);

closePackage

fontlab.flWorkspace.closePackage = closePackage(...)
closePackage(flPackage)

closeProject

fontlab.flWorkspace.closeProject = closeProject(...)
closeProject()

convertMouseEvent

fontlab.flWorkspace.convertMouseEvent = convertMouseEvent(...)
flMouseEvent convertMouseEvent(QEvent | QMouseEvent, QPoint)

createHistoryState

fontlab.flWorkspace.createHistoryState = createHistoryState(...)
createHistoryState(uint history_ix)

createNewProject

fontlab.flWorkspace.createNewProject = createNewProject(...)
createNewProject()

createObject

fontlab.flWorkspace.createObject = createObject(...)
flObject/Nothing createObject(int);

currentFontPanel

fontlab.flWorkspace.currentFontPanel
QWidget*

currentGlyph

fontlab.flWorkspace.currentGlyph
flGlyphInfo

currentHistoryState

fontlab.flWorkspace.currentHistoryState = currentHistoryState(...)
currentHistoryIx()

currentPackage

fontlab.flWorkspace.currentPackage
flPackage

cursorId

fontlab.flWorkspace.cursorId
CursorId

deactivateEditor

fontlab.flWorkspace.deactivateEditor = deactivateEditor(...)
deactivateEditor()

defaultFontSize

fontlab.flWorkspace.defaultFontSize
int

destroyCanvas

fontlab.flWorkspace.destroyCanvas = destroyCanvas(...)
destroyCanvas(flCanvas)

doZoomIn

fontlab.flWorkspace.doZoomIn = doZoomIn(...)
doZoomIn([double s = 2.0])

doZoomOut

fontlab.flWorkspace.doZoomOut = doZoomOut(...)
doZoomOut([double s = 0.5])

exportCurrentFont

fontlab.flWorkspace.exportCurrentFont = exportCurrentFont(...)
exportCurrentFont()

exportFont

fontlab.flWorkspace.exportFont = exportFont(...)
exportFont(flPackage, ExportControl)

exportTo

fontlab.flWorkspace.exportTo = exportTo(...)
bool exportTo(QString filename, QString format=['EPS' | 'JPG' | 'PDF' | 'PNG' | 'SVG'])

findPackageId

fontlab.flWorkspace.findPackageId = findPackageId(...)
flPackage findPackageId(uint id)

flag

fontlab.flWorkspace.flag = flag(...)
flag(uint f)

flObjectFlags

fontlab.flWorkspace.flObjectFlags = {'ofAnchored': 64, 'ofChanged': 2, 'ofHistory': 128, 'ofIgnore': 8, 'ofIgnoreChanges': 4, 'ofPassive': 16, 'ofReleased': 1, 'ofSlowUpdate': 32}

getActiveCanvas

fontlab.flWorkspace.getActiveCanvas = getActiveCanvas(...)
flCanvas/Nothing getActiveCanvas()

getActiveTextBlock

fontlab.flWorkspace.getActiveTextBlock = getActiveTextBlock(...)
flTextBlockItem/Nothing getActiveTextBlock()

getBoundingRect

fontlab.flWorkspace.getBoundingRect = getBoundingRect(...)
QRectF getBoundingRect()

getCanvasForViewport

fontlab.flWorkspace.getCanvasForViewport = getCanvasForViewport(...)
flCanvas/Nothing getCanvasForViewport(QWidget*)

getCanvasUnderCursor

fontlab.flWorkspace.getCanvasUnderCursor = getCanvasUnderCursor(...)
flCanvas getCanvasUnderCursor()

getProperties

fontlab.flWorkspace.getProperties = getProperties(...)
Get object's properties list

getProperty

fontlab.flWorkspace.getProperty = getProperty(...)
getProperty('key') - get object property by 'key' or number

getPropertyFloat

fontlab.flWorkspace.getPropertyFloat = getPropertyFloat(...)
getPropertyFloat('key') - get float object property by 'key'

getPropertyInt

fontlab.flWorkspace.getPropertyInt = getPropertyInt(...)
getPropertyInt('key') - get int object property by 'key'

guidelinesUpdater

fontlab.flWorkspace.guidelinesUpdater = guidelinesUpdater(...)
flNotifier guidelinesUpdater()

hasChanges

fontlab.flWorkspace.hasChanges
bool

hasHistoryState

fontlab.flWorkspace.hasHistoryState = hasHistoryState(...)
hasHistoryState(uint history_ix)

hasHistoryStates

fontlab.flWorkspace.hasHistoryStates
bool

hasPackage

fontlab.flWorkspace.hasPackage = hasPackage(...)
bool hasPackage(const flPackage)

haveActiveEditor

fontlab.flWorkspace.haveActiveEditor = haveActiveEditor(...)
bool haveActiveEditor()

haveObject

fontlab.flWorkspace.haveObject = haveObject(...)
bool haveObject(uint);

historyStates

fontlab.flWorkspace.historyStates = historyStates(...)
historyStates(bool accepted_state)

id

fontlab.flWorkspace.id
object id

independedAll

fontlab.flWorkspace.independedAll = independedAll(...)
independedAll()

init

fontlab.flWorkspace.init = init(...)
init()

initialHistoryState

fontlab.flWorkspace.initialHistoryState = initialHistoryState(...)
initialHistoryIx()

instance

fontlab.flWorkspace.instance = instance(...)
flWorkspace instance()

instanceType

fontlab.flWorkspace.instanceType = instanceType(...)
int instanceType();

isActiveCanvas

fontlab.flWorkspace.isActiveCanvas = isActiveCanvas(...)
bool isActiveCanvas(const flCanvas)

isChanged

fontlab.flWorkspace.isChanged
bool

isEqual

fontlab.flWorkspace.isEqual = isEqual(...)
isEqual(flObject)

isNull

fontlab.flWorkspace.isNull
bool

isPresent

fontlab.flWorkspace.isPresent
bool

isReleased

fontlab.flWorkspace.isReleased
bool

isRulersEnabled

fontlab.flWorkspace.isRulersEnabled = isRulersEnabled(...)
bool isRulersEnabled()

isValid

fontlab.flWorkspace.isValid
bool

mainWindow

fontlab.flWorkspace.mainWindow
QWidget*

name

fontlab.flWorkspace.name
object name

packages

fontlab.flWorkspace.packages = packages(...)
QList& packages()

paintBrush

fontlab.flWorkspace.paintBrush
PaintBrush

paintColor

fontlab.flWorkspace.paintColor
QColor

pen

fontlab.flWorkspace.pen
QPen

penColor

fontlab.flWorkspace.penColor
QColor

previewRender

fontlab.flWorkspace.previewRender = previewRender(...)
bool previewRender()

readProject

fontlab.flWorkspace.readProject = readProject(...)
bool readProject(const QString)

refCnt

fontlab.flWorkspace.refCnt
object references count

release

fontlab.flWorkspace.release = release(...)
release()

remove

fontlab.flWorkspace.remove = remove(...)
remove([flObject])

removeChild

fontlab.flWorkspace.removeChild = removeChild(...)
removeChild(flObject)

removeProperty

fontlab.flWorkspace.removeProperty = removeProperty(...)
removeProperty('key')

RenderMode

fontlab.flWorkspace.RenderMode = {'RenderIfActive': 0, 'RenderIfMaximized': 1}

resetToolCursor

fontlab.flWorkspace.resetToolCursor = resetToolCursor(...)
resetToolCursor()

restoreHistoryState

fontlab.flWorkspace.restoreHistoryState = restoreHistoryState(...)
restoreHistoryState(uint history_ix)

saveProject

fontlab.flWorkspace.saveProject = saveProject(...)
saveProject([QString]) | bool saveProject(QString, QList, QString ui_state

setActiveCanvas

fontlab.flWorkspace.setActiveCanvas = setActiveCanvas(...)
setActiveCanvas(flCanvas)

setActiveSketchboard

fontlab.flWorkspace.setActiveSketchboard = setActiveSketchboard(...)
setActiveSketchboard()

setAutoMode

fontlab.flWorkspace.setAutoMode = setAutoMode(...)
setAutoMode()

setFlag

fontlab.flWorkspace.setFlag = setFlag(...)
setFlag(uint f [, bool value])

setFocusToCanvas

fontlab.flWorkspace.setFocusToCanvas = setFocusToCanvas(...)
setFocusToCanvas(flCanvas)

setPreviewRender

fontlab.flWorkspace.setPreviewRender = setPreviewRender(...)
setPreviewRender(bool)

setProperty

fontlab.flWorkspace.setProperty = setProperty(...)
setProperty('key', value) - set object property by 'key' or number

setPropertyFloat

fontlab.flWorkspace.setPropertyFloat = setPropertyFloat(...)
setPropertyFloat('key', value) - set float object property by 'key'

setPropertyInt

fontlab.flWorkspace.setPropertyInt = setPropertyInt(...)
setPropertyInt('key', value) - set int object property by 'key'

setRenderMode

fontlab.flWorkspace.setRenderMode = setRenderMode(...)
setRenderMode(RenderMode)

setRulers

fontlab.flWorkspace.setRulers = setRulers(...)
setRulers(bool enabled)

setToolBrush

fontlab.flWorkspace.setToolBrush = setToolBrush(...)
setToolBrush()

setToolBucket

fontlab.flWorkspace.setToolBucket = setToolBucket(...)
setToolBucket()

setToolCursor

fontlab.flWorkspace.setToolCursor = setToolCursor(...)
setToolCursor(CursorId)

setToolEditor

fontlab.flWorkspace.setToolEditor = setToolEditor(...)
setToolEditor()

setToolEllipse

fontlab.flWorkspace.setToolEllipse = setToolEllipse(...)
setToolEllipse()

setToolGuidelines

fontlab.flWorkspace.setToolGuidelines = setToolGuidelines(...)
setToolGuidelines()

setToolKnife

fontlab.flWorkspace.setToolKnife = setToolKnife(...)
setToolKnife()

setToolMagnet

fontlab.flWorkspace.setToolMagnet = setToolMagnet(...)
setToolMagnet()

setToolMetrics

fontlab.flWorkspace.setToolMetrics = setToolMetrics(...)
setToolMetrics()

setToolOptimizer

fontlab.flWorkspace.setToolOptimizer = setToolOptimizer(...)
setToolOptimizer()

setToolPen

fontlab.flWorkspace.setToolPen = setToolPen(...)
setToolPen()

setToolPencil

fontlab.flWorkspace.setToolPencil = setToolPencil(...)
setToolPencil()

setToolRectangle

fontlab.flWorkspace.setToolRectangle = setToolRectangle(...)
setToolRectangle()

setToolRotate

fontlab.flWorkspace.setToolRotate = setToolRotate(...)
setToolRotate()

setToolScale

fontlab.flWorkspace.setToolScale = setToolScale(...)
setToolScale()

setToolScissors

fontlab.flWorkspace.setToolScissors = setToolScissors(...)
setToolScissors()

setToolShape

fontlab.flWorkspace.setToolShape = setToolShape(...)
setToolShape()

setToolSlant

fontlab.flWorkspace.setToolSlant = setToolSlant(...)
setToolSlant()

setToolSmartPen

fontlab.flWorkspace.setToolSmartPen = setToolSmartPen(...)
setToolSmartPen()

setToolText

fontlab.flWorkspace.setToolText = setToolText(...)
setToolText()

setToolTransform

fontlab.flWorkspace.setToolTransform = setToolTransform(...)
setToolTransform()

showFocus

fontlab.flWorkspace.showFocus = showFocus(...)
bool showFocus()

showSmallItems

fontlab.flWorkspace.showSmallItems = showSmallItems(...)
bool showSmallItems()

signedObjects

fontlab.flWorkspace.signedObjects
QMap

sketchboard

fontlab.flWorkspace.sketchboard
flCanvas, bool new_paper

tag

fontlab.flWorkspace.tag = tag(...)
tag([string])

turnTextModeOff

fontlab.flWorkspace.turnTextModeOff = turnTextModeOff(...)
turnTextModeOff()

type

fontlab.flWorkspace.type
object type

uiState

fontlab.flWorkspace.uiState
QString

unblockUpdate

fontlab.flWorkspace.unblockUpdate = unblockUpdate(...)
unblockUpdate()

update

fontlab.flWorkspace.update = update(...)
update()

updateActiveViewport

fontlab.flWorkspace.updateActiveViewport = updateActiveViewport(...)
updateActiveViewport()

weAreOnPaper

fontlab.flWorkspace.weAreOnPaper = weAreOnPaper(...)
bool weAreOnPaper()

Example

import os.path
# Access the font-specific logic of FontLab 7 with
# the `fontlab` package
from fontlab import *
# Access the entire Qt application framework that powers
# FontLab 7 with the `PythonQt` package
# `PythonQt.QtGui` exposes the full Qt GUI toolkit to build
# simple and most complex UIs
from PythonQt import QtGui

# Checks if a `.vfc` file with the same file name as this
# script file exists in the same folder
loc = [os.path.dirname(__file__)] +     list(os.path.splitext(os.path.basename(__file__)))
fontPath = os.path.join(loc[0], loc[1] + '.vfc')
# If there is no such file, opens a file open dialog with
# `QtGui.QFileDialog`, so you can pick a font file or Cancel
if not os.path.exists(fontPath):
    fontPath = QtGui.QFileDialog.getOpenFileName(
        None, 'Choose font', loc[0], '')

# If there is a font file, export its instances as OTF
if fontPath:
    # `fontlab.flWorkspace` instance is the FontLab 7 app
    # seen as the font editor
    ws = flWorkspace.instance()
    # `.mainWindow` is the graphical interface of FontLab 7
    main = ws.mainWindow

    # `.loadFont` opens a file in the FontLab GUI
    main.loadFont(fontPath)

    # `.currentPackage` is the active `fontlab.flPackage`,
    # which is a font inside FontLab
    fp = ws.currentPackage

    # `fontlab.flPreferences` has the FL7 preferences
    # that hold numeric constants that represent values
    # in the Export Font As dialog settings
    pref = flPreferences()

    # New `fontlab.ExportControl` class corresponds to
    # the settings of File > Export Font As...
    ec = ExportControl()
    ec.profileName = "OpenType PS"
    ec.destinationMode = pref.DestinationFolder
    ec.conflictMode = pref.ConflictOverwrite
    ec.contentMode = pref.ContentInstances
    ec.destinationFolder = os.path.dirname(fontPath)
    ec.groupProfiles = False
    ec.groupFamily = True

    # `flWorkspace.exportFont` exports the `flPackage`
    # with `ExportControl` settings
    ws.exportFont(fp, ec)

# `QtGui.QApplication` instance is the FontLab 7 app
# seen as a graphical app that uses the Qt framework
qapp = QtGui.QApplication.instance()
# Quit the FontLab 7 app
qapp.quit()