OpenGLUT 0.6.3 development - OpenGLUT: Text Rendering - Bitmapped Fonts
Keywords: OpenGLUT, FreeGLUT, OpenGL, GLUT, X11, Windows, Programming, Documentation, Download, Development, Sourceforge

OpenGLUT Documentation
Introduction | Documentation | Examples | Proposals | Authors | Copying | Todo | Bugs | Links

# Text Rendering - Bitmapped Fonts
[OpenGLUT API Reference]

## Functions
void | glutBitmapCharacter (void *font, int character)
int | glutBitmapHeight (void *font)
int | glutBitmapLength (void *font, const unsigned char *string)
void | glutBitmapString (void *font, const unsigned char *string)
int | glutBitmapWidth (void *font, int character)

## Detailed Description

OpenGLUT fixed-width bitmap fonts:

- GLUT_BITMAP_9_BY_15
- GLUT_BITMAP_8_BY_13

OpenGLUT variable width bitmap fonts:

- GLUT_BITMAP_HELVETICA_18
- GLUT_BITMAP_HELVETICA_12
- GLUT_BITMAP_HELVETICA_10
- GLUT_BITMAP_TIMES_ROMAN_24
- GLUT_BITMAP_TIMES_ROMAN_10

The fonts are extracted from an open-source X server, and cover ISO-8859-1, with printable values in the ranges 32--126 and 160--255. Additionally, the fixed-width fonts have additional glyphs in the range 1 through 31.

The heights of the fonts are not generally encoded in their names, though the names give some indication of the heights. For example, the 8x13 fixed-width font is 14 pixels tall. The fixed width fonts have their widths embedded in their names: GLUT_BITMAP_8_BY_13 and GLUT_BITMAP_9_BY_15 .

## Function Documentation

void glutBitmapCharacter | ( | void * | font,
|  | int | character
| ) |

  | Draw a bitmapped character. Parameters:
  | font | A bitmapped font identifier.
  | character | A character code.
Draw a character at the current OpenGL raster position using a bitmapped font. The raster position is advanced by the width of the character. Nothing is drawn, and the raster position is unaffected when either: character is out of range font is not a valid OpenGLUT bitmap font The current OpenGL raster position is invalid Note: glutBitmapString() is generally more efficient for strings of characters. See also: glRasterPos(), glutBitmapString(), glutBitmapWidth(), glutBitmapHeight(), glutStrokeCharacter()

int glutBitmapHeight | ( | void * | font | ) |

  | Return the height of a given font, in pixels. Parameters:
  | font | A bitmapped font identifier.
Return the line-to-line vertical spacing (in pixels) between lines of a bitmapped font. Returns 0 if font is invalid. Note: Does not report the height used by individual characters. This may limit its usefulness. (Compare with other font-metric queries.) See also: glutBitmapCharacter(), glutBitmapString(), glutBitmapWidth(), glutBitmapLength(), glutStrokeHeight()

int glutBitmapLength | ( | void * | font,
|  | const unsigned char * | string
| ) |

  | Return the width of a bitmapped string, in pixels. Parameters:
  | font | A bitmapped font identifier.
  | string | A NUL-terminated ASCII string.
Returns the maximum horizontal OpenGL raster position offset for a string in a bitmapped font. As with glutBitmapString(), newlines are taken into consideration. Returns 0 if the font is invalid or if the string is empty or NULL. See also: glutBitmapString(), glutBitmapWidth(), glutBitmapHeight(), glutStrokeLength()

void glutBitmapString | ( | void * | font,
|  | const unsigned char * | string
| ) |

  | Draw a string of bitmapped characters. Parameters:
  | font | A bitmapped font identifier.
  | string | A NUL-terminated ASCII string.
Draw a string the current OpenGL raster position using a bitmapped font. The raster position is advanced by the width of the string. The starting raster position is used as the left margin for multi-line strings. Each newline character repositions the raster position at the beginning of the next line. Nothing is drawn, and the raster position is unaffected when either: font is not a valid OpenGLUT bitmap font string is an empty string or NULL pointer The current OpenGL raster position is invalid See also: glRasterPos(), glutBitmapCharacter()

int glutBitmapWidth | ( | void * | font,
|  | int | character
| ) |

  | Return the width of a bitmapped character, in pixels. Parameters:
  | font | A bitmapped font identifier.
  | character | A character code.
Returns the horizontal OpenGL raster position offset for a character in a bitmapped font. It is also an upper bound on the width of the bitmapped glyph for character, though not all letters will use their full width, especially fixed-width fonts. Returns 0 if the character is out of the inclusive range [0,255] or if the font is invalid. Note: In GLUT, some glyphs could render to the left of the starting position, in some fonts. OpenGLUT's fonts all position all of their glyphs to start at, or to the right of, the initial position. See also: glutBitmapCharacter(), glutBitmapLength(), glutBitmapHeight(), glutStrokeWidth()

OpenGLUT Development @ Sourceforge
Homepage | Summary | Files | CVS | Forums | Lists | Bugs | RFE
Generated on Tue Oct 5 18:44:33 2004 for OpenGLUT by doxygen 1.3.8
The OpenGLUT project is hosted by sourceforge.net.