fontlab.flSticker
flSticker
Canvas Annotation.
What is flSticker?
A sticker is a text label that you can attach to a shape in the glyph editor. It appears directly on the canvas as a coloured text box, floating next to the shape it belongs to. Stickers are a handy way to annotate specific shapes during a review or proofing process — you can leave notes like "check spacing", "needs smoother curve", or "discuss with client" directly on the glyph.
In scripts, flSticker lets you add, read, move, or remove these canvas annotations programmatically. For example, you could write a script that audits all glyphs and attaches stickers to flag potential problems.
Tutorial
from PythonQt.QtCore import QPointF
import fontlab as fl
from fontlab import flSticker
# ============================================================
# Add an annotation sticker to a shape in the current glyph.
# This is useful for leaving review comments directly on
# the canvas, visible to anyone editing the glyph.
# ============================================================
font = fl.CurrentFont()
glyph = font['A']
layer = glyph.layers[0]
if not layer.shapes:
print("No shapes in 'A'.")
else:
shape = layer.shapes[0]
# Create the sticker and set its text:
sticker = flSticker()
sticker.text = "Check the apex"
# Position it near the top of the shape's bounding box:
bbox = shape.boundingBox
sticker.move(QPointF(bbox.center().x(), bbox.top() + 20))
# Attach to the shape:
shape.addSticker(sticker)
fl.Update()
print(f"Added sticker: '{sticker.text}'")
print(f"Position: {sticker.textRect}")
# ============================================================
# Read back all stickers on all shapes in the glyph.
# Useful for a review script that collects all annotations.
# ============================================================
print("\nAll stickers in 'A':")
for shape in layer.shapes:
for s in shape.stickers:
print(f" Shape '{shape.name}': '{s.text}' at {s.textRect}")
# ============================================================
# Remove all stickers from a shape.
# Use this after a review pass to clean up annotations.
# ============================================================
for shape in layer.shapes:
shape.clearStickers()
fl.Update()
print("All stickers cleared.")
Common Scripting Patterns
Flag all glyphs with open contours
from PythonQt.QtCore import QPointF
import fontlab as fl
from fontlab import flSticker
font = fl.CurrentFont()
for glyph in font.glyphs:
layer = glyph.layers[0]
for shape in layer.shapes:
for contour in shape.contours:
if not contour.closed:
s = flSticker()
s.text = "OPEN CONTOUR"
bbox = shape.boundingBox
s.move(QPointF(bbox.left(), bbox.top() + 30))
shape.addSticker(s)
fl.Update()
print("Flagged all open contours with stickers.")
Collect all sticker texts across the entire font
import fontlab as fl
font = fl.CurrentFont()
notes = []
for glyph in font.glyphs:
for layer in glyph.layers:
for shape in layer.shapes:
for sticker in shape.stickers:
notes.append((glyph.name, layer.name, sticker.text))
print(f"Found {len(notes)} stickers:")
for glyph_name, layer_name, text in notes:
print(f" {glyph_name} / {layer_name}: {text}")
Inherited binding members: flObject.
Constructors: flSticker() flSticker(flObject) flSticker(flSticker) flSticker(QString)
Native bases: object
Captured native MRO: flSticker, 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:
A sticker object on the canvas. The captured declaration exposes the attributes text, textRect, shape and boundingBox, and the method move. It is created as flSticker(), flSticker(flObject), flSticker(flSticker) or flSticker(QString). It also carries the shared object members name, id, type, isValid, release and remove.
Source: FontLab Proteus API documentation
Source: generated/fontlab.py: flSticker 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) |
boundingBox |
attribute | Any |
The full bounding box of the sticker on the canvas, including any visual padding around the text. |
changed |
function | (self) -> Any |
(shared captured text) |
checkInitHistoryState |
function | (self, history_ix: int) -> Any |
(shared captured text) |
clearAboveHistory |
function | (self, history_ix: int) -> Any |
(shared captured text) |
clearFlag |
function | (self, f: int) -> Any |
(shared captured text) |
clearFlags |
function | (self) -> Any |
(shared captured text) |
clone |
function | (self, *args: Any, **kwargs: Any) -> Any |
Clone the object (shared captured text) |
cloneObject |
function | (*args: Any, **kwargs: Any) -> Any |
(shared captured text) |
createObject |
function | (*args: Any, **kwargs: Any) -> Any |
FlObject/Nothing createObject(int); (shared captured text) |
currentHistoryState |
function | (self, *args: Any, **kwargs: Any) -> Any |
(shared captured text) |
flObjectFlags |
attribute | dict |
(shared captured text) |
flag |
function | (self, f: int) -> Any |
(shared captured text) |
getProperties |
function | (self, *args: Any, **kwargs: Any) -> Any |
Get object's properties list (shared captured text) |
getProperty |
function | (self, *args: Any, **kwargs: Any) -> Any |
Get object property by 'key' or number (shared captured text) |
getPropertyFloat |
function | (self, *args: Any, **kwargs: Any) -> Any |
Get float object property by 'key' (shared captured text) |
getPropertyInt |
function | (self, *args: Any, **kwargs: Any) -> Any |
Get int object property by 'key' (shared captured text) |
hasChanges |
attribute | Any |
(shared captured text) |
hasHistoryState |
function | (self, history_ix: int) -> Any |
(shared captured text) |
hasHistoryStates |
attribute | Any |
(shared captured text) |
haveObject |
function | (*args: Any, **kwargs: Any) -> Any |
(shared captured text) |
historyStates |
function | (self, accepted_state: bool) -> Any |
(shared captured text) |
id |
attribute | Any |
Object id (shared captured text) |
independedAll |
function | (self) -> Any |
(shared captured text) |
initialHistoryState |
function | (self, *args: Any, **kwargs: Any) -> Any |
(shared captured text) |
instanceType |
function | (*args: Any, **kwargs: Any) -> Any |
(shared captured text) |
isChanged |
attribute | Any |
(shared captured text) |
isEqual |
function | (self, arg0: flObject) -> Any |
(shared captured text) |
isNull |
attribute | Any |
(shared captured text) |
isPresent |
attribute | Any |
(shared captured text) |
isReleased |
attribute | Any |
(shared captured text) |
isValid |
attribute | Any |
(shared captured text) |
move |
function | (self, arg0: QPointF) -> Any |
Moves the sticker to a new position on the canvas. |
name |
attribute | Any |
Object name (shared captured text) |
propertyNames |
function | (self, *args: Any, **kwargs: Any) -> Any |
PropertyNames(): sorted snapshot of dynamic property keys (shared captured text) |
refCnt |
attribute | Any |
Object references count (shared captured text) |
release |
function | (self) -> Any |
(shared captured text) |
remove |
function | (self, *args: Any, **kwargs: Any) -> Any |
(shared captured text) |
removeChild |
function | (self, arg0: flObject) -> Any |
(shared captured text) |
restoreHistoryState |
function | (self, history_ix: int) -> Any |
(shared captured text) |
setFlag |
function | (self, *args: Any, **kwargs: Any) -> Any |
(shared captured text) |
setProperty |
function | (self, *args: Any, **kwargs: Any) -> Any |
Set object property by 'key' or number (shared captured text) |
setPropertyFloat |
function | (self, *args: Any, **kwargs: Any) -> Any |
Set float object property by 'key' (shared captured text) |
setPropertyInt |
function | (self, *args: Any, **kwargs: Any) -> Any |
Set int object property by 'key' (shared captured text) |
shape |
attribute | Any |
The shape this sticker is attached to. |
tag |
function | (self, *args: Any, **kwargs: Any) -> Any |
(shared captured text) |
text |
attribute | Any |
The text displayed in the sticker box. |
textRect |
attribute | Any |
The bounding rectangle of the sticker's text area in canvas coordinates. |
type |
attribute | Any |
Object type (shared captured text) |
update |
function | (self) -> Any |
(shared captured text) |