3 Accessing and modifying data
(require sfont/navigator) | package: sfont |
syntax
(fref ref-form ...)
syntax
(fset [ref-form ...] value)
syntax
(fupdate [ref-form ...] update-proc)
These macros define another way to access the structures defined above.
For example
(fref f [glyph 'a] [layer foreground] [contours @ 2] [points @ 3] pos x)
The form (fref g [layer foreground]) is like calling (get-layer g foreground).
The form (fref l [contours @ 2]) gets the third contour of the layer, the @ can be used when the result is a sequence, to refer to a specific element in the sequence.
Setting a value is similar:
(fset [f [glyph 'a] [layer foreground] [contours @ 2] [points @ 3] pos x] 200)
The first part between brackets uses the same conventions seen above, the second part is the new value.
The last form fupdate update a value with a procedure.
(fupdate [f [glyph 'a] [layer foreground] [contours @ 2] [points @ 3] pos x] (lambda (x) (+ x 100)))
The effect, here, is shifting a point rightward.