Purpose
Opcode format | Opcode | Operand Format | Comments |
Extended ASCII | (Glyph | <ws><IIndex><ws><IX>,<IY><ws><Iunit><ws>(<Rdefinition1>)) | Assigns a sequence of opcodes to a marker glyph index |
Extended Binary | 0x0003 | <USindex><LX><LY><ULUnit><Rdefinition2>} | Assigns a sequence of opcodes to a marker glyph index. |
X,Y The logical coordinate origin of the glyph being defined
Unit A logical coordinate distance indicating the unit size of the glyph
Definition1 A nested series of readable ASCII opcodes to be stored (rather than rendered) at the position indicated by the index argument in the marker glyph table
Definition2 A nested series of opcodes to be stored (rather than rendered) at the position indicated by the index argument in the marker glyph table
Figure 1. Glif definition
When recording the geometric primitives for a glyph, an arbitrary set of logical coordinates is used. Later when a glyph is drawn with Draw Polymarker, these arbitrary coordinates are related to specific coordinates by the Origin and Unit arguments. In this example, a star shape is "recorded" at index 12 in the glyph table, centered about the arbitrary vertex (300,300), and given a unit size of 100 logical units:
L 300,250 300,350 (Comment Vertical line)
L 250,250 350,350 (Comment right angled line)
L 350,250 250,350 (Comment left angled line)
The definition of a glyph may include any sequence of geometric primitives (Draw opcodes) and/or attributes (Set opcodes). For many glyphs, as in the star example, no attributes are stored, only geometric primitives, so that the attributes active at the time Draw Polymarker is executed will be used. In this example, you can draw a red and a blue star with the following:
S 30 (Comment We’ll draw stars that are 30 logical units high,
M 1 500,400 (Comment Draw one red star centered at 500,400.)
(Color 0,0,255,255) (Comment Get ready to draw in blue.)
M 1 600,700 (Comment Draw one blue star centered at 600,700.)
L 25,30 35,30 (Comment Red Horizontal line.)
(Color 0,0,255,255) (Comment Select blue.)
L 30,25 30,35 (Comment Blue Vertical line.)
(Color 0,255,0,255) (Comment Get ready to draw in green.)
M 1 500,400 (Comment Draw a red and blue plus-sign.)
L 250,250 350,350 (Comment A *green* diagonal line.)
For many glyphs, as in the previous star example, origin is centered inside the glyph’s bounding box and unit is the width or height of the bounding box. However, for some glyphs this will not be the desired arrangement. For example, the characters of a font could be encoded as a set of glyphs (one for each character) containing polygon opcodes. In this case, unit would be set to the height of the of the tallest character in the font, rather than the height of each character being defined, and origin would be positioned at each character’s insertion point, as shown in figure 2.
Figure 2. Font characters encoded as glyphs
By convention, if the extended ASCII version of the Define Marker Glyph opcode, "(Glyph", is used, then all opcodes contained in Definition should also be ASCII opcodes (either single-byte or extended) so that WHIP! data reading applications may safely skip the Define Marker Glyph operation. When Definition contains binary data, the extended binary version of Define Marker Glyph (opcode 0X0003 in hex) should be used.
0 | Single Pixel |
1 | Plus |
2 | X |
3 | Star |
4 | Hollow Circle |
5 | Filled Circle |