Example usage for com.lowagie.text Font Font

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

Introduction

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

Prototype


public Font() 

Source Link

Document

Constructs a Font.

Usage

From source file:at.reppeitsolutions.formbuilder.components.pdf.formbuilder.PdfFormBuilderHeading.java

License:Open Source License

@Override
public Element render() {
    Font font = new Font();
    switch (getProperties().getSize()) {
    case 1://from   w  ww . ja v a  2  s.  c  o m
        font.setSize(30);
        break;
    case 2:
        font.setSize(25);
        break;
    case 3:
        font.setSize(20);
        break;
    }
    Chunk chunk = new Chunk(getProperties().getValues(), font);
    return new ITextParagraph(chunk);
}

From source file:at.reppeitsolutions.formbuilder.components.pdf.formbuilder.PdfFormBuilderHorizontalRule.java

License:Open Source License

@Override
public Element render() {
    Chunk c = new Chunk(new LineSeparator());
    Font f = new Font();
    f.setSize(2);/*from  w  ww. j  a v  a2 s  . c om*/
    c.setFont(f);
    return c;
}

From source file:at.reppeitsolutions.formbuilder.components.pdf.formbuilder.PdfFormBuilderSpace.java

License:Open Source License

@Override
public Element render() {
    Font font = new Font();
    switch (getProperties().getSize()) {
    case 10://www  . j  a v  a 2 s .  co  m
        font.setSize(1);
        break;
    case 30:
        font.setSize(6);
        break;
    case 50:
        font.setSize(10);
        break;
    }
    return new ITextParagraph(new Chunk(" ", font));
}

From source file:at.reppeitsolutions.formbuilder.components.pdf.itext.ITextCheckbox.java

License:Open Source License

@Override
public void cellLayout(PdfPCell cell, Rectangle rectangle, PdfContentByte[] canvases) {
    PdfWriter writer = canvases[0].getPdfWriter();
    PdfAppearance[] onOff = new PdfAppearance[2];
    onOff[0] = canvases[0].createAppearance(20, 20);
    onOff[0].rectangle(1, 1, 18, 18);/*  w ww. ja va  2  s .co m*/
    onOff[0].stroke();
    onOff[1] = canvases[0].createAppearance(20, 20);
    onOff[1].setRGBColorFill(255, 128, 128);
    onOff[1].rectangle(1, 1, 18, 18);
    onOff[1].fillStroke();
    onOff[1].moveTo(1, 1);
    onOff[1].lineTo(19, 19);
    onOff[1].moveTo(1, 19);
    onOff[1].lineTo(19, 1);
    onOff[1].stroke();
    RadioCheckField checkbox;
    Font f = new Font();
    f.setSize(ITextInputText.FONTSIZE);
    for (int i = 0; i < values.length; i++) {
        try {
            Rectangle rect = ITextRadio.getBoxRectangle(rectangle, i);
            checkbox = new RadioCheckField(writer, rect, UUID.randomUUID().toString(), "Yes");
            boolean checked = false;
            if (selectedValues != null) {
                for (int i2 = 0; i2 < selectedValues.length; i2++) {
                    if (values[i].equals(selectedValues[i2])) {
                        checked = true;
                        break;
                    }
                }
            }
            checkbox.setChecked(checked);
            PdfFormField field = checkbox.getCheckField();
            field.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, "Off", onOff[0]);
            field.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, "Yes", onOff[1]);
            if (locked) {
                field.setFieldFlags(BaseField.READ_ONLY);
            }
            writer.addAnnotation(field);
            ITextRadio.addBoxDescription(rectangle, i, values, canvases);
        } catch (IOException ex) {
            Logger.getLogger(ITextCheckbox.class.getName()).log(Level.SEVERE, null, ex);
        } catch (DocumentException ex) {
            Logger.getLogger(ITextCheckbox.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}

From source file:at.reppeitsolutions.formbuilder.components.pdf.itext.ITextRadio.java

License:Open Source License

public static void addBoxDescription(Rectangle rectangle, int i, String[] values, PdfContentByte[] canvases) {
    Font f = new Font();
    f.setSize(ITextInputText.FONTSIZE);// www.ja va2  s . c o m
    ColumnText.showTextAligned(canvases[0], Element.ALIGN_LEFT, new Phrase(values[i], f), 190,
            rectangle.getTop(i * 20) - 15, 0);
}

From source file:com.bibisco.export.ITextExporter.java

License:GNU General Public License

@Override
public void startChapter(String pStrChapterTitle) {

    Font lFont = new Font();
    lFont.setFamily(mFont.getFamilyname());
    lFont.setSize(mFont.getSize());/*from  w w w .ja  v a 2  s  .  co  m*/
    lFont.setStyle(Font.BOLD);

    Anchor anchor = new Anchor(pStrChapterTitle, lFont);
    anchor.setName(pStrChapterTitle);

    mChapter = new Chapter(new Paragraph(anchor), ++mIntChapterPosition);
    addEmptyLines(1);
}

From source file:com.bibisco.export.ITextExporter.java

License:GNU General Public License

@Override
public void addText(String pStrText, TextFormatting pTextFormatting) {

    mLog.debug("Start addText(): " + pStrText);

    Font lFont = new Font();
    lFont.setFamily(mFont.getFamilyname());
    lFont.setSize(mFont.getSize());//from   w  w  w .j a v a2s . c  o  m

    int lIntStyle = 0;
    if (pTextFormatting.bold) {
        lIntStyle = lIntStyle | Font.BOLD;
    }
    if (pTextFormatting.italic) {
        lIntStyle = lIntStyle | Font.ITALIC;
    }
    if (pTextFormatting.underline) {
        lIntStyle = lIntStyle | Font.UNDERLINE;
    }
    if (pTextFormatting.strike) {
        lIntStyle = lIntStyle | Font.STRIKETHRU;
    }
    lFont.setStyle(lIntStyle);

    Chunk lChunk = new Chunk(pStrText, lFont);

    if (mListItem != null) {
        mListItem.add(lChunk);
    } else if (mParagraph != null) {
        mParagraph.add(lChunk);
    }

    mLog.debug("End addText()");
}

From source file:com.bibisco.export.ITextExporter.java

License:GNU General Public License

private void initFont(RichTextEditorSettings pRichTextEditorSettings) {
    mFont = new Font();

    if (pRichTextEditorSettings.getFont().equals("courier")) {
        mFont = new Font(Font.COURIER);
    } else if (pRichTextEditorSettings.getFont().equals("times")) {
        mFont = new Font(Font.TIMES_ROMAN);
    } else if (pRichTextEditorSettings.getFont().equals("arial")) {
        mFont = new Font(Font.HELVETICA);
    }/*from  www. j a v a 2 s . c  o m*/

    mFont.setSize(12);
}

From source file:com.bibisco.export.ITextExporter.java

License:GNU General Public License

@Override
public void startSection(String pStrSectionTitle) {

    Font lFont = new Font();
    lFont.setFamily(mFont.getFamilyname());
    lFont.setSize(mFont.getSize());//from w  w w.ja v  a  2 s  .  com
    lFont.setStyle(Font.ITALIC);

    Anchor anchor = new Anchor(pStrSectionTitle, lFont);
    anchor.setName(pStrSectionTitle);

    mSection = mChapter.addSection(new Paragraph(anchor));
}

From source file:com.bibisco.export.ITextExporter.java

License:GNU General Public License

@Override
public void startSubSection(String pStrSubSectionTitle) {
    Font lFont = new Font();
    lFont.setFamily(mFont.getFamilyname());
    lFont.setSize(mFont.getSize());//from  ww  w  . j  a v  a2 s  .c  o  m

    Anchor anchor = new Anchor(pStrSubSectionTitle, lFont);
    anchor.setName(pStrSubSectionTitle);

    addEmptyLines(1);
    mSubSection = mSection.addSection(new Paragraph(anchor));
    addEmptyLines(1);

}