Examples of RtfFont


Examples of com.lowagie.text.rtf.style.RtfFont

            this.lineLeading = (int) (phrase.getLeading() * RtfElement.TWIPS_FACTOR);
        } else {
            this.lineLeading = 0;
        }
       
        RtfFont phraseFont = new RtfFont(null, phrase.getFont());
        for(int i = 0; i < phrase.size(); i++) {
            LwgElement chunk = (LwgElement) phrase.get(i);
            if(chunk instanceof Chunk) {
                ((Chunk) chunk).setFont(phraseFont.difference(((Chunk) chunk).getFont()));
            }
            try {
                RtfBasicElement[] rtfElements = doc.getMapper().mapElement(chunk);
                for(int j = 0; j < rtfElements.length; j++) {
                    chunks.add(rtfElements[j]);
View Full Code Here

Examples of com.lowagie.text.rtf.style.RtfFont

            this.superSubScript = ((Float)chunk.getAttributes().get(Chunk.SUBSUPSCRIPT)).floatValue();
        }
        if(chunk.getAttributes() != null && chunk.getAttributes().get(Chunk.BACKGROUND) != null) {
            this.background = new RtfColor(this.document, (Color) ((Object[]) chunk.getAttributes().get(Chunk.BACKGROUND))[0]);
        }
        font = new RtfFont(doc, chunk.getFont());
        content = chunk.getContent();
    }
View Full Code Here

Examples of com.lowagie.text.rtf.style.RtfFont

                    if(rtfElement instanceof RtfList) {
                        ((RtfList) rtfElement).setParentList(this);
                    } else if(rtfElement instanceof RtfListItem) {
                        ((RtfListItem) rtfElement).setParent(ll);
                    }
                    ll.setFontNumber( new RtfFont(document, new LwgFont(LwgFont.TIMES_ROMAN, 10, LwgFont.NORMAL, new Color(0, 0, 0))) );
                    if (list.getSymbol() != null && list.getSymbol().getFont() != null && !list.getSymbol().getContent().startsWith("-") && list.getSymbol().getContent().length() > 0) {
                        // only set this to bullet symbol is not default
                        ll.setBulletFont( list.getSymbol().getFont());
                        ll.setBulletCharacter(list.getSymbol().getContent().substring(0, 1));
                    } else
View Full Code Here

Examples of com.lowagie.text.rtf.style.RtfFont

            LwgDocument document = new LwgDocument();
            RtfWriter2.getInstance(document, new FileOutputStream("ExtendedFontStyles.rtf"));
            document.open();
           
            // Use the RtfFont.STYLE_* instead of the Font styles.
            RtfFont doubleStrikethrough = new RtfFont("Arial", RtfFont.UNDEFINED,
                    RtfFont.STYLE_DOUBLE_STRIKETHROUGH);
            RtfFont shadow = new RtfFont("Arial", RtfFont.UNDEFINED,
                    RtfFont.STYLE_SHADOW);
           
            // Or combine them with Font styles.
            RtfFont engravedItalic = new RtfFont("Arial", RtfFont.UNDEFINED,
                    RtfFont.STYLE_ENGRAVED | LwgFont.ITALIC);
           
            // The hidden style is special since it hides text.
            RtfFont hidden = new RtfFont("Arial", RtfFont.UNDEFINED,
                    RtfFont.STYLE_HIDDEN);
           
            Paragraph paragraph = new Paragraph("This text is ", new RtfFont("Arial", 12));
           
            // Use the RtfFonts when creating the text.
            paragraph.add(new Chunk("deleted,", doubleStrikethrough));
            paragraph.add(new Chunk(" shady,", shadow));
            paragraph.add(new Chunk(" engraved and italic", engravedItalic));
View Full Code Here

Examples of com.lowagie.text.rtf.style.RtfFont

            LwgDocument document = new LwgDocument();
            RtfWriter2.getInstance(document, new FileOutputStream("ExtendedFont.rtf"));
            document.open();
           
            // Create a RtfFont with the desired font name.
            RtfFont msComicSans = new RtfFont("Comic Sans MS");
           
            // Use the RtfFont like any other Font.
            document.add(new Paragraph("This paragraph uses the" +
                    " Comic Sans MS font.", msComicSans));
           
            // Font size, font style and font colour can also be specified.
            RtfFont bigBoldGreenArial = new RtfFont("Arial", 36, LwgFont.BOLD, Color.GREEN);
           
            document.add(new Paragraph("This is a really big bold green Arial text", bigBoldGreenArial));
            document.close();
        } catch (FileNotFoundException fnfe) {
            fnfe.printStackTrace();
View Full Code Here

Examples of com.lowagie.text.rtf.style.RtfFont

    Document document = new Document();
    FileOutputStream myFile = new FileOutputStream(filePath);
    RtfWriter2 rtfWriter2 = RtfWriter2.getInstance(document, myFile);
    document.open();
    // TODO 加文档标题,即项目名 有待居中
    RtfFont projectNameFont = new RtfFont("Arial", 35, RtfFont.STYLE_BOLD);
    Paragraph paragraph = new Paragraph();
    // Use the RtfFonts when creating the text.
    paragraph.add(new Chunk(projectName, projectNameFont));
    Paragraph paragraph2 = new Paragraph();
    // Use the RtfFonts when creating the text.
View Full Code Here

Examples of com.lowagie.text.rtf.style.RtfFont

     *
     * @param fontNr The original font number.
     * @param fontName The font name to look up.
     */
    public boolean importFont(String fontNr, String fontName) {
        RtfFont rtfFont = new RtfFont(fontName);
        rtfFont.setRtfDocument(this.rtfDoc);
        this.importFontMapping.put(fontNr, Integer.toString(this.rtfDoc.getDocumentHeader().getFontNumber(rtfFont)));
        return true;
    }
View Full Code Here

Examples of com.lowagie.text.rtf.style.RtfFont

     * @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, int charset) {
        RtfFont rtfFont = new RtfFont(fontName);
        if(charset>= 0)
            rtfFont.setCharset(charset);
            rtfFont.setRtfDocument(this.rtfDoc);
            this.importFontMapping.put(fontNr, Integer.toString(this.rtfDoc.getDocumentHeader().getFontNumber(rtfFont)));
            return true;
    }
View Full Code Here

Examples of com.lowagie.text.rtf.style.RtfFont

     * @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;
    }
View Full Code Here

Examples of com.lowagie.text.rtf.style.RtfFont

     * @param doc The RtfDocument this RtfParagraph belongs to
     * @param paragraph The Paragraph that this RtfParagraph is based on
     */
    public RtfParagraph(RtfDocument doc, Paragraph paragraph) {
        super(doc);
        RtfFont baseFont = null;
        if(paragraph.getFont() instanceof RtfParagraphStyle) {
            this.paragraphStyle = this.document.getDocumentHeader().getRtfParagraphStyle(((RtfParagraphStyle) paragraph.getFont()).getStyleName());
            baseFont = this.paragraphStyle;
        } else {
            baseFont = new RtfFont(this.document, paragraph.getFont());
            this.paragraphStyle = new RtfParagraphStyle(this.document, this.document.getDocumentHeader().getRtfParagraphStyle("Normal"));
            this.paragraphStyle.setAlignment(paragraph.getAlignment());
            this.paragraphStyle.setFirstLineIndent((int) (paragraph.getFirstLineIndent() * RtfElement.TWIPS_FACTOR));
            this.paragraphStyle.setIndentLeft((int) (paragraph.getIndentationLeft() * RtfElement.TWIPS_FACTOR));
            this.paragraphStyle.setIndentRight((int) (paragraph.getIndentationRight() * RtfElement.TWIPS_FACTOR));
            this.paragraphStyle.setSpacingBefore((int) (paragraph.getSpacingBefore() * RtfElement.TWIPS_FACTOR));
            this.paragraphStyle.setSpacingAfter((int) (paragraph.getSpacingAfter() * RtfElement.TWIPS_FACTOR));
            if(paragraph.hasLeading()) {
                this.paragraphStyle.setLineLeading((int) (paragraph.getLeading() * RtfElement.TWIPS_FACTOR));
            }
            this.paragraphStyle.setKeepTogether(paragraph.getKeepTogether());
        }       
        for(int i = 0; i < paragraph.size(); i++) {
            Element chunk = (Element) paragraph.get(i);
            if(chunk instanceof Chunk) {
                ((Chunk) chunk).setFont(baseFont.difference(((Chunk) chunk).getFont()));
            } else if(chunk instanceof RtfImage) {
                ((RtfImage) chunks.get(i)).setAlignment(this.paragraphStyle.getAlignment());
            }
            try {
                RtfBasicElement[] rtfElements = doc.getMapper().mapElement(chunk);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.