RoboFab

Support RoboFab

Up

See also

RoboFab Mailinglist

Join the RoboFab users community at Google groups.

Google Groups

Email:

Visit this group

RoboFab Sponsors

RoboFab RSegment

Usage

# robofab manual
#     Segment object
#    usage examples

f = OpenFont()

for c  in f:
    for contour in c:
        for segment in contour:
            print segment
download examples/usageSegment.py
< RSegment for RoboFab Demo Font.R[0][0] >
< RSegment for RoboFab Demo Font.R[0][1] >
< RSegment for RoboFab Demo Font.R[0][2] >
< RSegment for RoboFab Demo Font.R[0][3] >
< RSegment for RoboFab Demo Font.R[0][4] >

Description

A Contour object is a list of segments. A segment is a list of points with some special attributes and methods. See the LettError wiki for a comprehensive explanation of segments.

Understanding Contours and outlines

The way outline data is organised in RoboFab, and how the various objects relate is described here: understanding contours.

Attributes

Attribute examples

# robofab manual
#     Segment object
#    attribute examples

f = OpenFont()

for c  in f:
    for contour in c:
        for segment in contour:
            print len(segment)
            print segment.type
            print segment.smooth
            print segment.points
            print segment.onCurve
            print segment.offCurve
            print segment.selected
download examples/segmentAttributes.py

Methods

Method examples

# robofab manual
#     Segment object
#    method examples

f = OpenFont()

for c  in f:
    for contour in c:
        for segment in contour:
            segment.move((50, 25))
download examples/segmentMethods.py