Search in sources :

Example 6 with RtfFont

use of com.lowagie.text.rtf.style.RtfFont in project itext2 by albfernandez.

the class RtfImportMgr method importFont.

/**
 * Imports a font. The font name is looked up in the RtfDocumentHeader and
 * then the mapping from original font number to actual font number is added.
 *
 * @param fontNr The original font number.
 * @param fontName The font name to look up.
 * @param charset The character set to use for the font.
 */
public boolean importFont(String fontNr, String fontName, String fontFamily, int charset) {
    RtfFont rtfFont = new RtfFont(fontName);
    if (charset >= 0)
        rtfFont.setCharset(charset);
    if (fontFamily != null && fontFamily.length() > 0)
        rtfFont.setFamily(fontFamily);
    rtfFont.setRtfDocument(this.rtfDoc);
    this.importFontMapping.put(fontNr, Integer.toString(this.rtfDoc.getDocumentHeader().getFontNumber(rtfFont)));
    return true;
}
Also used : RtfFont(com.lowagie.text.rtf.style.RtfFont)

Aggregations

RtfFont (com.lowagie.text.rtf.style.RtfFont)6 Document (com.lowagie.text.Document)3 Paragraph (com.lowagie.text.Paragraph)3 Test (org.junit.Test)3 Chunk (com.lowagie.text.Chunk)2 Anchor (com.lowagie.text.Anchor)1 Annotation (com.lowagie.text.Annotation)1 Cell (com.lowagie.text.Cell)1 Chapter (com.lowagie.text.Chapter)1 HeaderFooter (com.lowagie.text.HeaderFooter)1 Image (com.lowagie.text.Image)1 List (com.lowagie.text.List)1 ListItem (com.lowagie.text.ListItem)1 Phrase (com.lowagie.text.Phrase)1 Section (com.lowagie.text.Section)1 Table (com.lowagie.text.Table)1 RtfWriter2 (com.lowagie.text.rtf.RtfWriter2)1 RtfTableOfContents (com.lowagie.text.rtf.field.RtfTableOfContents)1 RtfHeaderFooter (com.lowagie.text.rtf.headerfooter.RtfHeaderFooter)1 RtfHeaderFooterGroup (com.lowagie.text.rtf.headerfooter.RtfHeaderFooterGroup)1