uk.ac.starlink.ttools.plot2
Class LatexCaptioner

java.lang.Object
  extended by uk.ac.starlink.ttools.plot2.LatexCaptioner
All Implemented Interfaces:
Captioner

public class LatexCaptioner
extends Object
implements Captioner

Captioner implementation based on LaTeX text rendering. The hard work is done by the rather wonderful jLaTeXMath.

Since:
12 Feb 2013
Author:
Mark Taylor

Field Summary
static float DEFAULT_SIZE
           
static int STYLE_DISPLAY
           
static int STYLE_SCRIPT
           
static int STYLE_SCRIPT_SCRIPT
           
static int STYLE_TEXT
           
static int TYPE_BOLD
           
static int TYPE_ITALIC
           
static int TYPE_ROMAN
           
static int TYPE_SANSSERIF
           
static int TYPE_SERIF
           
static int TYPE_TYPEWRITER
           
 
Constructor Summary
LatexCaptioner()
          Constructs a captioner with a default font.
LatexCaptioner(float size)
          Constructs a captioner with the default font in a given size.
LatexCaptioner(float size, int type)
          Constructs a captioner with a given font size and type.
LatexCaptioner(float size, int type, int style)
          Constructs a captioner with a given font size, type and style
 
Method Summary
 void drawCaption(String label, Graphics g)
          Draws a caption such that the left end of the text baseline is at the origin of the supplied graphics context.
 boolean equals(Object o)
           
 Rectangle getCaptionBounds(String label)
          Returns a bounding box for the caption drawn by a corresponding call to Captioner.drawCaption(java.lang.String, java.awt.Graphics).
 int getPad()
          Returns a suitable padding value for separating captions from the reference position or other graphical elements.
 int hashCode()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_SIZE

public static final float DEFAULT_SIZE
See Also:
Constant Field Values

STYLE_TEXT

public static final int STYLE_TEXT
See Also:
Constant Field Values

STYLE_DISPLAY

public static final int STYLE_DISPLAY
See Also:
Constant Field Values

STYLE_SCRIPT

public static final int STYLE_SCRIPT
See Also:
Constant Field Values

STYLE_SCRIPT_SCRIPT

public static final int STYLE_SCRIPT_SCRIPT
See Also:
Constant Field Values

TYPE_SERIF

public static final int TYPE_SERIF
See Also:
Constant Field Values

TYPE_SANSSERIF

public static final int TYPE_SANSSERIF
See Also:
Constant Field Values

TYPE_BOLD

public static final int TYPE_BOLD
See Also:
Constant Field Values

TYPE_ITALIC

public static final int TYPE_ITALIC
See Also:
Constant Field Values

TYPE_ROMAN

public static final int TYPE_ROMAN
See Also:
Constant Field Values

TYPE_TYPEWRITER

public static final int TYPE_TYPEWRITER
See Also:
Constant Field Values
Constructor Detail

LatexCaptioner

public LatexCaptioner()
Constructs a captioner with a default font.


LatexCaptioner

public LatexCaptioner(float size)
Constructs a captioner with the default font in a given size.

Parameters:
size - font size

LatexCaptioner

public LatexCaptioner(float size,
                      int type)
Constructs a captioner with a given font size and type. Font type is as per the jlatexmath.TeXFormula constants

Parameters:
size - font size
type - font type; to some extent these can be ORed together

LatexCaptioner

public LatexCaptioner(float size,
                      int type,
                      int style)
Constructs a captioner with a given font size, type and style

Parameters:
size - font size
type - font type, one of the TYPE_* constants; to some extent these can be ORed together
style - TeX presentation style, one of the STYLE_* constants
Method Detail

drawCaption

public void drawCaption(String label,
                        Graphics g)
Description copied from interface: Captioner
Draws a caption such that the left end of the text baseline is at the origin of the supplied graphics context.

Specified by:
drawCaption in interface Captioner
Parameters:
label - caption text
g - graphics context

getCaptionBounds

public Rectangle getCaptionBounds(String label)
Description copied from interface: Captioner
Returns a bounding box for the caption drawn by a corresponding call to Captioner.drawCaption(java.lang.String, java.awt.Graphics).

Specified by:
getCaptionBounds in interface Captioner
Parameters:
label - caption text
Returns:
bounding box for caption drawn at the origin

getPad

public int getPad()
Description copied from interface: Captioner
Returns a suitable padding value for separating captions from the reference position or other graphical elements.

Specified by:
getPad in interface Captioner
Returns:
pad value in pixels

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.