Class RtfFont
- Namespace
- iTextSharp.text.rtf.style
- Assembly
- iTextSharp.LGPLv2.Core.dll
The RtfFont class stores one font for an rtf document. It extends Font, so can be set as a font, to allow adding of fonts with arbitrary names. BaseFont fontname handling contributed by Craig Fleming. Various fixes Renaud Michel, Werner Daehn. Version: $Id: RtfFont.cs,v 1.13 2008/05/16 19:31:11 psoares33 Exp $ @author Mark Hall (Mark.Hall@mail.room3b.eu) @author Craig Fleming (rythos@rhana.dhs.org) @author Renaud Michel (r.michel@immedia.be) @author Werner Daehn (Werner.Daehn@BusinessObjects.com) @author Lidong Liu (tmslld@gmail.com)
public class RtfFont : Font, IComparable, IRtfExtendedElement, IRtfBasicElement, IRtfElementInterface
- Inheritance
-
RtfFont
- Implements
- Derived
- Inherited Members
Constructors
RtfFont(string)
Constructs a RtfFont with the given font name and all other properties at their default values.
public RtfFont(string fontName)
Parameters
fontName
stringThe font name to use
RtfFont(string, float)
Constructs a RtfFont with the given font name and font size and all other properties at their default values.
public RtfFont(string fontName, float size)
Parameters
RtfFont(string, float, int)
Constructs a RtfFont with the given font name, font size and font style and the default color.
public RtfFont(string fontName, float size, int style)
Parameters
fontName
stringThe font name to use
size
floatThe font size to use
style
intThe font style to use
RtfFont(string, float, int, BaseColor)
Constructs a RtfFont with the given font name, font size, font style and color.
public RtfFont(string fontName, float size, int style, BaseColor color)
Parameters
fontName
stringThe font name to use
size
floatthe font size to use
style
intThe font style to use
color
BaseColorThe font color to use
RtfFont(string, float, int, BaseColor, int)
Constructs a RtfFont with the given font name, font size, font style, colour and charset. This can be used when generating non latin-1 text.
public RtfFont(string fontName, float size, int style, BaseColor color, int charset)
Parameters
fontName
stringThe font name to use
size
floatthe font size to use
style
intThe font style to use
color
BaseColorThe font color to use
charset
intThe charset of the font content
RtfFont(RtfDocument, int)
Special constructor for the default font
protected RtfFont(RtfDocument doc, int fontNumber)
Parameters
doc
RtfDocumentThe RtfDocument this font appears in
fontNumber
intThe id of this font
RtfFont(RtfDocument, Font)
Constructs a RtfFont from a com.lowagie.text.Font
public RtfFont(RtfDocument doc, Font font)
Parameters
doc
RtfDocumentThe RtfDocument this font appears in
font
FontThe Font to use as a base
Fields
Document
The RtfDocument this RtfFont belongs to.
protected RtfDocument Document
Field Value
FontSize
Constant for the font size
public static readonly byte[] FontSize
Field Value
- byte[]
STYLE_BOLD
Constant for a bold font
public const int STYLE_BOLD = 1
Field Value
STYLE_DOUBLE_STRIKETHROUGH
Constant for a double strikethrough font
public const int STYLE_DOUBLE_STRIKETHROUGH = 16
Field Value
STYLE_EMBOSSED
Constant for an embossed font
public const int STYLE_EMBOSSED = 128
Field Value
STYLE_ENGRAVED
Constant for an engraved font
public const int STYLE_ENGRAVED = 256
Field Value
STYLE_HIDDEN
Constant for a font that hides the actual text.
public const int STYLE_HIDDEN = 512
Field Value
STYLE_ITALIC
Constant for an italic font
public const int STYLE_ITALIC = 2
Field Value
STYLE_NONE
Constant for a plain font
public const int STYLE_NONE = 0
Field Value
STYLE_OUTLINE
Constant for an outlined font
public const int STYLE_OUTLINE = 64
Field Value
STYLE_SHADOW
Constant for a shadowed font
public const int STYLE_SHADOW = 32
Field Value
STYLE_STRIKETHROUGH
Constant for a strikethrough font
public const int STYLE_STRIKETHROUGH = 8
Field Value
STYLE_UNDERLINE
Constant for an underlined font
public const int STYLE_UNDERLINE = 4
Field Value
Properties
Color
@see com.lowagie.text.Font#setColor(Color)
public override BaseColor Color { set; }
Property Value
Familyname
@see com.lowagie.text.Font#getFamilyname()
public override string Familyname { get; }
Property Value
Size
@see com.lowagie.text.Font#setSize(float)
public override float Size { set; }
Property Value
Methods
CompareTo(object)
Compares this RtfFont to either a {@link com.lowagie.text.Font} or an RtfFont . @since 2.1.0
public override int CompareTo(object obj)
Parameters
obj
object
Returns
Difference(Font)
Replaces the attributes that are equal to null with the attributes of a given font.
public override Font Difference(Font font)
Parameters
font
FontThe surrounding font
Returns
- Font
A RtfFont
Equals(object)
Tests for equality of RtfFonts. RtfFonts are equal if their fontName, fontSize, fontStyle and fontSuperSubscript are equal
public override bool Equals(object obj)
Parameters
obj
objectThe RtfFont to compare with this RtfFont
Returns
- bool
True if the RtfFonts are equal, false otherwise
GetCharset()
Gets the charset used for constructing this RtfFont.
public int GetCharset()
Returns
- int
The charset of this RtfFont.
GetFontName()
Gets the font name of this RtfFont
public string GetFontName()
Returns
- string
The font name
GetFontNumber()
Gets the font number of this RtfFont
public int GetFontNumber()
Returns
- int
The font number
GetFontSize()
Gets the font size of this RtfFont
public int GetFontSize()
Returns
- int
The font size
GetFontStyle()
Gets the font style of this RtfFont
public int GetFontStyle()
Returns
- int
The font style
GetHashCode()
Returns the hash code of this RtfFont. The hash code is the hash code of the string containing the font name + font size + "-" + the font style + "-" + the font super/supscript value.
public override int GetHashCode()
Returns
- int
The hash code of this RtfFont
IntToByteArray(int)
Transforms an integer into its String representation and then returns the bytes of that string.
protected static byte[] IntToByteArray(int i)
Parameters
i
intThe integer to convert
Returns
- byte[]
A byte array representing the integer
IsStandardFont()
The RtfFont is never a standard font. @since 2.1.0
public override bool IsStandardFont()
Returns
SetCharset(int)
Sets the charset used for constructing this RtfFont.
public void SetCharset(int charset)
Parameters
charset
intThe charset to use.
SetColor(int, int, int)
@see com.lowagie.text.Font#setColor(int, int, int)
public override void SetColor(int red, int green, int blue)
Parameters
SetFamily(string)
@see com.lowagie.text.Font#setFamily(String)
public override void SetFamily(string family)
Parameters
family
string
SetFontName(string)
Sets the font name of this RtfFont.
public virtual void SetFontName(string fontName)
Parameters
fontName
stringThe font name to use
SetInHeader(bool)
Unused
public void SetInHeader(bool inHeader)
Parameters
inHeader
bool
SetInTable(bool)
Unused
public void SetInTable(bool inTable)
Parameters
inTable
bool
SetRtfDocument(RtfDocument)
Sets the RtfDocument this RtfFont belongs to
public void SetRtfDocument(RtfDocument doc)
Parameters
doc
RtfDocumentThe RtfDocument to use
SetStyle(int)
@see com.lowagie.text.Font#setStyle(int)
public override void SetStyle(int style)
Parameters
style
int
SetStyle(string)
@see com.lowagie.text.Font#setStyle(String)
public override void SetStyle(string style)
Parameters
style
string
WriteBegin(Stream)
Writes the font beginning
public virtual void WriteBegin(Stream result)
Parameters
result
Stream
WriteContent(Stream)
unused
public virtual void WriteContent(Stream outp)
Parameters
outp
Stream
WriteDefinition(Stream)
Writes the font definition
public virtual void WriteDefinition(Stream outp)
Parameters
outp
Stream
WriteEnd(Stream)
Write the font end
public virtual void WriteEnd(Stream result)
Parameters
result
Stream