Example usage for com.lowagie.text Font UNDEFINED

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

Introduction

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

Prototype

int UNDEFINED

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

Click Source Link

Document

the value of an undefined attribute.

Usage

From source file:fr.opensagres.xdocreport.itext.extension.font.AbstractFontRegistry.java

License:Open Source License

public Font getFont(String familyName, String encoding, float size, int style, Color color) {
    initFontRegistryIfNeeded();/*  w w  w  .  j  av a2s.c  o  m*/
    if (familyName != null) {
        familyName = resolveFamilyName(familyName, style);
    }
    try {
        return FontFactory.getFont(familyName, encoding, size, style, color);
    } catch (ExceptionConverter e) {
        // TODO manage options of font not found + add some logs
        return new Font(Font.UNDEFINED, size, style, color);
    }
}

From source file:fr.opensagres.xdocreport.itext.extension.font.AbstractFontRegistry.java

License:Open Source License

/**
 * checks if this font is Bold.//  ww  w  . ja  v  a2s  .co  m
 * 
 * @return a <CODE>boolean</CODE>
 */
public boolean isBold(int style) {
    if (style == Font.UNDEFINED) {
        return false;
    }
    return (style & Font.BOLD) == Font.BOLD;
}

From source file:fr.opensagres.xdocreport.itext.extension.font.AbstractFontRegistry.java

License:Open Source License

/**
 * checks if this font is Bold.//  www. j a  v a2  s .c  o  m
 * 
 * @return a <CODE>boolean</CODE>
 */
public boolean isItalic(int style) {
    if (style == Font.UNDEFINED) {
        return false;
    }
    return (style & Font.ITALIC) == Font.ITALIC;
}

From source file:fr.opensagres.xdocreport.itext.extension.font.AbstractFontRegistry.java

License:Open Source License

/**
 * checks if this font is underlined.//  w ww  .  j  av a 2 s.co  m
 * 
 * @return a <CODE>boolean</CODE>
 */
public boolean isUnderlined(int style) {
    if (style == Font.UNDEFINED) {
        return false;
    }
    return (style & Font.UNDERLINE) == Font.UNDERLINE;
}

From source file:fr.opensagres.xdocreport.itext.extension.font.AbstractFontRegistry.java

License:Open Source License

/**
 * checks if the style of this font is STRIKETHRU.
 * //from ww  w .  ja  v  a 2 s  . c o  m
 * @return a <CODE>boolean</CODE>
 */
public boolean isStrikethru(int style) {
    if (style == Font.UNDEFINED) {
        return false;
    }
    return (style & Font.STRIKETHRU) == Font.STRIKETHRU;
}

From source file:mpv5.utils.xdocreport.YabsFontFactoryImpl.java

License:Open Source License

private Font buildFont(Fonts f) {
    File tmp = f.__getFont();/*from  w  w  w.j av a2s.  c  o  m*/
    if (!"empty".equals(f.__getFilename()) && (tmp == null || !tmp.exists())) {
        f.delete();
        return null;
    }
    String key = f.__getCname() + "#" + f.__getEncoding() + "#";
    if (f.__isEmbedded()) {
        key += "1" + "#" + f.__getSize() + "#" + f.__getStyle() + "#";
    } else {
        key += "0" + "#" + +f.__getSize() + "#" + f.__getStyle() + "#";
    }
    key += f.__getColor();
    BaseFont basefont;
    Font font = null;
    try {
        if (!"empty".equals(f.__getFilename())) {
            basefont = BaseFont.createFont(f.__getFont().getAbsolutePath(), f.__getEncoding(), f.__isEmbedded(),
                    true, null, null, true);
            font = new Font(basefont, f.__getSize(), f.__getStyle(), new Color(f.__getColor()));
        } else {
            font = new Font(Font.UNDEFINED, f.__getSize(), f.__getStyle(), new Color(f.__getColor()));
        }
        used.put(key, font);
    } catch (DocumentException ex) {
        Log.Debug(this, ex.getLocalizedMessage());
    } catch (IOException ex) {
        Log.Debug(this, ex.getLocalizedMessage());
    }
    return font;
}

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

License:LGPL

/**
 *
 *///from  w w w  . ja  v  a 2  s  .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:org.areasy.common.doclet.document.tags.TagUL.java

License:Open Source License

public Element[] openTagElements() {
    Font symbolFont = new Font(Font.UNDEFINED, getFont().size());
    list.setListSymbol(new Chunk(BULLET, symbolFont));
    list.setIndentationLeft(12);//from  ww  w .  j ava  2 s .  com

    Element[] elements = new Element[1];
    elements[0] = new Paragraph(" ", getFont());
    return elements;
}

From source file:org.egov.works.utils.AbstractPDFGenerator.java

License:Open Source License

protected Font getUnderlinedFont() {
    return new Font(Font.UNDEFINED, Font.UNDEFINED, Font.UNDERLINE, null);
}

From source file:org.egov.works.web.actions.contractorBill.ContractorBillPDFGenerator.java

License:Open Source License

protected PdfPTable createContractorBillHeader(final String title, final int i) {
    final PdfPTable contractorBillHeaderTable = new PdfPTable(3);
    contractorBillHeaderTable.getDefaultCell().setBorderWidth(0);
    if (i == 0) {
        contractorBillHeaderTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);
        contractorBillHeaderTable.getDefaultCell().setColspan(4);
        contractorBillHeaderTable.addCell(title);
    } else if (i == 1) {
        contractorBillHeaderTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
        final Phrase headerTextPara = new Phrase(title, new Font(Font.UNDEFINED, LARGE_FONT, Font.BOLD));
        contractorBillHeaderTable.getDefaultCell().setColspan(3);
        contractorBillHeaderTable.addCell(headerTextPara);
    } else if (i == 2) {
        contractorBillHeaderTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT);
        contractorBillHeaderTable.getDefaultCell().setColspan(4);
        contractorBillHeaderTable.addCell(title + " " + deptName);
    }/*  w w w  .  j  a va  2  s.c o m*/
    return contractorBillHeaderTable;
}