Example usage for com.lowagie.text Font BOLD

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

Introduction

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

Prototype

int BOLD

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

Click Source Link

Document

this is a possible style.

Usage

From source file:net.sf.eclipsecs.ui.stats.export.internal.RTFStatsExporter.java

License:Open Source License

/**
 * {@inheritDoc}//from w ww  .j ava 2 s .  c  o  m
 * 
 * @see net.sf.eclipsecs.stats.export.internal.AbstractStatsExporter#doGenerate(net.sf.eclipsecs.stats.data.Stats,
 *      java.util.List, java.io.File)
 */
protected void doGenerate(Stats stats, List details, File outputFile) throws StatsExporterException {
    File exportFile = getRealExportFile(outputFile);

    try {
        Document doc = new Document();
        RtfWriter2.getInstance(doc, new FileOutputStream(exportFile));

        // init the fonts
        mainFont = new RtfFont(getMainFontName(), getMainFontSize());
        pageHeaderAndFooterFont = new RtfFont(getMainFontName(), 9, Font.BOLDITALIC, new Color(200, 200, 200));
        tableHeaderAndFooterFont = new RtfFont(getMainFontName(), getMainFontSize(), Font.BOLD);

        // creates headers and footers
        createHeaderAndFooter(doc);

        doc.open();

        // introduces the report
        doc.add(new Paragraph(""));

        String intro = NLS.bind(Messages.MarkerStatsView_lblOverviewMessage,
                new Object[] { new Integer(stats.getMarkerCount()), new Integer(stats.getMarkerStats().size()),
                        new Integer(stats.getMarkerCountAll()) });
        Paragraph p = new Paragraph(intro, mainFont);
        doc.add(p);

        doc.add(new Paragraph(""));

        // generates the summary of the stats
        createSummaryTable(stats, doc);

        // if there are details, print the details
        if (details.size() > 0) {
            try {
                // introduces the detail section
                String category = CreateStatsJob.getUnlocalizedMessage((IMarker) details.get(0));
                category = CreateStatsJob.cleanMessage(category);
                String detailText = NLS.bind(Messages.MarkerStatsView_lblDetailMessage,
                        new Object[] { category, new Integer(details.size()) });
                p = new Paragraph(detailText, mainFont);
                doc.add(p);

                // and generates the table with the details
                createDetailSection(details, doc);

            } catch (CoreException e) {
                // TODO improve the message and i18n...
                doc.add(new Paragraph("An error occured while reading the selected markers", mainFont));
                CheckstyleLog.log(e, "An error occured while reading the selected markers");
            }
        }

        doc.close();
    } catch (FileNotFoundException e) {
        throw new StatsExporterException(e);
    } catch (DocumentException e) {
        throw new StatsExporterException(e);
    }
}

From source file:net.sf.jasperreports.engine.export.JRPdfExporter.java

License:LGPL

/**
 *
 *///w  ww .j av a2s  . c  o  m
protected Font getFont(Map attributes) {
    JRFont jrFont = new JRBaseFont(attributes);

    Exception initialException = null;

    Color forecolor = (Color) attributes.get(TextAttribute.FOREGROUND);

    Font font = null;
    PdfFont pdfFont = null;
    FontKey key = new FontKey(jrFont.getFontName(), jrFont.isBold(), jrFont.isItalic());

    if (fontMap != null && fontMap.containsKey(key)) {
        pdfFont = (PdfFont) fontMap.get(key);
    } else {
        pdfFont = new PdfFont(jrFont.getPdfFontName(), jrFont.getPdfEncoding(), jrFont.isPdfEmbedded());
    }

    try {
        font = FontFactory.getFont(pdfFont.getPdfFontName(), pdfFont.getPdfEncoding(), pdfFont.isPdfEmbedded(),
                jrFont.getFontSize(),
                (pdfFont.isPdfSimulatedBold() ? Font.BOLD : 0)
                        | (pdfFont.isPdfSimulatedItalic() ? Font.ITALIC : 0)
                        | (jrFont.isUnderline() ? Font.UNDERLINE : 0)
                        | (jrFont.isStrikeThrough() ? Font.STRIKETHRU : 0),
                forecolor);

        // check if FontFactory didn't find the font
        if (font.getBaseFont() == null && font.family() == Font.UNDEFINED) {
            font = null;
        }
    } catch (Exception e) {
        initialException = e;
    }

    if (font == null) {
        byte[] bytes = null;

        try {
            bytes = JRLoader.loadBytesFromLocation(pdfFont.getPdfFontName(), classLoader, urlHandlerFactory,
                    fileResolver);
        } catch (JRException e) {
            throw new JRRuntimeException("Could not load the following font : " + "\npdfFontName   : "
                    + pdfFont.getPdfFontName() + "\npdfEncoding   : " + pdfFont.getPdfEncoding()
                    + "\nisPdfEmbedded : " + pdfFont.isPdfEmbedded(), initialException);
        }

        BaseFont baseFont = null;

        try {
            baseFont = BaseFont.createFont(pdfFont.getPdfFontName(), pdfFont.getPdfEncoding(),
                    pdfFont.isPdfEmbedded(), true, bytes, null);
        } catch (DocumentException e) {
            throw new JRRuntimeException(e);
        } catch (IOException e) {
            throw new JRRuntimeException(e);
        }

        font = new Font(baseFont, jrFont.getFontSize(),
                ((pdfFont.isPdfSimulatedBold()) ? Font.BOLD : 0)
                        | ((pdfFont.isPdfSimulatedItalic()) ? Font.ITALIC : 0)
                        | (jrFont.isUnderline() ? Font.UNDERLINE : 0)
                        | (jrFont.isStrikeThrough() ? Font.STRIKETHRU : 0),
                forecolor);
    }

    return font;
}

From source file:nl.dykema.jxmlnote.report.pdf.PdfChunk.java

License:Open Source License

public void setFont(Font g) {
    Font f = new Font(g);
    int chst = 0;
    if (_bold) {/*from  ww w  .  j  av  a 2 s .  c  o  m*/
        chst += Font.BOLD;
    }
    if (_italic) {
        chst += Font.ITALIC;
    }
    if (_underline) {
        chst += Font.UNDERLINE;
    }
    f.setStyle(chst);
    super.setFont(f);
}

From source file:nl.dykema.jxmlnote.report.pdf.PdfParagraph.java

License:Open Source License

public Paragraph setStyle(XMLNoteParStyle style) {
    //System.out.println(super.getLeading()+","+super.getMultipliedLeading());
    _style = style;/*from   w  w w . jav a  2 s  .  c  o m*/
    if (style == null) {
        return this;
    }

    int chst = 0;
    if (style.bold()) {
        chst += Font.BOLD;
    }
    if (style.italics()) {
        chst += Font.ITALIC;
    }
    if (style.underline()) {
        chst += Font.UNDERLINE;
    }
    Font f = getFont(style.getFont());
    f.setSize(style.pointSize());
    f.setStyle(chst);
    float indentleft;
    indentleft = (float) style.leftIndent();
    super.setIndentationLeft(indentleft);
    super.setSpacingAfter(style.bottomSkip());
    super.setSpacingBefore(style.topSkip());
    //super.setLeading(0.0f); DO DIT NIET!

    //System.out.println(super.getLeading()+","+super.getMultipliedLeading());
    int p1align = getAlign(style);
    super.setAlignment(p1align);
    super.setFont(f);
    //System.out.println(super.getLeading()+","+super.getMultipliedLeading());
    super.setLeading(0.0f, 1.2f);
    //System.out.println(super.getLeading()+","+super.getMultipliedLeading());

    return this;
}

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

License:Open Source License

public static Paragraph elementTitle(String title) {
    Paragraph para = new Paragraph(title);
    para.setFont(new Font(Font.TIMES_ROMAN, HEADER2_FONT_SIZE, Font.BOLD, BLUE2));
    para.setSpacingBefore(BODY_FONT_SIZE);
    return para;//from   w w  w.  ja  v  a  2s.  co m
}

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

License:Open Source License

public static Paragraph legendTitle(String title) {
    Paragraph para = new Paragraph(title);
    para.setFont(new Font(Font.TIMES_ROMAN, BODY_FONT_SIZE, Font.BOLD, BLUE2));
    para.setSpacingBefore(BODY_FONT_SIZE);
    return para;/*from   w w  w . j  av  a2s.c o  m*/
}

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

License:Open Source License

public static Font footerFont() {
    return new Font(Font.TIMES_ROMAN, BODY_FONT_SIZE, Font.BOLD, Color.BLACK);
}

From source file:org.amanzi.splash.compare.SpreadsheetComparator.java

License:Open Source License

/**
 * Creates Comparator/*from   w w  w.j a  va 2  s  .co  m*/
 * 
 * @param containerPath path to container that will contain new Spreadsheet
 * @param newSpreadsheetName name of new Spreadsheet
 * @param firstSpreadsheet node of first Spreadsheet to compare
 * @param secondSpreadsheet node of second Spreadsheet to compare
 */
public SpreadsheetComparator(IPath containerPath, String newSpreadsheetName, SpreadsheetNode firstSpreadsheet,
        SpreadsheetNode secondSpreadsheet) {
    super(containerPath, newSpreadsheetName);

    this.firstSpreadsheet = firstSpreadsheet;
    this.secondSpreadsheet = secondSpreadsheet;

    greenCell = new CellFormat();
    greenCell.setBackgroundColor(new Color(0.0f, 1.0f, 0.0f));

    blueCell = new CellFormat();
    blueCell.setBackgroundColor(new Color(0.0f, 0.75f, 1.0f));

    yellowCell = new CellFormat();
    yellowCell.setBackgroundColor(new Color(1.0f, 1.0f, 0.0f));

    boldFormat = new CellFormat();
    boldFormat.setFontStyle(Font.BOLD);

    greyCell = new CellFormat();
    greyCell.setBackgroundColor(new Color(0.8f, 0.8f, 0.8f));
}

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

License:Apache License

/**
 * Add bold style to the current style
 */
public void addBold() {
    this.currentStyle += Font.BOLD;
}

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

License:Apache License

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