[xgap] 6.5 Global Information

[Up] [Previous] [Next] [Index]

# 6.5 Global Information

There are some global data structures which can and should be consulted if certain information is needed. The first (about color handling) was already described in section Color Models. The second is for vertices:

- `VERTEX V`

  This globally bound record contains the following components:

  `circle`
    integer value for the vertex type ``circle''

  `diamond`
    integer value for the vertex type ``diamond''

  `rectangle`
    integer value for the vertex type ``rectangle''

  `radius`
    radius in pixels of a vertex on the screen

  `diameter`
    diameter in pixels of a vertex on the screen

  The third structure is about the available fonts.

- `FONTS V`

  This globally bound record has the following components: `tiny`, `small`, `normal`, `large`, `huge` and `fonts`. The first 5 are itself records each for one available font. They have components `name` for the name of the font and `fontInfo`, which is a list of 3 integers. The first is the maximal size of a character above the baseline in pixels, the second is the maximal size of a character below the baseline in pixels, and the third is the width in pixels of all characters, because it is always assumed, that the fonts are non-proportional.

- `FontInfo(` font`) O`

  Returns the information about the font font. The result is a triple of integers. The first number is the maximal size of a character above the baseline in pixels, the second is the maximal size of a character below the baseline in pixels, and the third is the width in pixels of all characters, because it is always assumed, that the fonts are non-proportional. Use this function rather than accessing the component `fontInfo` of a font object directly!

  There is another global structure:

- `BUTTONS V`

  This record contains the following components: `left` and `right` contain a number for the left resp. right mouse button. `shift` and `ctrl` contain codes for the respective keys on the keyboard.

  You should always use these global data instead of hardwiring any integers into your code.

  [Up] [Previous] [Next] [Index]