The following points summarise the essential elements of a shape definition in a SHP file:
;
) and the end of line.0
.*shapenumber,defbytes,shapename
specbyte1,specbyte2,specbyte3,...,0
Name | Description |
---|---|
shapenumber | A unique number between 1 and 258 for ordinary font files and 1 to 32768 for Unicode fonts. The asterisk symbolises the beginning of a shape. For non-Unicode fonts, the numbers 256-258 contain the symbols for degree signs (° ), plus-minus (± ) and the diameter symbol (⌀ ). Contrary to the Unicode precedence, the diameter symbol is not located on U+2230 but on U+2205. The two symbols look similar. |
defbytes | This number indicates the number of bytes (specbytes) for this shape including the zero byte. (Maximum 2000) |
shapename | The name of the shape. Names for shapes must be written in capital letters, otherwise they are ignored. Names for letters in fonts, on the other hand, are written in lower case. |
specbyte | Each byte describes either a vector or a series of commands. A byte can be specified in decimal or hexadecimal.If the number begins with a 0, then the two following numbers are hexadecimal. Otherwise decimal. |
Font files must first have a special entry. The 0-shape with the font definition. This looks like this:
*0,4,font-name
above,below,mode,0
Font metadata for "normal" font files
Name | Description |
---|---|
0 | The shape number (see above). |
4 | The number of specbytes (see above). |
font-name | The name of the font. |
above | Number of vector lengths that uppercase letters extend above the baseline. |
below | Number of vector lengths that lowercase letters such as y or g extend below the baseline. |
mode | The mode of the font file: 0 , if the font can be set purely horizontally. 2 , if the font can be set vertically and horizontally. |
For Unicode font files, the first entry in the font file looks slightly different:
*UNIFONT,6,font-name
above,below,mode,encoding,type,0
Font metadata for Unicode font files:
Name | Description |
---|---|
*UNIFONT |
This should actually be the shape number. The literal indicates a Unicode font. |
6 | The number of specbytes (see above). |
font-name | The name of the font. |
above | Number of vector lengths that uppercase letters extend above the baseline. |
below | Number of vector lengths that lowercase letters such as y or g extend below the baseline. |
mode | The mode of the font file: 0 , if the font can be set purely horizontally. 2 , if the font can be set vertically and horizontally. |
encoding | The font encoding of the source file. (0 : Unicode, 1 : Packed multibyte, 2 : Shape file) |
type | The type of font licensing. (0 : Font may be embedded, 1 : Font may not be embedded, 2 : Embedded fonts may only be read). |