Skip to content

Instantly share code, notes, and snippets.

@be5invis
Last active October 21, 2016 00:49
Show Gist options
  • Save be5invis/d913c3cadb3654bd2c150b4050d50dfb to your computer and use it in GitHub Desktop.
Save be5invis/d913c3cadb3654bd2c150b4050d50dfb to your computer and use it in GitHub Desktop.
CTF1.h
typedef uint16_t glyphid_t;
typedef uint16_t shapeid_t;
typedef int16_t sshapeid_t;
typedef struct {...} position_t;
typedef struct CTF1Point {
position_t x;
position_t y;
} CTF1Point;
typedef struct CTF1Attachment {
shapeid_t pointID;
position_t x;
position_t y;
} CTF1Attachment;
typedef union CTF1FormationComponent {
struct { // A closed contour
CTF1Point *points;
uint8_t *flags
} contour;
struct { // A glyph reference
glyphid_t glyphid;
CTF1Attachment *attachments;
} reference;
} CTF1FormationComponent;
typedef struct CTF1Constraint {
ConstraintType type; // XShift, XInterpolate, YShift, YInterpolate
shapeid_t correspondedPoints[]; // 2 for Shift, 3 for Interpolate
} CTF1Constraint;
typedef struct CTF1Glyph {
shapeid_t nComponents; // Quantity of components in this glyph.
sshapeid_t *componentArity; // An array of signed integers identifying the types and lengths
// of components used to form one glyph. Positive: a contour with
// N points; Negative: a reference with N attachments;
CTF1FormationComponent *components;
shapeid_t nConstraints; // Quantity of constraints applied to “points” of this glyph;
shapeid_t *constraints;
} CTF1Glyph;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment