cz.cuni.jagrlib.iface
Interface TextRender

All Superinterfaces:
Property, Render
All Known Implementing Classes:
JavaText

public interface TextRender
extends Render

Rendering interface for text output.

Since:
0.02
See Also:
TextRender.java

Nested Class Summary
static class TextRender.TextExtent
          Support class for holding text extents.
 
Field Summary
static int ANTI_DEPEND
          Antialiasing mode value: depends on output module color format.
static java.lang.String ANTI_MODE
          Property name: antialiasing mode.
static int ANTI_OFF
          Antialiasing mode value: force antialiasing off (even in RGBA output mode).
static int ANTI_ON
          Antialiasing mode value: force antialiasing on (even in RGB/Gray/.. output mode).
static int CREATE_APPROX
          The asked font was approximated.
static int CREATE_EXACT
          The asked font was created exactly.
static int CREATE_FAIL
          Font creation process has failed .. no font has been created.
static int FONT_BOLD
          Bold (heavy) font.
static int FONT_DECORATIVE
          Decorative font.
static int FONT_ICON
          Icon font (wingdings etc.).
static int FONT_ITALIC
          Italic (slanted) font.
static int FONT_MONOSPACED
          Monospaced (non-proportional) font.
static int FONT_SCRIPT
          Manuscript font.
static int FONT_SERIF
          Font with serifs.
static int FONT_UNDERLINE
          Underlined font.
static int MAX_SLOT
          Maximal number of font slots (excluding slot A).
static int PROP_BITMAP
          Font is not able to generate paths (bitmap, non-scalable font).
static int PROP_FILL
          Font path can be filled (filled font).
static int PROP_MONOSPACED
          Font is monospaced (non-proportional).
static int PROP_STROKE
          Font path can be stroked (stroked font).
 
Fields inherited from interface cz.cuni.jagrlib.iface.Render
LINE_CAP, LINE_CAP_BUTT, LINE_CAP_ROUND, LINE_CAP_SQUARE, LINE_JOIN, LINE_JOIN_BEVEL, LINE_JOIN_DISJOINT, LINE_JOIN_MITER, LINE_JOIN_OVERLAP, LINE_JOIN_ROUND, LINE_WIDTH, PROJECTION, RENDER_STYLE, RENDER_STYLE_FLAT, RENDER_STYLE_GOURAUD, RENDER_STYLE_LINE, RENDER_STYLE_PHONG, RENDER_STYLE_TEXTURE
 
Fields inherited from interface cz.cuni.jagrlib.iface.Property
LOGGING, STATISTICS, TEXT_DESCRIPTION
 
Method Summary
 int createFont(java.lang.String name, int style, double size)
          Creates a new font and places it in slot A (actual, working font).
 void drawText(double x0, double y0, java.lang.String text, TextRender.TextExtent ext)
          Draws the given text.
 double fontOrientation(double angle)
          Changes the actual font's orientation.
 int fontProperties()
          Returns properties (flags) of the actual font (slot A).
 void getFont(int slot)
          Assigns the actual font (slot A) from the given slot.
 TextRender.TextExtent getKern(char c1, char c2, TextRender.TextExtent ext)
          Returns the kerning (space correction) which should be used between two given characters.
 void putFont(int slot)
          Puts the actual font (slot A) into the given slot.
 TextRender.TextExtent textExtent(double x0, double y0, java.lang.String text, TextRender.TextExtent ext)
          Computes the extent of the given text string (without any output change).
 void textPath(java.lang.String text)
          Generates path of the given text string and appends it to the current path.
 
Methods inherited from interface cz.cuni.jagrlib.iface.Property
commit, get, set
 

Field Detail

FONT_BOLD

static final int FONT_BOLD
Bold (heavy) font.

See Also:
Constant Field Values

FONT_ITALIC

static final int FONT_ITALIC
Italic (slanted) font.

See Also:
Constant Field Values

FONT_UNDERLINE

static final int FONT_UNDERLINE
Underlined font.

See Also:
Constant Field Values

FONT_SERIF

static final int FONT_SERIF
Font with serifs.

See Also:
Constant Field Values

FONT_SCRIPT

static final int FONT_SCRIPT
Manuscript font.

See Also:
Constant Field Values

FONT_DECORATIVE

static final int FONT_DECORATIVE
Decorative font.

See Also:
Constant Field Values

FONT_ICON

static final int FONT_ICON
Icon font (wingdings etc.).

See Also:
Constant Field Values

FONT_MONOSPACED

static final int FONT_MONOSPACED
Monospaced (non-proportional) font.

See Also:
Constant Field Values

CREATE_EXACT

static final int CREATE_EXACT
The asked font was created exactly.

See Also:
Constant Field Values

CREATE_APPROX

static final int CREATE_APPROX
The asked font was approximated.

See Also:
Constant Field Values

CREATE_FAIL

static final int CREATE_FAIL
Font creation process has failed .. no font has been created.

See Also:
Constant Field Values

MAX_SLOT

static final int MAX_SLOT
Maximal number of font slots (excluding slot A). Slots are numbered from 0 to MAX_SLOT-1.

See Also:
Constant Field Values

PROP_STROKE

static final int PROP_STROKE
Font path can be stroked (stroked font).

See Also:
Constant Field Values

PROP_FILL

static final int PROP_FILL
Font path can be filled (filled font).

See Also:
Constant Field Values

PROP_BITMAP

static final int PROP_BITMAP
Font is not able to generate paths (bitmap, non-scalable font).

See Also:
Constant Field Values

PROP_MONOSPACED

static final int PROP_MONOSPACED
Font is monospaced (non-proportional).

See Also:
Constant Field Values

ANTI_MODE

static final java.lang.String ANTI_MODE
Property name: antialiasing mode.

See Also:
Constant Field Values

ANTI_DEPEND

static final int ANTI_DEPEND
Antialiasing mode value: depends on output module color format.

See Also:
Constant Field Values

ANTI_OFF

static final int ANTI_OFF
Antialiasing mode value: force antialiasing off (even in RGBA output mode).

See Also:
Constant Field Values

ANTI_ON

static final int ANTI_ON
Antialiasing mode value: force antialiasing on (even in RGB/Gray/.. output mode).

See Also:
Constant Field Values
Method Detail

createFont

int createFont(java.lang.String name,
               int style,
               double size)
Creates a new font and places it in slot A (actual, working font).

Parameters:
name - Font name.
style - Font style - used if exact font match was not successful (bitwise OR of TextRender.FONT_* constants).
size - Font size (distance between two regularly spaced text lines).
Returns:
Result code (one of TextRender.CREATE_* constants).
See Also:
FONT_BOLD, CREATE_EXACT, VCommand.CreateFont

fontOrientation

double fontOrientation(double angle)
Changes the actual font's orientation.

Parameters:
angle - New font orientation (in degrees, counterclockwise).
Returns:
The old orientation.
See Also:
VCommand.FontOrientation

getFont

void getFont(int slot)
Assigns the actual font (slot A) from the given slot.

Parameters:
slot - Slot number (between 0 and MAX_SLOT-1).
See Also:
MAX_SLOT, VCommand.GetFont

putFont

void putFont(int slot)
Puts the actual font (slot A) into the given slot.

Parameters:
slot - Slot number (between 0 and MAX_SLOT-1).
See Also:
MAX_SLOT, VCommand.PutFont

fontProperties

int fontProperties()
Returns properties (flags) of the actual font (slot A).

Returns:
Bitwise OR of PROP_* constants.
See Also:
PROP_STROKE

textPath

void textPath(java.lang.String text)
Generates path of the given text string and appends it to the current path. Uses the current point as starting reference point (current point itself will be updated by this command).

Does nothing if the actual font has neither PROP_STROKE nor PROP_FILL capability.

Parameters:
text - The string to be drawn.
See Also:
textExtent(double, double, java.lang.String, cz.cuni.jagrlib.iface.TextRender.TextExtent), drawText(double, double, java.lang.String, cz.cuni.jagrlib.iface.TextRender.TextExtent), VCommand.MoveTo, VectorGraphics.moveTo(double, double), VCommand.TextPath

drawText

void drawText(double x0,
              double y0,
              java.lang.String text,
              TextRender.TextExtent ext)
Draws the given text. Starting reference point is explicitly specified. If ext parameter is not null, the routine fills the given TextExtent object.

Works with both vector and bitmap fonts.

Parameters:
x0 - X coordinate of the starting reference point.
y0 - Y coordinate of the starting reference point.
text - The string to be drawn.
ext - The TextExtent object to be filled (or null).
See Also:
TextRender.TextExtent, textExtent(double, double, java.lang.String, cz.cuni.jagrlib.iface.TextRender.TextExtent), VCommand.DrawText

textExtent

TextRender.TextExtent textExtent(double x0,
                                 double y0,
                                 java.lang.String text,
                                 TextRender.TextExtent ext)
Computes the extent of the given text string (without any output change).

Parameters:
x0 - X coordinate of the starting reference point.
y0 - Y coordinate of the starting reference point.
text - The string to be drawn.
ext - The TextExtent object to be filled (or null).
Returns:
The filled TextExtent object.
See Also:
TextRender.TextExtent, drawText(double, double, java.lang.String, cz.cuni.jagrlib.iface.TextRender.TextExtent)

getKern

TextRender.TextExtent getKern(char c1,
                              char c2,
                              TextRender.TextExtent ext)
Returns the kerning (space correction) which should be used between two given characters.

Parameters:
c1 - First character.
c2 - Second character.
ext - The TextExtent object to be filled (or null).
Returns:
The filled TextExtent object (only dx and dy are used).
See Also:
TextRender.TextExtent, textExtent(double, double, java.lang.String, cz.cuni.jagrlib.iface.TextRender.TextExtent)