j3d.org Code

org.j3d.geom
Class CharacterCreator

java.lang.Object
  extended by org.j3d.geom.CharacterCreator

public class CharacterCreator
extends java.lang.Object

Representation of font information needed to create polygonal text.

This class serves as a common representation of font information and as a cache for creating individual character polygonal information for a specific font. The role of this class is to create a set of polygonal representations of individual characters, which are then expressed as instances of CharacterData. It does not perform any placement of those characters in any spatial position. That is a requirement of the caller to perform the correct relative placement of characters.

Characters are generated in the AWT coordinate system. That means that text is invariably drawn upside down in the Y axis. Before using the text, you may need to perform a negative scale about the Y axis.

Note: Because this class works at the individual character level, it doesn't render very well fonts that need to be connected per-character such as arabic etc.

Version:
$Revision: 1.11 $
Author:
Justin Couch

Constructor Summary
CharacterCreator(java.awt.Font font, double flatness)
          Create a new fontstyle object representing the given font.
 
Method Summary
 void createCharacterTriangles(char[] characters, int numChars, java.util.ArrayList output)
          From the provided font, generate the output triangles now.
 double getFlatness()
          Get the flatness value used to create the internal glyphs.
 java.awt.Font getFont()
          Get the Java 2D Font used to create this FontStyle object.
 java.awt.font.FontRenderContext getFontRenderContext()
          Get the Java 2D FontRenderContext used to create this FontStyle object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CharacterCreator

public CharacterCreator(java.awt.Font font,
                        double flatness)
Create a new fontstyle object representing the given font.

Parameters:
font - The font object to use
flatness - How closely the points should resemble the defined outlines for the font
Method Detail

getFont

public java.awt.Font getFont()
Get the Java 2D Font used to create this FontStyle object.

Returns:
The Font object used to render this text

getFontRenderContext

public java.awt.font.FontRenderContext getFontRenderContext()
Get the Java 2D FontRenderContext used to create this FontStyle object.

Returns:
The Font object used to render this text

getFlatness

public double getFlatness()
Get the flatness value used to create the internal glyphs.

Returns:
A value greater than zero

createCharacterTriangles

public void createCharacterTriangles(char[] characters,
                                     int numChars,
                                     java.util.ArrayList output)
From the provided font, generate the output triangles now.

Parameters:
characters - The string of characters to append to the list
numChars - The number of valid characters in the array
output - A place to put each of the character arrays

j3d.org Code

Latest Info from http://code.j3d.org/
Copyright © 2001 - j3d.org