unified-font-object / ufo-spec

The official Unified Font Object specification source files.
http://unifiedfontobject.org
175 stars 30 forks source link

Can an open contour consist of only off-curves? #148

Closed madig closed 4 years ago

madig commented 4 years ago

The spec says that an off-curve must be followed by a curve or qcurve. A contour can be all off-curves, which is valid in TrueType. It also says that a closed contour is considered to be cyclic, implying that checking what comes after the off-curve must be cyclic, too. What about open contours? Is the following .glif file valid?

<?xml version="1.0" encoding="UTF-8"?>
<glyph name="test" format="2">
    <outline>
        <contour>
            <point x="0" y="0" type="move"/>
            <point x="50" y="25"/>
            <point x="100" y="100"/>
        </contour>
    </outline>
</glyph>
anthrotype commented 4 years ago

i think that's invalid. There's no way one can draw that off-curve only contour while keeping it open.

madig commented 4 years ago

Hm. GlifLib certainly raises an error. I suppose an off-curve without a (q)curve after it never makes sense unless everything is an off-curve. In a closed contour, we need to cycle around to continue to look for a (q)curve, but in an open contour, there is by definition no cycling, so trailing off-curves must be errors.

anthrotype commented 4 years ago

Exactly yes