Graphic Devices, Modes, and Fonts

Selecting the Graphic Device

Experimental programs that use graphic functions need to know something about the hardware they are running on. This includes the resolution of the graphic mode, the size and type of the display and for precise intensity control the luminance output. This information is specified by experimental variables.

The variable videomode tells a PXL program what type of graphic controller and which of the available modes should be used. Table vmodes contains a list of the possible videomode numbers. Note, however, that depending on the implementation and version not all numbers are possible in each version.

Insert Table vmodes here.

The variable videomode will usually be set in the startup file startup.pxl, since the display device is a system wide parameter, useful for each program. Some programs, however, may need special modes and thus choose to set videomode themselves. It may also be set in the parameter file or in the command line using option v. The default mode for any program is one that fits most demands.

Hardware Dependencies

The current PC version of PXL uses a proprietary VGA graphics library which has been optimized for speed and efficienty with those primitives which are most common in psychological experiments. If drawing speed is a critical factor then low resolution 256 color modes are to be preferred. In order to activate the SVGA special modes the library has to know some hardware dependent features of the available SVGA adaptor. This information is hard to get and tends to become outdated rather fast. The test program vmode.exe (Chapt. demos) may be used to find out whether PXL is able to identify a SVGA adaptor correctly. If this is not the case then the SVGA adaptor's VESA driver should be installed before running the PXL program. In this case PXL will detect the VESA driver and use its functionality for all the hardware dependent features.

Display Size

Experiments that use graphic displays need to know the metric size of the display. PXL includes software for drawing on a metric coordinate plane. Its basic unit is 1 pxlm. The actual size of this unit is defined by the experimental variables screenwidth and screenheight. These variables contain the width and height of the display screen area as measured in pxlm. So suppose one wants to follow the suggested convention of setting one pxlm equal to one tenth of a millimeter and the screen's display area width is 22.6 cm and its height is 15.2 cm. Then one would set
   screenwidth = 2260
   screenheight = 1520
in the file startup.pxl. Thus any program that reads this startup file would treat the display area as being 2260 pxlm wide and 1560 pxlm high. This also means that if the program uses other experimental variables that contain size parameters of screen objects, these have to be specified using the same units.

If a program uses a special mode of the graphic device then the size of the displayable area may change. In this case the parameter file may be used to set correct values for screensize and screenwidth. There is a demo application program called scrnsize (see Chapter demos) that may be used to find out what the correct size parameters are and modify startup.pxl accordingly.


PXL may use different types of fonts for drawing text on the screen. The most flexible type are Hershey vector fonts (Hershey, 1972) whose names are given in Table fontab. These fonts are coded by relative vectors so it is possible to apply geometric transformations to them. The graphic demo application hfonts.exe shows samples of all available vector fonts. The most serious disadvantage of the vector fonts is that their strokes are only a single pixel wide. This makes them rather thin in most resolutions. The vector font codes are contained in files which have the names given in Table fontab as font names and have extension chr. These files are compatible with font files from the Borland Graphics Interface (BGI) and the public domain Borland Font Editor FE may be used to edit these files. This feature has been used to create special symbols or even masking characters for experimental applications.

Insert Table fontab here.

If the only transformation to be applied is size scaling then one may also use screen raster fonts. For small raster font sizes PXL uses the graphics device's built in screen font. For larger raster font sizes PXL may use any raster font generated by D. Knuth's Metafont program (Knuth, 1991b) and coded as a PK-file. The PXL standard distribution currently contains a single sans serif font from Knuth's Computer Modernfamily of typefaces (Knuth, 1987), named dcss10 from 10 mm up to about 3 cm in size.

Insert Figure rfonts here.

Application programs select fonts by their names and their size. Most aplications will use the experimental parameters msgfont for message text and textfont for text stimuli and msgsize and textsize for the respective sizes. The available font names are given in Table fontab. The name scrn selects a raster font. The raster font actually used is defined by the parameter rasterfont. Its default value is dcss10 which selects a sans serif font. dcr10 selects a roman font (available, but not contained in the standard distribution package). If the font size requested is less than the smallest available raster font size then the device's built in screen raster font is selected. Thus setting textfont and msgfont to "scrn" and setting the respective font size parameters textsize and msgsize to 1 selects the device's built in screen font. In this case the program will not need any external font file. This setting is the library default also.

PXL can use any TeX-Font as its raster font. Simply give rasterfont the name of the font file and make sure that it is accessible by the program. The vector font files are located in subdirectory \pxl\etc . Their file extension is chr. The raster font files are located in a subdirectory of directory \pxl\texfonts . The subdirectory name is the name of the font and the single files are named according to the resolution. Thus as an example the full names \pxl\texfonts\dcss10\ and \pxl\texfonts\dcss10\ access the smallest and the largest dcss10 raster font files of the PXL standard distribution package. These have been created for a 200 and a 3024 dpi resolution device respectively. You can use Donald Knuth's \sf Metafont program (Knuth, 1985) for creating any new raster font sizes.

Installation of a different set of raster font files is easy. The fonts should be created for a 200 dpi device, since PXL uses this device resolution to compute the font name from the textsize and msgsize parameter. The font files should be copied into a subdirectory of \pxl\texfonts whose name is the new font name. This name must be given by the parameter rasterfont. Thus if the new font name is dcrm10 then set

   rasterfont = dcrm10
The single font files in directory \pxl\texfonts\dcrm10 should then be named, ...acording to their size.

Back to table of contents

Author: Hans Irtel