The mlvec file format


This is an extensible vector image format specially designed for the Moho program. A data unit is a word, containing ASCII-7 letters (a-z,A-Z), numbers (0-9), and the ? - . (question mark, minus and dot) characters. All other characters are separators between words. The first character of the word has a special meaning and it is called token. The last separator before a word, other than space or control character (like tab or newline) is the beginning of the word so these are tokens too. Upper- and lowercase tokens are different. All unknown tokens are avoided (acts as remarks).

The processable data unit is a chunk. A chunk begins with a ( character, followed by a token character which defines the type of the chunk. A number without a letter is also a token (minus and dot are also means a beginning of a number). The chunk ends with the ) character. The chunk's contents are processed after the ending ) character. Because of simplicity, chunks cannot be nested. In words, separator characters could be escaped with the \ (backslash) character. All unknown chunks are avoided (acts as remarks).

Chunk types and their word types:

(? remark chunk. Cannot be nested, inside a chunk use the ?word style remark instead.)

Example: (? this is a remark)

(P mesh point. The point's mesh ID begins with 0 and increasing automatically.
number
X coordinate
default= 0
,number
Y coordinate
default= 0
Wnumber
width
default= -1

Example: (P 5.3, 4.1 W0.1)

(C curve. The curve's mesh ID begins with 0 and increasing automatically.
The referenced points must be defined before the reference.
number
mesh point ID, negative means: 'count until -id'
must be set
Cnumber
curvature value, for the following points
default= 0.30
H
the following segments are HIDDEN

V
the following segments are VISIBLE
this is the default
E
closed curve


Example: (C C0.001 0 1 2 3 E)

(S shape.
The referenced curves and segments must be defined before the reference.
Cnumber
curve ID, for the following segments
default= 0
number
segment ID, negative means: 'count until -id'
must be set
F
filled


Example: (S C1 0 1 2 C2 0 F)

Unfortunately, it is not possible to set a shape's color and other parameters from lua, so this format is usable only to load the vectorised scanned lineart images.