SOLVED Why are some start points becoming "2"? How might I fix it efficiently?

  • admin

    the short answer: this is clarified in the upcoming release

    (this link will be gone in a few days, since the release is close)

    long story:

    The start point and the symbol to indicate the direction are not the same. In a UFO a contour can start with an off curve or an on curve and still represent the same visual contour:

    # 3 times the same contour
    off off curve line line
    off curve line line off
    curve line line off off

    The first on curve is not always the starting point. This was never a problem since fontMath does calculations nicely between different point structures. Other tools aren't so nice and choke.

    RoboFont 4.2 has two symbols: one for the starting point and one for the direction (the direction is always highlighted on a on curve point)

    hope this make sense!

  • Excellent; thanks for the helpful explanation, Frederik! That’s a really nice documentation page.

    Do you know if there’s a fairly direct way to set the oncurve as the start point, in a Python script?

  • I am still interested if there is a programmatic way to set a specific oncurve start point, as asked above.

    However, I may be facing this problem because FontMake added a new compatibility checker in v3.1.0, and this checker may be overly strict.

  • If anyone (including my future self) comes along looking for a semi-manual solution, here’s a better one that what I listed above.

    1. Open all the fonts you wish to check.
    2. Run the following Python in the Scripting Window:
    for f in AllFonts():
        glyphsToCheck = []
        for g in f:
            for contour in g:
                pointCount = 0
                for segment in contour:
                    for point in segment:
                        if pointCount == 0 and pointCount+1 != point.index:
                            if not in glyphsToCheck:
                        pointCount += 1
        print(" ".join(glyphsToCheck),"\n")

    This will print out a list to the console, like this:

    Text Ultra Italic
    eight registered 
    Text 200 Italic
    thorn b a.italic question six d nine oe a p o copyright ringcomb g q 
    Text Hairline Italic
    nine.dnom a.italic OE.RECT O.sups degree O d five.dnom five.onum S five three.dnom s zero.dnom question o.sups partialdiff S.sups copyright thorn infinity eth six eight zero q b eight.dnom Ohorn.RECT g C OE p six.hiviz s.sups ampersand Omega five.tnum section six.dnom_hiviz dollar registered O.RECT zero.onum o six.dnom 

    Then, you can "create a new set from glyphs names"


    Copy and paste in the glyph names, then label it with a name like "temp" or "corrections":


    This then makes it relatively fast to go through all the affect glyphs, using a shortcut to set the start point, then the shortcut to move to the next glyph in the font view command+shift+).


    Once you finish, you can then delete the set.

    I’m guessing there is a faster way to fix this, and it would probably be worth finding if you had many sources to fix... but for a small number of fonts, this is pretty quick.

  • admin

    He Stephen

    setting the starting point with fontParts results in off off curve start structure

    # assume a glyph with 2 ovals
    g = CurrentGlyph()
    # setting the start segment for the first oval
    # the result will be a off curve as first point
    # setting the start point on the oncurve
    # get the contour object
    contour = g[1]
    # create an empty list for all the point data
    points = []
    hasOncurve = False
    # start looping over all the points in the contour
    for point in list(contour.points):
        if point.type != "offcurve":
            hasOncurve = True
        # store the point data
            (point.x, point.y), 
        # remove the point from the contour
    if hasOncurve:
        # start a while loop and check the first point type
        # only start the loop when there are on curve points
        while points[0][1] == "offcurve":
            # pop the first point
            point = points.pop(0)
            # and add it to the end
    # add all newly arranged points into the contour
    for position, type, smooth, name, identifier in points:

    Smart sets!!

    There is a complete api to set and edit and manipulate smart sets!!

    • you can set a query direclty in font window, handy for fast searches and temp sets:
    from mojo.UI import CurrentFontWindow
    w = CurrentFontWindow()
    # set a list as a query directly in the font collection
    w.setGlyphNamesAsSet(["A", "B", "C"])

  • Here is a script which you could potentially wrap into an observer:

  • Amazing; thank you so much for the solutions and deeper background info, @frederik and @frankrolf! This is really helpful and very much appreciated.

  • I’ve made an issue in the FontParts repo to request a simpler way to set start points:

  • For some reason, Frederik’s script wasn’t quite solving this ... It worked on one contour, but messed another one up newly.


    In the above example, the start point was an oncurve, and this script moved it one up, to the following offcurve. Running the script again moves it to the next offcurve after an oncurve, so running it many times makes the start point rotate around the contour. It did seem to work as desired on the other contour of this glyph, though.

    Luckily, Frank’s script worked perfectly, for a full UFO! So, for now I will just accept that I have a solution, and will try to properly understand that after some immediate tasks. I just wanted to update this post in case that helps others.

  • admin

    the example script shows two different approaches: one is the fontParts setStartSegment on the first contour and an other approach on a second contour

    You will need to combine and rearrange into a working script.

    good luck!

  • @frederik I think a good question here is why cubic to quadratic conversion moves the start point from an on-curve where it starts in the cubic, to the preceding off curve point where it sometimes ends in the quadratic. We can only hope that symbols for where the contour starts and what direction it’s going, never become two places, after 40 years of being one.

Log in to reply