public class RtfFont extends Font implements RtfExtendedElement
| Modifier and Type | Field and Description |
|---|---|
private int |
charset
The character set to use for this font
|
private RtfColor |
color
The color of this font
|
static java.lang.String |
DEFAULT_FONT
Default font
|
protected RtfDocument |
document
The RtfDocument this RtfFont belongs to.
|
private static byte[] |
FONT_BOLD
Constant for the bold flag
|
private static byte[] |
FONT_CHARSET
Constant for the charset
|
private static byte[] |
FONT_DOUBLE_STRIKETHROUGH
Constant for the double strikethrough flag
|
private static byte[] |
FONT_EMBOSSED
Constant for the embossed flag
|
private static byte[] |
FONT_ENGRAVED
Constant for the engraved flag
|
private static byte[] |
FONT_FAMILY
Constant for the font family to use ("froman")
|
private static byte[] |
FONT_HIDDEN
Constant for hidden text flag
|
private static byte[] |
FONT_ITALIC
Constant for the italic flag
|
private static byte[] |
FONT_OUTLINE
Constant for the outline flag
|
private static byte[] |
FONT_SHADOW
Constant for the shadow flag
|
static byte[] |
FONT_SIZE
Constant for the font size
|
private static byte[] |
FONT_STRIKETHROUGH
Constant for the strikethrough flag
|
private static byte[] |
FONT_UNDERLINE
Constant for the underline flag
|
private java.lang.String |
fontName
The font name.
|
private int |
fontNumber
The number of this font
|
private int |
fontSize
The font size.
|
private int |
fontStyle
The font style.
|
static int |
STYLE_BOLD
Constant for a bold font
|
static int |
STYLE_DOUBLE_STRIKETHROUGH
Constant for a double strikethrough font
|
static int |
STYLE_EMBOSSED
Constant for an embossed font
|
static int |
STYLE_ENGRAVED
Constant for an engraved font
|
static int |
STYLE_HIDDEN
Constant for a font that hides the actual text.
|
static int |
STYLE_ITALIC
Constant for an italic font
|
static int |
STYLE_NONE
Constant for a plain font
|
static int |
STYLE_OUTLINE
Constant for an outlined font
|
static int |
STYLE_SHADOW
Constant for a shadowed font
|
static int |
STYLE_STRIKETHROUGH
Constant for a strikethrough font
|
static int |
STYLE_UNDERLINE
Constant for an underlined font
|
BOLD, BOLDITALIC, COURIER, DEFAULTSIZE, HELVETICA, ITALIC, NORMAL, STRIKETHRU, SYMBOL, TIMES_ROMAN, UNDEFINED, UNDERLINE, ZAPFDINGBATSCLOSE_GROUP, COMMA_DELIMITER, DELIMITER, OPEN_GROUP, TWIPS_FACTOR| Modifier | Constructor and Description |
|---|---|
|
RtfFont(RtfDocument doc,
Font font)
Constructs a RtfFont from a com.lowagie.text.Font
|
protected |
RtfFont(RtfDocument doc,
int fontNumber)
Special constructor for the default font
|
|
RtfFont(java.lang.String fontName)
Constructs a RtfFont with the given font name and all other properties
at their default values.
|
|
RtfFont(java.lang.String fontName,
float size)
Constructs a RtfFont with the given font name and font size and all other
properties at their default values.
|
|
RtfFont(java.lang.String fontName,
float size,
int style)
Constructs a RtfFont with the given font name, font size and font style and the
default color.
|
|
RtfFont(java.lang.String fontName,
float size,
int style,
java.awt.Color color)
Constructs a RtfFont with the given font name, font size, font style and
color.
|
|
RtfFont(java.lang.String fontName,
float size,
int style,
java.awt.Color color,
int charset)
Constructs a RtfFont with the given font name, font size, font style, color
and charset.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(java.lang.Object object)
|
Font |
difference(Font font)
Replaces the attributes that are equal to null with
the attributes of a given font.
|
boolean |
equals(java.lang.Object obj)
Tests for equality of RtfFonts.
|
int |
getCharset()
Gets the charset used for constructing this RtfFont.
|
java.lang.String |
getFamilyname()
Gets the familyname as a String.
|
java.lang.String |
getFontName()
Gets the font name of this RtfFont
|
int |
getFontNumber()
Gets the font number of this RtfFont
|
int |
getFontSize()
Gets the font size of this RtfFont
|
int |
getFontStyle()
Gets the font style of this RtfFont
|
int |
hashCode()
Returns the hash code of this RtfFont.
|
protected byte[] |
intToByteArray(int i)
Transforms an integer into its String representation and then returns the bytes
of that string.
|
boolean |
isStandardFont()
The
RtfFont is never a standard font. |
void |
setCharset(int charset)
Sets the charset used for constructing this RtfFont.
|
void |
setColor(java.awt.Color color)
Sets the color.
|
void |
setColor(int red,
int green,
int blue)
Sets the color.
|
void |
setFamily(java.lang.String family)
Sets the family using a
String ("Courier", "Helvetica",
"Times New Roman", "Symbol" or "ZapfDingbats"). |
protected void |
setFontName(java.lang.String fontName)
Sets the font name of this RtfFont.
|
void |
setInHeader(boolean inHeader)
Unused
|
void |
setInTable(boolean inTable)
Unused
|
void |
setRtfDocument(RtfDocument doc)
Sets the RtfDocument this RtfFont belongs to
|
void |
setSize(float size)
Sets the size.
|
void |
setStyle(int style)
Sets the style.
|
void |
setStyle(java.lang.String style)
Sets the style using a
String containing one of more of
the following values: normal, bold, italic, underline, strike. |
private void |
setToDefaultFamily(java.lang.String familyname)
Sets the correct font name from the family name.
|
void |
writeBegin(java.io.OutputStream result)
Writes the font beginning
|
void |
writeContent(java.io.OutputStream out)
unused
|
void |
writeDefinition(java.io.OutputStream result)
Writes the font definition
|
void |
writeEnd(java.io.OutputStream result)
Write the font end
|
getBaseFont, getCalculatedBaseFont, getCalculatedLeading, getCalculatedSize, getCalculatedStyle, getColor, getFamily, getFamilyIndex, getSize, getStyle, getStyleValue, isBold, isItalic, isStrikethru, isUnderlinedprivate static final byte[] FONT_FAMILY
private static final byte[] FONT_CHARSET
public static final byte[] FONT_SIZE
private static final byte[] FONT_BOLD
private static final byte[] FONT_ITALIC
private static final byte[] FONT_UNDERLINE
private static final byte[] FONT_STRIKETHROUGH
private static final byte[] FONT_DOUBLE_STRIKETHROUGH
private static final byte[] FONT_SHADOW
private static final byte[] FONT_OUTLINE
private static final byte[] FONT_EMBOSSED
private static final byte[] FONT_ENGRAVED
private static final byte[] FONT_HIDDEN
public static final int STYLE_NONE
public static final int STYLE_BOLD
public static final int STYLE_ITALIC
public static final int STYLE_UNDERLINE
public static final int STYLE_STRIKETHROUGH
public static final int STYLE_DOUBLE_STRIKETHROUGH
public static final int STYLE_SHADOW
public static final int STYLE_OUTLINE
public static final int STYLE_EMBOSSED
public static final int STYLE_ENGRAVED
public static final int STYLE_HIDDEN
public static final java.lang.String DEFAULT_FONT
private java.lang.String fontName
private int fontSize
private int fontStyle
private int fontNumber
private RtfColor color
private int charset
protected RtfDocument document
public RtfFont(java.lang.String fontName)
fontName - The font name to usepublic RtfFont(java.lang.String fontName,
float size)
fontName - The font name to usesize - The font size to usepublic RtfFont(java.lang.String fontName,
float size,
int style)
fontName - The font name to usesize - The font size to usestyle - The font style to usepublic RtfFont(java.lang.String fontName,
float size,
int style,
java.awt.Color color)
fontName - The font name to usesize - the font size to usestyle - The font style to usecolor - The font color to usepublic RtfFont(java.lang.String fontName,
float size,
int style,
java.awt.Color color,
int charset)
fontName - The font name to usesize - the font size to usestyle - The font style to usecolor - The font color to usecharset - The charset of the font contentprotected RtfFont(RtfDocument doc, int fontNumber)
doc - The RtfDocument this font appears infontNumber - The id of this fontpublic RtfFont(RtfDocument doc, Font font)
doc - The RtfDocument this font appears infont - The Font to use as a basepublic void writeDefinition(java.io.OutputStream result)
throws java.io.IOException
writeDefinition in interface RtfExtendedElementresult - The OutputStream to write the element definition tojava.io.IOExceptionpublic void writeBegin(java.io.OutputStream result)
throws java.io.IOException
result - The OutputStream to write to.java.io.IOException - On i/o errors.public void writeEnd(java.io.OutputStream result)
throws java.io.IOException
result - The OutputStream to write to.java.io.IOException - On i/o errors.public void writeContent(java.io.OutputStream out)
throws java.io.IOException
writeContent in interface RtfBasicElementout - The OutputStream to write the content tojava.io.IOExceptionpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectobj - The RtfFont to compare with this RtfFontTrue if the RtfFonts are equal, false otherwisepublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String getFontName()
protected void setFontName(java.lang.String fontName)
fontName - The font name to usepublic java.lang.String getFamilyname()
FontgetFamilyname in class FontFont.getFamilyname()public void setFamily(java.lang.String family)
FontString ("Courier", "Helvetica",
"Times New Roman", "Symbol" or "ZapfDingbats").setFamily in class Fontfamily - A String representing a certain font-family.Font.setFamily(String)private void setToDefaultFamily(java.lang.String familyname)
familyname - The family name to set the name to.public int getFontSize()
public void setSize(float size)
FontsetSize in class Fontsize - The new size of the font.Font.setSize(float)public int getFontStyle()
public void setStyle(int style)
FontsetStyle in class Fontstyle - the style.Font.setStyle(int)public void setStyle(java.lang.String style)
FontString containing one of more of
the following values: normal, bold, italic, underline, strike.setStyle in class Fontstyle - A String representing a certain style.Font.setStyle(String)public int getCharset()
public void setCharset(int charset)
charset - The charset to use.public int getFontNumber()
public void setRtfDocument(RtfDocument doc)
setRtfDocument in interface RtfBasicElementdoc - The RtfDocument to usepublic void setInTable(boolean inTable)
setInTable in interface RtfBasicElementinTable - public void setInHeader(boolean inHeader)
setInHeader in interface RtfBasicElementinHeader - public void setColor(java.awt.Color color)
FontsetColor in class Fontcolor - the new color of the fontFont.setColor(Color)public void setColor(int red,
int green,
int blue)
FontsetColor in class Fontred - the red-value of the new colorgreen - the green-value of the new colorblue - the blue-value of the new colorFont.setColor(int, int, int)protected byte[] intToByteArray(int i)
i - The integer to convertpublic Font difference(Font font)
difference in class Fontfont - The surrounding fontpublic boolean isStandardFont()
RtfFont is never a standard font.isStandardFont in class Fontboolean