List of usage examples for com.lowagie.text Font setStyle
public void setStyle(String style)
String
containing one of more of the following values: normal, bold, italic, underline, strike. From source file:org.unitime.timetable.util.PdfFont.java
License:Open Source License
public static Font getFont(boolean bold, boolean italic, boolean underline, Color color) { Font font = getFont(bold, italic); if (underline) font.setStyle(font.getStyle() + Font.UNDERLINE); if (color != null) font.setColor(color);/*from ww w . j a v a 2s . c o m*/ return font; }
From source file:org.unitime.timetable.util.PdfFont.java
License:Open Source License
public static Font getSmallFont(boolean bold, boolean italic, boolean underline, Color color) { Font font = getSmallFont(bold, italic); if (underline) font.setStyle(font.getStyle() + Font.UNDERLINE); if (color != null) font.setColor(color);//from w w w . j a va2 s .c o m return font; }
From source file:ro.nextreports.engine.exporter.RtfExporter.java
License:Apache License
private void updateFont(Font fnt, Map<String, Object> style) { if (style != null) { if (style.containsKey(StyleFormatConstants.FONT_FAMILY_KEY)) { String val = (String) style.get(StyleFormatConstants.FONT_FAMILY_KEY); fnt.setFamily(val); }// w ww .ja va2 s . c o m if (style.containsKey(StyleFormatConstants.FONT_SIZE)) { Float val = (Float) style.get(StyleFormatConstants.FONT_SIZE); fnt.setSize(val); } if (style.containsKey(StyleFormatConstants.FONT_COLOR)) { Color val = (Color) style.get(StyleFormatConstants.FONT_COLOR); fnt.setColor(val); } if (style.containsKey(StyleFormatConstants.FONT_STYLE_KEY)) { if (StyleFormatConstants.FONT_STYLE_NORMAL.equals(style.get(StyleFormatConstants.FONT_STYLE_KEY))) { fnt.setStyle(com.lowagie.text.Font.NORMAL); } if (StyleFormatConstants.FONT_STYLE_BOLD.equals(style.get(StyleFormatConstants.FONT_STYLE_KEY))) { fnt.setStyle(com.lowagie.text.Font.BOLD); } if (StyleFormatConstants.FONT_STYLE_ITALIC.equals(style.get(StyleFormatConstants.FONT_STYLE_KEY))) { fnt.setStyle(com.lowagie.text.Font.ITALIC); } if (StyleFormatConstants.FONT_STYLE_BOLDITALIC .equals(style.get(StyleFormatConstants.FONT_STYLE_KEY))) { fnt.setStyle(com.lowagie.text.Font.BOLDITALIC); } } } }
From source file:tufts.vue.PresentationNotes.java
License:Educational Community License
public static void createOutline(File file) { //page size notes: //martin-top,left,right,bottom = 36 //widht :612/*from w ww. j a va 2s .c om*/ //height : 792 //usable space 540 x 720 // step 1: creation of a document-object Document document = new Document(PageSize.LETTER); try { GUI.activateWaitCursor(); // step 2: // we create a writer that listens to the document // and directs a PDF-stream to a file PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(file)); // writer.setDefaultColorspace(PdfName.DEFAULTRGB, null); // writer.setStrictImageSequence(true); // step 3: we open the document document.open(); Paragraph p1 = new Paragraph(VUE.getActivePathway().getLabel()); p1.setSpacingAfter(15.0f); Font f = p1.getFont(); f.setStyle(Font.BOLD); p1.setFont(f); document.add(p1); /*p1.add("The leading of this paragraph is calculated automagically. "); p1.add("The default leading is 1.5 times the fontsize. "); p1.add(new Chunk("You can add chunks ")); p1.add(new Phrase("or you can add phrases. ")); p1.add(new Phrase( */ int entryCount = 1; int currentIndex = VUE.getActivePathway().getIndex(); VUE.getActivePathway().setIndex(-1); for (LWPathway.Entry entry : VUE.getActivePathway().getEntries()) { String notes = entry.getNotes(); Paragraph p = new Paragraph(entryCount + ". " + entry.getLabel()); f = p.getFont(); f.setStyle(Font.BOLD); p.setFont(f); Paragraph notesP = new Paragraph(notes); notesP.setIndentationLeft(15.0f); notesP.setSpacingAfter(15.0f); document.add(p); document.add(notesP); entryCount++; } VUE.getActivePathway().setIndex(currentIndex); } catch (DocumentException de) { System.err.println(de.getMessage()); } catch (IOException ioe) { System.err.println(ioe.getMessage()); } finally { GUI.clearWaitCursor(); } // step 5: we close the document document.close(); }
From source file:tufts.vue.PresentationNotes.java
License:Educational Community License
public static void createNodeOutline(File file) { //page size notes: //martin-top,left,right,bottom = 36 //widht :612/* ww w. j av a 2s . c o m*/ //height : 792 //usable space 540 x 720 // step 1: creation of a document-object Document document = new Document(PageSize.LETTER); try { GUI.activateWaitCursor(); // step 2: // we create a writer that listens to the document // and directs a PDF-stream to a file PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(file)); // writer.setDefaultColorspace(PdfName.DEFAULTRGB, null); // writer.setStrictImageSequence(true); // step 3: we open the document document.open(); Paragraph p1 = new Paragraph(VUE.getActiveMap().getLabel()); p1.setSpacingAfter(15.0f); Font f = p1.getFont(); f.setStyle(Font.BOLD); f.setSize(18f); p1.setFont(f); document.add(p1); String n2 = VUE.getActiveMap().getNotes(); if (n2 != null && n2.length() > 0) { Paragraph p2 = new Paragraph(n2); p2.setIndentationLeft(30.0f); p2.setSpacingAfter(15.0f); // f = p2.getFont(); //f.setSize(f.getSize()-2); //p2.setFont(f); document.add(p2); } int entryCount = 1; float indentation = 0.0f; Iterator it = VUE.getActiveMap().getAllDescendents(LWComponent.ChildKind.PROPER).iterator(); while (it.hasNext()) { LWComponent c = (LWComponent) it.next(); if (c instanceof LWNode) { LWNode n = (LWNode) c; outlineChildNode(document, indentation, n, entryCount); entryCount++; iterateChildren(document, indentation + 10, n, 1); } } it = VUE.getActiveMap().getAllDescendents(LWComponent.ChildKind.PROPER).iterator(); while (it.hasNext()) { LWComponent c = (LWComponent) it.next(); if (c instanceof LWLink) { LWLink l = (LWLink) c; String notes = l.getNotes(); String linkLabel = l.getLabel(); if ((notes == null || notes.length() == 0) && (linkLabel == null || linkLabel.length() == 0)) continue; if (linkLabel == null || linkLabel.length() == 0) linkLabel = "Link"; Paragraph p = new Paragraph(entryCount + ". " + linkLabel.replaceAll("\\n", "")); f = p.getFont(); f.setStyle(Font.BOLD); f.setSize(14f); p.setFont(f); Paragraph notesP = new Paragraph(notes); // f = notesP.getFont(); // f.setSize(f.getSize()-2); notesP.setIndentationLeft(30.0f); notesP.setSpacingAfter(15.0f); document.add(p); document.add(notesP); entryCount++; } } } catch (DocumentException de) { System.err.println(de.getMessage()); } catch (IOException ioe) { System.err.println(ioe.getMessage()); } finally { GUI.clearWaitCursor(); } // step 5: we close the document document.close(); }
From source file:tufts.vue.PresentationNotes.java
License:Educational Community License
private static void outlineChildNode(Document d, float indentation, LWNode n, int entryCount) { String notes = n.getNotes();/*w w w. ja va2s . co m*/ String nodeLabel = n.getLabel(); if (nodeLabel == null || nodeLabel.length() == 0) nodeLabel = "Node"; Paragraph p = new Paragraph(entryCount + ". " + n.getLabel().replaceAll("\\n", "")); Font f = p.getFont(); f.setStyle(Font.BOLD); f.setSize(14f); p.setFont(f); p.setIndentationLeft(indentation); Paragraph notesP = new Paragraph(notes); notesP.setIndentationLeft(indentation + 20); notesP.setSpacingAfter(15.0f); try { d.add(p); d.add(notesP); } catch (DocumentException e) { e.printStackTrace(); } }