Example usage for com.lowagie.text Font NORMAL

List of usage examples for com.lowagie.text Font NORMAL

Introduction

In this page you can find the example usage for com.lowagie.text Font NORMAL.

Prototype

int NORMAL

To view the source code for com.lowagie.text Font NORMAL.

Click Source Link

Document

this is a possible style.

Usage

From source file:org.activityinfo.server.report.renderer.itext.ThemeHelper.java

License:Open Source License

public static Paragraph reportTitle(String title) {
    Paragraph para = new Paragraph(title);
    para.setFont(new Font(Font.TIMES_ROMAN, TITLE_FONT_SIZE, Font.NORMAL, BLUE));
    para.setSpacingAfter(15);//from   w  w w  .  j ava 2 s  .  c  om

    return para;
}

From source file:org.activityinfo.server.report.renderer.itext.ThemeHelper.java

License:Open Source License

public static Paragraph filterDescription(String text) {
    Paragraph para = new Paragraph(text);
    para.setFont(new Font(Font.HELVETICA, HEADER3_FONT_SIZE, Font.NORMAL, Color.BLACK));
    return para;// ww  w  . j ava2 s .c  o  m
}

From source file:org.activityinfo.server.report.renderer.itext.ThemeHelper.java

License:Open Source License

public static Cell columnHeaderCell(String label, boolean leaf, int hAlign) throws BadElementException {
    Paragraph para = new Paragraph(label);
    para.setFont(new Font(Font.HELVETICA, BODY_FONT_SIZE, Font.NORMAL, Color.WHITE));

    Cell cell = new Cell();
    cell.addElement(para);//from w ww  .j av a 2 s .  com
    cell.setHorizontalAlignment(hAlign);
    cell.setHeader(true);
    cell.setVerticalAlignment(Cell.ALIGN_BOTTOM);
    cell.setBackgroundColor(BLUE3);

    cell.setBorderWidth(0);

    return cell;
}

From source file:org.activityinfo.server.report.renderer.itext.ThemeHelper.java

License:Open Source License

private static Font bodyFont() {
    return new Font(Font.HELVETICA, BODY_FONT_SIZE, Font.NORMAL, Color.BLACK);
}

From source file:org.apache.maven.doxia.module.itext.ITextFont.java

License:Apache License

/**
 * Remove bold style to the current style
 *//*w  w w  . j a  v  a 2  s  .  c o  m*/
public void removeBold() {
    this.currentStyle -= Font.BOLD;
    if (this.currentStyle < 0) {
        this.currentStyle = Font.NORMAL;
    }
}

From source file:org.apache.maven.doxia.module.itext.ITextFont.java

License:Apache License

/**
 * Remove italic style to the current style
 *//*from w w w.jav a 2s. co  m*/
public void removeItalic() {
    this.currentStyle -= Font.ITALIC;
    if (this.currentStyle < 0) {
        this.currentStyle = Font.NORMAL;
    }
}

From source file:org.apache.maven.doxia.module.itext.ITextFont.java

License:Apache License

/**
 * Remove italic style to the current style
 *///w  ww .j av  a  2 s .  co  m
public void removeUnderlined() {
    this.currentStyle -= Font.UNDERLINE;
    if (this.currentStyle < 0) {
        this.currentStyle = Font.NORMAL;
    }
}

From source file:org.apache.poi.xwpf.converter.internal.itext.PDFMapper.java

License:Open Source License

@Override
protected void visitRun(XWPFRun run, IITextContainer pdfContainer) throws Exception {
    CTR ctr = run.getCTR();//from  w  w  w.  j a  va 2 s .c o m
    // Get family name
    // Get CTRPr from style+defaults
    CTString rStyle = getRStyle(run);
    CTRPr runRprStyle = getRPr(super.getXWPFStyle(rStyle != null ? rStyle.getVal() : null));
    CTRPr rprStyle = getRPr(super.getXWPFStyle(run.getParagraph().getStyleID()));
    CTRPr rprDefault = getRPr(defaults);

    // Font family
    String fontFamily = getFontFamily(run, rprStyle, rprDefault);

    // Get font size
    float fontSize = run.getFontSize();

    // Get font style
    int fontStyle = Font.NORMAL;
    if (isBold(run, runRprStyle, rprStyle, rprDefault)) {
        fontStyle |= Font.BOLD;
    }
    if (isItalic(run, runRprStyle, rprStyle, rprDefault)) {
        fontStyle |= Font.ITALIC;
    }

    // Process color
    Color fontColor = null;
    String hexColor = getFontColor(run, runRprStyle, rprStyle, rprDefault);
    if (StringUtils.isNotEmpty(hexColor)) {
        if (hexColor != null && !"auto".equals(hexColor)) {
            fontColor = ColorRegistry.getInstance().getColor("0x" + hexColor);
        }
    }
    // Get font
    Font font = XWPFFontRegistry.getRegistry().getFont(fontFamily, options.getFontEncoding(), fontSize,
            fontStyle, fontColor);

    UnderlinePatterns underlinePatterns = run.getUnderline();

    boolean singleUnderlined = false;
    switch (underlinePatterns) {
    case SINGLE:
        singleUnderlined = true;
        break;

    default:
        break;
    }

    List<CTBr> brs = ctr.getBrList();
    for (@SuppressWarnings("unused")
    CTBr br : brs) {
        pdfContainer.addElement(Chunk.NEWLINE);
    }

    List<CTText> texts = run.getCTR().getTList();
    for (CTText ctText : texts) {

        Chunk aChunk = new Chunk(ctText.getStringValue(), font);
        if (singleUnderlined)
            aChunk.setUnderline(1, -2);

        pdfContainer.addElement(aChunk);
    }

    super.visitPictures(run, pdfContainer);

    // <w:lastRenderedPageBreak />
    List<CTEmpty> lastRenderedPageBreakList = ctr.getLastRenderedPageBreakList();
    if (lastRenderedPageBreakList != null && lastRenderedPageBreakList.size() > 0) {
        // IText Document#newPage must be called to generate page break.
        // But before that, CTSectPr must be getted to compute pageSize,
        // margins...
        // The CTSectPr <w:pPr><w:sectPr w:rsidR="00AA33F7"
        // w:rsidSect="00607077"><w:pgSz w:w="16838" w:h="11906"
        // w:orient="landscape" />...
        Stack<CTSectPr> sectPrStack = getSectPrStack();
        if (sectPrStack != null && !sectPrStack.isEmpty()) {
            CTSectPr sectPr = sectPrStack.pop();
            applySectPr(sectPr);
        }
        for (CTEmpty lastRenderedPageBreak : lastRenderedPageBreakList) {
            pdfDocument.newPage();
        }
    }
}

From source file:org.areasy.common.doclet.document.Fonts.java

License:Open Source License

public static Font getFont(int faceType, int style, int size) {
    Font font = null;/* w w w. j  ava  2  s  .c o m*/
    String lookup = String.valueOf(faceType);
    String fontFile = fontTable.getProperty(lookup);

    int fontStyle = Font.NORMAL;
    Color color = COLOR_BLACK;

    if ((style & LINK) != 0) {
        fontStyle += Font.UNDERLINE;
        color = COLOR_LINK;
    } else if ((style & UNDERLINE) != 0)
        fontStyle += Font.UNDERLINE;

    if ((style & STRIKETHROUGH) != 0)
        fontStyle += Font.STRIKETHRU;

    if (fontFile != null) {

        File file = new File(DefaultConfiguration.getWorkDir(), fontFile);
        if (file.exists() && file.isFile()) {

            try {
                String encoding = encTable.getProperty(lookup, BaseFont.CP1252);
                BaseFont bfComic = BaseFont.createFont(file.getAbsolutePath(), encoding, BaseFont.EMBEDDED);

                if ((style & AbstractConfiguration.ITALIC) > 0) {
                    if ((style & AbstractConfiguration.BOLD) > 0)
                        fontStyle += Font.BOLDITALIC;
                    else
                        fontStyle += Font.ITALIC;
                } else if ((style & AbstractConfiguration.BOLD) > 0)
                    fontStyle += Font.BOLD;

                if (fontStyle != Font.NORMAL)
                    font = new Font(bfComic, size, fontStyle, color);
                else
                    font = new Font(bfComic, size);

                if (font == null)
                    throw new IllegalArgumentException("Font null: " + fontFile);
            } catch (Exception e) {
                e.printStackTrace();
                throw new IllegalArgumentException("Font unusable");
            }
        } else
            DocletUtility.error("Font file not found: " + fontFile);
    } else {
        // Use predefined font
        String face = "";

        if (faceType == TEXT_FONT) {
            face = FontFactory.HELVETICA;

            if ((style & AbstractConfiguration.ITALIC) > 0) {
                if ((style & AbstractConfiguration.BOLD) > 0)
                    face = FontFactory.HELVETICA_BOLDOBLIQUE;
                else
                    face = FontFactory.HELVETICA_OBLIQUE;
            } else if ((style & AbstractConfiguration.BOLD) > 0)
                face = FontFactory.HELVETICA_BOLD;
        } else {
            face = FontFactory.COURIER;
            if ((style & ITALIC) > 0) {
                if ((style & BOLD) > 0)
                    face = FontFactory.COURIER_BOLDOBLIQUE;
                else
                    face = FontFactory.COURIER_OBLIQUE;
            } else if ((style & BOLD) > 0)
                face = FontFactory.COURIER_BOLD;
        }

        if (fontStyle != Font.NORMAL)
            font = FontFactory.getFont(face, size, fontStyle, color);
        else
            font = FontFactory.getFont(face, size);
    }

    return font;
}

From source file:org.areasy.common.doclet.document.tags.TagA.java

License:Open Source License

protected Chunk createChunk(String text) {
    Chunk chunk = new Chunk(text);

    Font font = chunk.font();/*  ww  w  . j  a  v a  2  s .  co  m*/
    font.setStyle(Font.NORMAL);
    font.setColor(Color.blue);

    chunk.setFont(font);

    return chunk;
}