![]() | |
Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
com.lowagie.text.Font
public class Font
extends java.lang.Object
implements Comparable
Paragraph p = new Paragraph("This is a paragraph", new Font(Font.HELVETICA, 18, Font.BOLDITALIC, new Color(0, 0, 255)) );
Field Summary | |
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
private BaseFont |
|
private Color |
|
private int |
|
private float |
|
private int |
|
Constructor Summary | |
| |
| |
| |
| |
|
Method Summary | |
Color |
|
int |
|
Font |
|
int |
|
BaseFont |
|
BaseFont |
|
float |
|
int |
|
static int |
|
String |
|
static int |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
float |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
float |
|
int |
|
public static final int BOLD
this is a possible style.
- Field Value:
- 1
public static final int BOLDITALIC
this is a possible style.
- Field Value:
- 3
public static final int COURIER
a possible value of a font family.
- Field Value:
- 0
public static final int DEFAULTSIZE
the value of the default size.
- Field Value:
- 12
public static final int HELVETICA
a possible value of a font family.
- Field Value:
- 1
public static final int ITALIC
this is a possible style.
- Field Value:
- 2
public static final int NORMAL
this is a possible style.
- Field Value:
- 0
public static final int STRIKETHRU
this is a possible style.
- Field Value:
- 8
public static final int SYMBOL
a possible value of a font family.
- Field Value:
- 3
public static final int TIMES_ROMAN
a possible value of a font family.
- Field Value:
- 2
public static final int UNDEFINED
the value of an undefined attribute.
- Field Value:
- -1
public static final int UNDERLINE
this is a possible style.
- Field Value:
- 4
public static final int ZAPFDINGBATS
a possible value of a font family.
- Field Value:
- 4
private Color color
the value of the color.
private int family
the value of the fontfamily.
private float size
the value of the fontsize.
private int style
the value of the style.
public Font()
Constructs a Font.
public Font(Font other)
Copy constructor of a Font
- Parameters:
other
- the font that has to be copied
public Font(BaseFont bf, float size)
Constructs a Font.
- Parameters:
bf
- the external fontsize
- the size of this font
public Font(BaseFont bf, float size, int style)
Constructs a Font.
- Parameters:
bf
- the external fontsize
- the size of this fontstyle
- the style of this font
public Font(BaseFont bf, float size, int style, Color color)
Constructs a Font.
- Parameters:
bf
- the external fontsize
- the size of this fontstyle
- the style of this fontcolor
- theColor
of this font.
public Font(int family)
Constructs a Font.
- Parameters:
family
- the family to which this font belongs
public Font(int family, float size)
Constructs a Font.
- Parameters:
family
- the family to which this font belongssize
- the size of this font
public Font(int family, float size, int style)
Constructs a Font.
- Parameters:
family
- the family to which this font belongssize
- the size of this fontstyle
- the style of this font
public Font(int family, float size, int style, Color color)
Constructs a Font.
- Parameters:
family
- the family to which this font belongssize
- the size of this fontstyle
- the style of this fontcolor
- theColor
of this font.
public Color color()
Gets the color of this font.
- Returns:
- a color
public int compareTo(Object object)
Compares thisFont
with another
- Parameters:
object
- the otherFont
- Returns:
- a value
public Font difference(Font font)
Replaces the attributes that are equal to null with the attributes of a given font.
- Parameters:
font
- the font of a bigger element class
- Returns:
- a
Font
public int family()
Gets the family of this font.
- Returns:
- the value of the family
public BaseFont getCalculatedBaseFont(boolean specialEncoding)
Gets theBaseFont
this class represents. For the built-in fonts aBaseFont
is calculated.
- Parameters:
specialEncoding
-true
to use the special encoding for Symbol and ZapfDingbats,false
to always useCp1252
- Returns:
- the
BaseFont
this class represents
public float getCalculatedSize()
Gets the size that can be used with the calculatedBaseFont
.
- Returns:
- the size that can be used with the calculated
BaseFont
public int getCalculatedStyle()
Gets the style that can be used with the calculatedBaseFont
.
- Returns:
- the style that can be used with the calculated
BaseFont
public static int getFamilyIndex(String family)
Translates aString
-value of a certain family into the index that is used for this family in this class.
- Parameters:
family
- AString
representing a certain font-family
- Returns:
- the corresponding index
public String getFamilyname()
Gets the familyname as a String.
- Returns:
- the familyname
public static int getStyleValue(String style)
Translates aString
-value of a certain style into the index value is used for this style in this class.
- Parameters:
style
- AString
- Returns:
- the corresponding value
public boolean isBold()
checks if this font is Bold.
- Returns:
- a
boolean
public boolean isItalic()
checks if this font is Bold.
- Returns:
- a
boolean
public boolean isStandardFont()
Checks if the properties of this font are undefined or null. If so, the standard should be used.
- Returns:
- a
boolean
public boolean isStrikethru()
checks if the style of this font is STRIKETHRU.
- Returns:
- a
boolean
public boolean isUnderlined()
checks if this font is underlined.
- Returns:
- a
boolean
public float leading(float linespacing)
Gets the leading that can be used with this font.
- Parameters:
linespacing
- a certain linespacing
- Returns:
- the height of a line
public void setColor(Color color)
Sets the color.
- Parameters:
color
- the new color of the font
public void setColor(int red, int green, int blue)
Sets the color.
- Parameters:
red
- the red-value of the new colorgreen
- the green-value of the new colorblue
- the blue-value of the new color
public void setFamily(String family)
Sets the family using aString
("Courier", "Helvetica", "Times New Roman", "Symbol" or "ZapfDingbats").
- Parameters:
family
- AString
representing a certain font-family.
public void setSize(float size)
Sets the size.
- Parameters:
size
- The new size of the font.
public void setStyle(String style)
Sets the style using aString
containing one of more of the following values: normal, bold, italic, underline, strike.
- Parameters:
style
- AString
representing a certain style.
public void setStyle(int style)
Sets the style.
- Parameters:
style
- the style.
public float size()
Gets the size of this font.
- Returns:
- a size
public int style()
Gets the style of this font.
- Returns:
- a size