fontlab.flSnaps
flSnaps
snap object constants
Snap Enum Namespace.
What is flSnaps?
flSnaps is not a class you instantiate — it is a collection of enum dictionaries for all snap-related constants. Access them as flSnaps.SnapMode, flSnaps.SnapLineFlags, etc. Use these constants when reading or writing snap flags on guidelines and snap objects.
flSnaps.SnapMode — How snap distance is calculated
| Key | Native value | Description |
|---|---|---|
NoMode |
flSnaps::SnapMode::NoMode |
Snapping disabled. |
Point |
flSnaps::SnapMode::Point |
Snap to a discrete point (node, anchor, etc.). |
BeamAll |
flSnaps::SnapMode::BeamAll |
Snap using beam (alignment) projection in all directions. |
AllModes |
flSnaps::SnapMode::AllModes |
All snap modes combined. |
flSnaps.SnapLineFlags — Guideline type and behaviour flags
These bits describe what kind of guideline a snap line is and how it should behave.
| Key | Native value | Description |
|---|---|---|
ShortGuideline |
flSnaps::SnapLineFlags::ShortGuideline |
A bounded (non-infinite) guideline segment. |
NoOrdinates |
flSnaps::SnapLineFlags::NoOrdinates |
Native enum value. |
Vector |
flSnaps::SnapLineFlags::Vector |
A vector (angled) guideline. |
Horizontal |
flSnaps::SnapLineFlags::Horizontal |
This is a horizontal guideline (angle ≈ 0°). |
Vertical |
flSnaps::SnapLineFlags::Vertical |
This is a vertical guideline (angle ≈ 90°). |
HorzVert |
flSnaps::SnapLineFlags::HorzVert |
Horizontal or vertical. |
RoleOrdinates |
flSnaps::SnapLineFlags::RoleOrdinates |
Used as an ordinate reference. |
Basic |
flSnaps::SnapLineFlags::Basic |
A standard, non-specialised guideline. |
Auto |
flSnaps::SnapLineFlags::Auto |
This guideline was generated automatically. |
RoleView |
flSnaps::SnapLineFlags::RoleView |
Native enum value. |
Width |
flSnaps::SnapLineFlags::Width |
Represents a glyph advance-width reference. |
Coordinate |
flSnaps::SnapLineFlags::Coordinate |
Carries a numeric coordinate value. |
AbsoluteMarkersPos |
flSnaps::SnapLineFlags::AbsoluteMarkersPos |
Marker positions are absolute (not relative to the guideline). |
RoleMeasures |
flSnaps::SnapLineFlags::RoleMeasures |
Used for measurements (ruler). |
AscLine |
flSnaps::SnapLineFlags::AscLine |
An ascender reference line. |
DscLine |
flSnaps::SnapLineFlags::DscLine |
A descender reference line. |
NullLine |
flSnaps::SnapLineFlags::NullLine |
A baseline (zero reference) line. |
flSnaps.MarkerFlags — What a marker represents
| Key | Native value | Description |
|---|---|---|
FillsShape |
flSnaps::MarkerFlags::FillsShape |
This marker fills (colours) the interior of the shape. |
LeftMetric |
flSnaps::MarkerFlags::LeftMetric |
This marker is a left sidebearing reference. |
RightMetric |
flSnaps::MarkerFlags::RightMetric |
This marker is a right sidebearing reference. |
flSnaps.MarkerKey — Marker classification
| Key | Native value | Description |
|---|---|---|
UndefinedMarker |
flSnaps::MarkerKey::UndefinedMarker |
Unclassified. |
HandMarker |
flSnaps::MarkerKey::HandMarker |
Manually placed by the designer. |
AutoMarker |
flSnaps::MarkerKey::AutoMarker |
Automatically detected. |
AnyKeyMarker |
flSnaps::MarkerKey::AnyKeyMarker |
Wildcard — matches any marker type in queries. |
Tutorial
import fontlab as fl
from fontlab import flSnaps
# Print all available snap mode values:
print("SnapMode:", flSnaps.SnapMode)
print("MarkerFlags:", flSnaps.MarkerFlags)
print("MarkerKey:", flSnaps.MarkerKey)
# Read snap flags from a guideline:
font = fl.CurrentFont()
for gl in font.guidelines:
flag = gl.snapFlag(0) # role 0 = general snap
is_vert = bool(flag & flSnaps.SnapLineFlags["Vertical"])
is_horz = bool(flag & flSnaps.SnapLineFlags["Horizontal"])
print(f"Guideline at {gl.centerPoint}: vert={is_vert} horz={is_horz}")
Common Scripting Patterns
Check which snap flags are set on a guideline
import fontlab as fl
font = fl.CurrentFont()
for gl in font.guidelines:
flag = gl.snapFlag(0)
print(f"'{gl.name or '(unnamed)'}': snapFlag[0]={flag:#010b}")
Enable snapping to all nodes on a guideline
import fontlab as fl
font = fl.CurrentFont()
for gl in font.guidelines:
if gl.name == "baseline":
gl.setSnapFlagValue(0, True) # enable role 0 snapping
print(f"Enabled snapping on '{gl.name}'")
flSnaps.FastGuidelines
Use the flSnaps.FastGuidelines dictionary with subscription.
| Key | Native value | Description |
|---|---|---|
FastGuidelines_90 |
flSnaps::FastGuidelines::FastGuidelines_90 |
Native enum value. |
FastGuidelines_45 |
flSnaps::FastGuidelines::FastGuidelines_45 |
Native enum value. |
FastGuidelines_15 |
flSnaps::FastGuidelines::FastGuidelines_15 |
Native enum value. |
FastGuidelines_5 |
flSnaps::FastGuidelines::FastGuidelines_5 |
Native enum value. |
flSnaps.SnapStyle
Use the flSnaps.SnapStyle dictionary with subscription.
| Key | Native value | Description |
|---|---|---|
NoStyle |
flSnaps::SnapStyle::NoStyle |
Native enum value. |
StyleAutoSnapPoint |
flSnaps::SnapStyle::StyleAutoSnapPoint |
Native enum value. |
StyleSnapPoint |
flSnaps::SnapStyle::StyleSnapPoint |
Native enum value. |
StyleCloseSnapPoint |
flSnaps::SnapStyle::StyleCloseSnapPoint |
Native enum value. |
StyleMetricSnapPoint |
flSnaps::SnapStyle::StyleMetricSnapPoint |
Native enum value. |
StyleBackSnapPoint |
flSnaps::SnapStyle::StyleBackSnapPoint |
Native enum value. |
StyleBeamsSnapPoint |
flSnaps::SnapStyle::StyleBeamsSnapPoint |
Native enum value. |
flSnaps.ViewMode
Use the flSnaps.ViewMode dictionary with subscription.
| Key | Native value | Description |
|---|---|---|
Hidden |
flSnaps::ViewMode::Hidden |
Native enum value. |
ShowPermanent |
flSnaps::ViewMode::ShowPermanent |
Native enum value. |
ShowTemporary |
flSnaps::ViewMode::ShowTemporary |
Native enum value. |
ShowAll |
flSnaps::ViewMode::ShowAll |
Native enum value. |
Native bases: object
Captured native MRO: flSnaps, 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 holder of snap constants. The captured declaration exposes the dict attributes FastGuidelines, MarkerFlags, MarkerKey, SnapLineFlags, SnapMode, SnapStyle and ViewMode; it has no methods beyond the constructor.
Source: FontLab Proteus API documentation
Source: generated/fontlab.py: flSnaps 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 |
|---|---|---|---|
FastGuidelines |
attribute | dict |
|
MarkerFlags |
attribute | dict |
|
MarkerKey |
attribute | dict |
|
SnapLineFlags |
attribute | dict |
|
SnapMode |
attribute | dict |
|
SnapStyle |
attribute | dict |
|
ViewMode |
attribute | dict |
|
__init__ |
function | (self, /, *args: Any, **kwargs: Any) -> None |
Initialize self. (shared captured text) |