[ Previous | Next | Contents | Glossary | Home | Search ]
GL3.2 for AIX: Graphics Library (GL) Technical Reference

defrasterfont Subroutine

Purpose

Defines bitmaps for a raster font.

Libraries

Graphics Library

C (libgl.a)

FORTRAN (libfgl.a)

C Syntax

void defrasterfont
(Int32 index, Int16 height, 
Int16 numchars, Fontchar chars [ ], 
Int16 numraster, Int16 raster [ ])

FORTRAN Syntax

SUBROUTINE DEFRAS(index, height, numchars, chars, numraster, raster)

INTEGER *4 index, height, numchars, numraster

INTEGER*2 raster(numraster), chars(4*numchars)

Note: For FORTRAN users, this subroutine accepts long integer parameters (INTEGER*4) when invoked from a FORTRAN program, although it accepts short integers when invoked from a C program. The C and FORTRAN syntax shown here reflect this difference.

Description

The defrasterfont subroutine defines a raster font.

To replace a raster font, specify the index of the previous font as the index for the new font. To delete a raster font, define a font with no characters. Patterns, linestyles, cursors, and fonts are available to all windows when using multiple windows. The assumed code set table encoding is locale dependent. In most locales, this is an ISO8859 encoding.

Notes:
  1. This subroutine cannot be used to add to a display list.
  2. The hardest part of creating a new raster font is generating a bitmap for each character. You may want to write a graphically oriented tool for creating the bitmaps expected by the raster parameter.

Parameters

index Specifies a constant to use as the identifier for this raster font. This constant is used as an index into a font table. The default font, 0, is a fixed-pitch font with a height of 16 and width of 9. Font 0 cannot be redefined.
height Specifies the maximum height (in pixels) for a character.
numchars Specifies the number of characters in this font.
chars Specifies an array of character description structures of type Fontchar. The Fontchar structure is defined in the /usr/include/gl/gl.h file as:
typedef struct {
  unsigned short offset;
    Byte w, h;
    signed char xoff, yoff;
    short width;
} Fontchar;

The character description structures are as follows:

offset Specifies the element of the raster array at which the bitmap for this character starts.
w Specifies the number of columns in the bitmap that contain set bits (character width).
h Specifies the number of rows in the bitmap of the character (including ascender and descender).
xoff Specifies the bitmap columns between the start of the character's bitmap and the start of the character.
yoff Specifies the number of rows between the character's baseline and the bottom of the bitmap. For characters with descenders (for example, g) this value is a negative number. For characters that rest entirely on the baseline, this value is zero.
width Specifies the pixel width for the character. This value tells the system how far to space after drawing the character. (This value is added to the character position.)
numraster Specifies the length of the raster parameter array.
raster Specifies a one-dimensional array that contains all the bitmaps for the characters in the font. Each element of the array is a 16-bit integer and the elements are ordered left to right, bottom to top. When interpreting each element, the bits are left justified within the character's bounding box.

Maximum row width for a single bitmap is not limited to the capacity of a single 16-bit integer array element. The rows of a bitmap may span more than one array element. However, each new row in the character bitmap must start with its own array element. Likewise, each new character bitmap must start with its own array element. The system reads the row width and starting location for a character bitmap from the structures records in the chars array.

Example

The example C language programs curved.c and font3.c use the defrasterfont subroutine to define a new raster font.

Implementation Specifics

This subroutine is part of GL in the AIXwindows Environment/6000 Version 1, Release 2 with AIXwindows/3D Feature.

This subroutine is not available for National Language Support.

Files

/usr/include/gl/gl.h Contains C language constant and variable type definitions for GL.
/usr/include/gl/fgl.h Contains FORTRAN constant and variable type definitions for GL.

Related Information

Drawing a string of raster characters on the screen with the charstr subroutine.

Updating the current character position with the cmov subroutine.

Selecting a raster font with the font subroutine.

Returning the current character position with the getcpos subroutine.

Returning the baseline extent of the longest character descender with the getdescender subroutine.

Returning the current raster font number with the getfont subroutine.

Returning the maximum character height in the current raster font with the getheight subroutine.

Using an AIXwindows font to define a raster font with the loadXfont subroutine.

Returning the width of the specified text string with the strwidth subroutine.

National Language Support Overview in AIX General Programming Concepts: Writing and Debugging Programs.

Creating Text Characters.


[ Previous | Next | Contents | Glossary | Home | Search ]