List of usage examples for com.lowagie.text Font Font
public Font(BaseFont bf, float size, int style, Color color)
From source file:jm.web.Addons.java
License:GNU General Public License
public static PdfPCell setCeldaPDFCarnet(String texto, int tipo, int tamanio, int estilo, int alineacion, int borde, int padding, int colspan, Color color) { PdfPCell celda = new PdfPCell(new Paragraph(texto, new Font(tipo, tamanio, estilo, color))); celda.setHorizontalAlignment(alineacion); celda.setVerticalAlignment(Element.ALIGN_TOP); celda.setBorderColor(Color.WHITE); celda.setColspan(colspan);/*from w ww .j a va2 s . co m*/ celda.setBorderWidth(0); celda.setBorderWidthBottom(borde); celda.setPadding(0); celda.setPaddingBottom(padding); return celda; }
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 . ja v a 2s.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
/** * *//* ww w . ja v a2 s . c om*/ 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.activityinfo.server.report.renderer.itext.ItextChartRenderer.java
License:Open Source License
@Override public void render(DocWriter writer, Document doc, PivotChartReportElement element) throws DocumentException { doc.add(ThemeHelper.elementTitle(element.getTitle())); ItextRendererHelper.addFilterDescription(doc, element.getContent().getFilterDescriptions()); ItextRendererHelper.addDateFilterDescription(doc, element.getFilter().getDateRange()); if (element.getContent().getData().isEmpty()) { Paragraph para = new Paragraph(I18N.CONSTANTS.noData()); para.setFont(new Font(Font.HELVETICA, 12, Font.NORMAL, new Color(0, 0, 0))); doc.add(para);//from www . java2 s. com } else { float width = doc.getPageSize().getWidth() - doc.rightMargin() - doc.leftMargin(); float height = (doc.getPageSize().getHeight() - doc.topMargin() - doc.bottomMargin()) / 3f; renderImage(writer, doc, element, width, height); } }
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);// ww w. j a v a2 s . com 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;//from ww w.jav a2 s. com }
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. jav a 2 s . c o 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;// ww w . j a v a2 s . c om }
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.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 w w.ja v a 2 s . c o m cell.setHorizontalAlignment(hAlign); cell.setHeader(true); cell.setVerticalAlignment(Cell.ALIGN_BOTTOM); cell.setBackgroundColor(BLUE3); cell.setBorderWidth(0); return cell; }