/** * Sets the leading of a Paragraph object. * @param paragraph the Paragraph for which we set the leading * @param leading the String value of the leading */ protected static void setParagraphLeading(final Paragraph paragraph, final String leading) { // default leading if (leading == null) { paragraph.setLeading(0, 1.5f); return; } try { StringTokenizer tk = new StringTokenizer(leading, " ,"); // absolute leading String v = tk.nextToken(); float v1 = Float.parseFloat(v); if (!tk.hasMoreTokens()) { paragraph.setLeading(v1, 0); return; } // relative leading v = tk.nextToken(); float v2 = Float.parseFloat(v); paragraph.setLeading(v1, v2); } catch (Exception e) { // default leading paragraph.setLeading(0, 1.5f); } }
/** * Sets the leading of a Paragraph object. * @param paragraph the Paragraph for which we set the leading * @param leading the String value of the leading */ protected static void setParagraphLeading(final Paragraph paragraph, final String leading) { // default leading if (leading == null) { paragraph.setLeading(0, 1.5f); return; } try { StringTokenizer tk = new StringTokenizer(leading, " ,"); // absolute leading String v = tk.nextToken(); float v1 = Float.parseFloat(v); if (!tk.hasMoreTokens()) { paragraph.setLeading(v1, 0); return; } // relative leading v = tk.nextToken(); float v2 = Float.parseFloat(v); paragraph.setLeading(v1, v2); } catch (Exception e) { // default leading paragraph.setLeading(0, 1.5f); } }
protected void populateProperties(Paragraph copy, boolean spacingBefore) { copy.setFont(getFont()); copy.setAlignment(getAlignment()); copy.setLeading(getLeading(), multipliedLeading); copy.setIndentationLeft(getIndentationLeft()); copy.setIndentationRight(getIndentationRight()); copy.setFirstLineIndent(getFirstLineIndent()); copy.setSpacingAfter(getSpacingAfter()); if (spacingBefore) copy.setSpacingBefore(getSpacingBefore()); copy.setExtraParagraphSpace(getExtraParagraphSpace()); copy.setRole(role); copy.id = getId(); if (accessibleAttributes != null) copy.accessibleAttributes = new HashMap<PdfName, PdfObject>(accessibleAttributes); copy.setTabSettings(getTabSettings()); copy.setKeepTogether(getKeepTogether()); }
protected void populateProperties(Paragraph copy, boolean spacingBefore) { copy.setFont(getFont()); copy.setAlignment(getAlignment()); copy.setLeading(getLeading(), multipliedLeading); copy.setIndentationLeft(getIndentationLeft()); copy.setIndentationRight(getIndentationRight()); copy.setFirstLineIndent(getFirstLineIndent()); copy.setSpacingAfter(getSpacingAfter()); if (spacingBefore) copy.setSpacingBefore(getSpacingBefore()); copy.setExtraParagraphSpace(getExtraParagraphSpace()); copy.setRole(role); copy.id = getId(); if (accessibleAttributes != null) copy.accessibleAttributes = new HashMap<PdfName, PdfObject>(accessibleAttributes); copy.setTabSettings(getTabSettings()); copy.setKeepTogether(getKeepTogether()); }