Skip to content

fontlab.FaBasicPtr

FaBasicPtr

A single font audit finding.

What is FaBasic?

When you run FontLab's font audit (the grid of checkmarks in Font Window → Font Audit), the engine inspects every glyph for common outline problems: open contours, reversed winding, nearly-straight curves that should be lines, extremum nodes that are missing, and so on. Each detected problem is an FaBasic record.

In scripts, you access FaBasic records through flAuditInfo.basic. The most useful scripting workflow is: 1. Run the audit (open the Font Audit panel to populate results). 2. Iterate the findings via flAuditInfo objects. 3. For each auto-fixable finding (canBeFixed == True), call fix(). 4. Call fl.Update() to refresh the display.

(Registered as FaBasicPtr in source; Python sees it as FaBasic)

Tutorial

import fontlab as fl

# ============================================================
# The audit results are stored on flAuditInfo objects, which
# wrap FaBasic records. Access them through the canvas info
# system after running the audit.
#
# This example shows how to print and optionally auto-fix
# all audit findings for a specific glyph.
# ============================================================

font  = fl.CurrentFont()
glyph = font['S']   # try a glyph with complex curves

# Run the audit for this glyph's first layer:
layer = glyph.layers[0]

# Access audit results (method name may vary by version):
# audit_items = layer.auditResults()   # returns list of flAuditInfo

# For demonstration, we simulate what you would do with the results:
# for audit_info in audit_items:
#     b = audit_info.basic
#     print(f"Issue: {b.title}")
#     print(f"  Priority: {b.priority}")
#     print(f"  Location: ({b.location.x():.0f}, {b.location.y():.0f})")
#     print(f"  Report: {b.report}")
#     print(f"  Can be fixed: {b.canBeFixed}")
#
#     if b.canBeFixed:
#         result = b.fix()
#         if result:
#             print(f"  → Auto-fixed! Glyph '{result.name}' updated.")
#         else:
#             print(f"  → Fix returned Nothing.")

# ============================================================
# After fixing any issues, always update the display:
# ============================================================
fl.Update()
print("Audit review complete.")

Common Scripting Patterns

Print a full audit report for a glyph

import fontlab as fl

# After running the audit panel:
# font  = fl.CurrentFont()
# for glyph in font.glyphs:
#     layer = glyph.layers[0]
#     for ai in layer.auditResults():
#         b = ai.basic
#         print(f"[{glyph.name}] {b.title} — {b.report}")

Auto-fix all fixable issues across the whole font

import fontlab as fl

# font = fl.CurrentFont()
# fixed_count = 0
# for glyph in font.glyphs:
#     for ai in glyph.layers[0].auditResults():
#         b = ai.basic
#         if b.canBeFixed:
#             b.fix()
#             fixed_count += 1
# fl.Update()
# print(f"Auto-fixed {fixed_count} issues.")

Sort audit issues by priority

# issues = [ai.basic for ai in layer.auditResults()]
# issues.sort(key=lambda b: b.priority, reverse=True)
# for b in issues:
#     print(f"[priority {b.priority}] {b.title}")

Constructors:

Native bases: object

Captured native MRO: FaBasicPtr, 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 fix-pointer record. The captured declaration exposes the method fix and the attributes canBeFixed, contour, id, location, nodeIndex, priority, report, title and vector. Test canBeFixed before calling fix; the captured fix is declared as returning an flGlyph or nothing.

Source: FontLab Proteus API documentation

Source: generated/fontlab.py: FaBasicPtr 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)
canBeFixed attribute Any True if calling fix() will automatically resolve this issue.
contour attribute Any The contour this issue is associated with, or Nothing if the issue is at a higher level (e.g. a font-level metric problem).
fix function (self) -> Any FlGlyph/Nothing fix()
id attribute Any The numeric code identifying which audit rule produced this finding.
location attribute Any The glyph-space coordinates of where the issue is located.
nodeIndex attribute Any The index of the specific node involved in this issue within its contour.
priority attribute Any The severity of this issue.
report attribute Any The full detailed description of the issue, including measurements, coordinate values, and fix recommendations.
title attribute Any A brief, human-readable name for this type of issue, such as "Open contour", "Wrong direction", "Almost flat curve".
vector attribute Any A direction vector associated with the issue.