OpenGLEAN
OpenGLEAN gleanfonts User Support
Home page | Introduction | Documentation | Files | Examples | Proposals | Authors | Links


OpenGLEAN gleanfonts development
Summary | CVS | (discussion via home page) | (contact via home page) | (suggestion box) | License | Todo | Bugs

Bitmapped Fonts
[OpenGLEAN gleanfonts API Reference]

Collaboration diagram for Bitmapped Fonts:


Functions

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

Detailed Description

GLUT's bitmapped fonts are very simple raster data. They may not be scaled or rotated without either image processing them or put them into a texture. They are also simply 0/1 encodings at each pixel, either leaving the pixel unchanged or painting the current color as defined by the OpenGL state machine (using glBitmap()), thus there is no anti-aliasing. However, the simplicity of drawing them allowed relatively efficient and attractive rendering.

At this point in time, it would generally be preferred to use fonts laid out in textures. (But note that some systems may still benefit from the glBitmap() rendering.)

The biggest problem with the bitmapped fonts is that they always render in window coordinates, making them mostly of use for GUI elements or occasionally for "pinned" labels. The bitmapped fonts are of little interest to represent text on a surface or otherwise in a scene.

Of course, we are benefitting from a different perspective. Technology has changed, and OpenGLEAN's role is different than was GLUT's intended role.

The gleanfonts library currently supports only the standard GLUT fonts:

The fonts are:


openglean_bitmap_9by15.png

GLUT_BITMAP_9_BY_15

gleanfonts Terminal (public domain) fixed-width bitmap fonts:

These fonts are fixed-width fonts that are generally suitable for terminal emulators. They are fixed-width (or monospace, if you prefer). They are well suited for extensive user interactive input, especially in multi-line input fields in contexts where alignment between lines may be relavent (e.g., in a programming text editor, or in an email context). Within the bounds of their resolution and fixed-width constraints, they are relatively pleasant to read.


gleanfonts Courier (Adobe) bitmap fonts:

The size value is in the set {8, 10, 12, 14, 18, 24}. "Italic" fonts are slanted, but do not have the usual cursive character of italics.

These are fixed-wdith Courier fonts from Adobe. In that they are fixed-width, they have some similarity to the previous set of fonts. However, they more closely resemble typewriter fonts, having wide serifs and spindly bodies. Especially at lower resolution, they are harder to read than the previous fixed width fonts, but in some contexts, especially if you use one of the larger varieties, can be attractive and useful.


openglean_bitmap_helvetica_18.png

GLUT_BITMAP_HELVETICA_18

gleanfonts Helvetica (Adobe) bitmap fonts:

The size value is in the set {8, 10, 12, 14, 18, 24}. "Italic" fonts are slanted, but do not have the usual cursive character of italics.

These proportionally spaced fonts are sans serif. As with the Courier fonts, Helvetica does not truly come in an italic variety; the "italic" format is merely slanted.

Sans serif fonts can be hard to read for large bodies of text, but can be clean and fairly tight. These fonts may be of interest for short labels in GUIs.

It is a known bug that the Helvetica glyphs seem to lose parts of their graphic images when extracted into gleanfonts. The cause of this is not known.


openglean_bitmap_roman_24.png

GLUT_BITMAP_TIMES_ROMAN_24

gleanfonts Times Roman (Adobe) bitmap fonts:

The size value is in the set {8, 10, 12, 14, 18, 24}.

These proportionately spaced fonts are serifed. They bear a resemblance to typefaces you may see in a newspaper. The font features true italics (not merely slanted) variation.

Because of their proportional spacing, they are inappropriate for many text-editing tasks, but if you are willing to (re)flow paragraphs with them, they tend to be fairly pleasant at the higher resolutions.


gleanfonts Symbol (Adobe) bitmap fonts:

The size value is in the set {8, 10, 12, 14, 18, 24}. No italic/slanted or bold forms are supported.

The symbol set provides numerous special symbols not provided in the normal ISO-8859-1 character set. Those Greek letters that do not correspond to Latin letters (especially an issue for lower case letters) are particular examples.

The symbol set is stylistically closest to Times Roman, but some parts have a more Helvetica feel. Aside from printing Greek messages, the symbol set is probably most useful for mathematics and formal logic.


Excepting the "terminal" fonts, these fonts are of limited interest in their lower resolutions, but if you wish to "zoom out" on text, the glyphs are still minimally legible even at a size of 8.

The fonts are extracted from an open-source X server, and generally cover ISO-8859-1, with printable values in the ranges 32--126 and 160--255. Additionally, the fixed-width fonts have non-standard glyphs in the range 1 through 31. The "symbol" font uses a special character set and follows no standard but its own.

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 GLUTfont  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 OpenGLEAN 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 GLUTfont  font  ) 
 

Return the height of a given bitmapped 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()
Todo:
We have discussed adding a "font descender" query. We should go ahead and do it.

int glutBitmapLength GLUTfont  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 GLUTfont  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 OpenGLEAN bitmap font
  • string is an empty string or NULL pointer
  • The current OpenGL raster position is invalid

See also:
glRasterPos(), glutBitmapCharacter()

int glutBitmapWidth GLUTfont  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,Quantity] or if the font is invalid. (Here, Quantity is the number of characters in the font.)

Note:
In GLUT, some glyphs could render to the left of the starting position, in some fonts. OpenGLEAN'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()




SourceForge.net Logo Supported in part by SourceForge.net.

Generated on Sun Sep 18 12:47:36 2005 for gleanfonts by doxygen 1.4.3
The OpenGLEAN Fonts project is hosted by SourceForge.