com.lowagie.text.rtf.style
public class: RtfFontList [javadoc |
source]
java.lang.Object
com.lowagie.text.rtf.RtfElement
com.lowagie.text.rtf.style.RtfFontList
All Implemented Interfaces:
RtfExtendedElement, RtfBasicElement
The RtfFontList stores the list of fonts used in the rtf document. It also
has methods for writing this list to the document
Version: $Id: RtfFontList.java 3440 2008-05-25 18:16:48Z howard_s $
- author:
Mark - Hall (Mark.Hall@mail.room3b.eu)
- author:
Thomas - Bickel (tmb99@inode.at)
| Field Summary |
|---|
| public static final byte[] | FONT_NUMBER | Constant for the font number |
| Constructor: |
public RtfFontList(RtfDocument doc) {
super(doc);
fontList.add(new RtfFont(document, 0));
}
Parameters:
doc - The RtfDocument this RtfFontList belongs to
|
| Method from com.lowagie.text.rtf.style.RtfFontList Detail: |
public int getFontNumber(RtfFont font) {
if(font instanceof RtfParagraphStyle) {
font = new RtfFont(this.document, font);
}
int fontIndex = -1;
for(int i = 0; i < fontList.size(); i++) {
if(fontList.get(i).equals(font)) {
fontIndex = i;
}
}
if(fontIndex == -1) {
fontIndex = fontList.size();
fontList.add(font);
}
return fontIndex;
}
Gets the index of the font in the list of fonts. If the font does not
exist in the list, it is added. |
public void writeContent(OutputStream out) throws IOException {
}
|
public void writeDefinition(OutputStream result) throws IOException {
result.write(DEFAULT_FONT);
result.write(intToByteArray(0));
result.write(OPEN_GROUP);
result.write(FONT_TABLE);
for(int i = 0; i < fontList.size(); i++) {
result.write(OPEN_GROUP);
result.write(FONT_NUMBER);
result.write(intToByteArray(i));
RtfFont rf = (RtfFont) fontList.get(i);
rf.writeDefinition(result);
result.write(COMMA_DELIMITER);
result.write(CLOSE_GROUP);
}
result.write(CLOSE_GROUP);
this.document.outputDebugLinebreak(result);
}
Writes the definition of the font list |