Skip to content

Commit 77780c7

Browse files
author
Bruno Lowagie
committed
2 parents 3543fd0 + cad963c commit 77780c7

File tree

114 files changed

+5713
-1143
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+5713
-1143
lines changed

itext/pom.xml

Lines changed: 219 additions & 212 deletions
Large diffs are not rendered by default.

itext/src/main/java/com/itextpdf/text/Chunk.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
import java.util.ArrayList;
5353
import java.util.HashMap;
5454
import java.util.List;
55-
import java.util.UUID;
5655

5756
/**
5857
* This is the smallest significant part of text that can be added to a

itext/src/main/java/com/itextpdf/text/Document.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
import java.util.ArrayList;
4848
import java.util.Date;
4949
import java.util.HashMap;
50-
import java.util.UUID;
5150

5251
import com.itextpdf.text.error_messages.MessageLocalization;
5352
import com.itextpdf.text.pdf.PdfName;

itext/src/main/java/com/itextpdf/text/List.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151

5252
import java.util.ArrayList;
5353
import java.util.HashMap;
54-
import java.util.UUID;
5554

5655
/**
5756
* A <CODE>List</CODE> contains several <CODE>ListItem</CODE>s.

itext/src/main/java/com/itextpdf/text/ListBody.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
import com.itextpdf.text.pdf.interfaces.IAccessibleElement;
4949

5050
import java.util.HashMap;
51-
import java.util.UUID;
5251

5352
public class ListBody implements IAccessibleElement {
5453

itext/src/main/java/com/itextpdf/text/ListLabel.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,6 @@
4444
package com.itextpdf.text;
4545

4646
import com.itextpdf.text.pdf.PdfName;
47-
import com.itextpdf.text.pdf.PdfObject;
48-
import com.itextpdf.text.pdf.interfaces.IAccessibleElement;
49-
50-
import java.util.HashMap;
51-
import java.util.UUID;
5247

5348
public class ListLabel extends ListBody {
5449

itext/src/main/java/com/itextpdf/text/Paragraph.java

Lines changed: 1 addition & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050

5151
import java.util.ArrayList;
5252
import java.util.HashMap;
53-
import java.util.UUID;
5453

5554
/**
5655
* A <CODE>Paragraph</CODE> is a series of <CODE>Chunk</CODE>s and/or <CODE>Phrases</CODE>.
@@ -83,9 +82,6 @@ public class Paragraph extends Phrase implements Indentable, Spaceable, IAccessi
8382
/** The alignment of the text. */
8483
protected int alignment = Element.ALIGN_UNDEFINED;
8584

86-
/** The text leading that is multiplied by the biggest font size in the line. */
87-
protected float multipliedLeading = 0;
88-
8985
/** The indentation of this paragraph on the left side. */
9086
protected float indentationLeft;
9187

@@ -202,7 +198,6 @@ public Paragraph(Phrase phrase) {
202198
if (phrase instanceof Paragraph) {
203199
Paragraph p = (Paragraph)phrase;
204200
setAlignment(p.alignment);
205-
setLeading(phrase.getLeading(), p.multipliedLeading);
206201
setIndentationLeft(p.getIndentationLeft());
207202
setIndentationRight(p.getIndentationRight());
208203
setFirstLineIndent(p.getFirstLineIndent());
@@ -237,6 +232,7 @@ public Paragraph cloneShallow(boolean spacingBefore) {
237232
if (accessibleAttributes != null)
238233
copy.accessibleAttributes = new HashMap<PdfName, PdfObject>(accessibleAttributes);
239234
copy.setTabSettings(getTabSettings());
235+
copy.setKeepTogether(getKeepTogether());
240236
return copy;
241237
}
242238

@@ -356,38 +352,6 @@ public void setAlignment(int alignment) {
356352
this.alignment = alignment;
357353
}
358354

359-
/**
360-
* @see com.itextpdf.text.Phrase#setLeading(float)
361-
*/
362-
@Override
363-
public void setLeading(float fixedLeading) {
364-
this.leading = fixedLeading;
365-
this.multipliedLeading = 0;
366-
}
367-
368-
/**
369-
* Sets the variable leading. The resultant leading will be
370-
* multipliedLeading*maxFontSize where maxFontSize is the
371-
* size of the biggest font in the line.
372-
* @param multipliedLeading the variable leading
373-
*/
374-
public void setMultipliedLeading(float multipliedLeading) {
375-
this.leading = 0;
376-
this.multipliedLeading = multipliedLeading;
377-
}
378-
379-
/**
380-
* Sets the leading fixed and variable. The resultant leading will be
381-
* fixedLeading+multipliedLeading*maxFontSize where maxFontSize is the
382-
* size of the biggest font in the line.
383-
* @param fixedLeading the fixed leading
384-
* @param multipliedLeading the variable leading
385-
*/
386-
public void setLeading(float fixedLeading, float multipliedLeading) {
387-
this.leading = fixedLeading;
388-
this.multipliedLeading = multipliedLeading;
389-
}
390-
391355
/* (non-Javadoc)
392356
* @see com.itextpdf.text.Indentable#setIndentationLeft(float)
393357
*/
@@ -453,31 +417,6 @@ public int getAlignment() {
453417
return alignment;
454418
}
455419

456-
/**
457-
* Gets the variable leading
458-
* @return the leading
459-
*/
460-
public float getMultipliedLeading() {
461-
return multipliedLeading;
462-
}
463-
464-
/**
465-
* Gets the total leading.
466-
* This method is based on the assumption that the
467-
* font of the Paragraph is the font of all the elements
468-
* that make part of the paragraph. This isn't necessarily
469-
* true.
470-
* @return the total leading (fixed and multiplied)
471-
*/
472-
public float getTotalLeading() {
473-
float m = font == null ?
474-
Font.DEFAULTSIZE * multipliedLeading : font.getCalculatedLeading(multipliedLeading);
475-
if (m > 0 && !hasLeading()) {
476-
return m;
477-
}
478-
return getLeading() + m;
479-
}
480-
481420
/* (non-Javadoc)
482421
* @see com.itextpdf.text.Indentable#getIndentationLeft()
483422
*/

itext/src/main/java/com/itextpdf/text/Phrase.java

Lines changed: 54 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@
4747
import com.itextpdf.text.error_messages.MessageLocalization;
4848
import com.itextpdf.text.pdf.HyphenationEvent;
4949

50-
import java.util.*;
51-
import java.util.List;
50+
import java.util.ArrayList;
51+
import java.util.Collection;
5252

5353
/**
5454
* A <CODE>Phrase</CODE> is a series of <CODE>Chunk</CODE>s.
@@ -86,6 +86,9 @@ public class Phrase extends ArrayList<Element> implements TextElementArray {
8686
/** This is the leading of this phrase. */
8787
protected float leading = Float.NaN;
8888

89+
/** The text leading that is multiplied by the biggest font size in the line. */
90+
protected float multipliedLeading = 0;
91+
8992
/** This is the font of this phrase. */
9093
protected Font font;
9194

@@ -116,7 +119,7 @@ public Phrase() {
116119
public Phrase(final Phrase phrase) {
117120
super();
118121
this.addAll(phrase);
119-
leading = phrase.getLeading();
122+
setLeading(phrase.getLeading(), phrase.getMultipliedLeading());
120123
font = phrase.getFont();
121124
tabSettings = phrase.getTabSettings();
122125
setHyphenation(phrase.getHyphenation());
@@ -435,13 +438,34 @@ protected void addSpecial(final Element object) {
435438
// other methods that change the member variables
436439

437440
/**
438-
* Sets the leading of this phrase.
439-
*
440-
* @param leading the new leading
441+
* Sets the leading fixed and variable. The resultant leading will be
442+
* fixedLeading+multipliedLeading*maxFontSize where maxFontSize is the
443+
* size of the biggest font in the line.
444+
* @param fixedLeading the fixed leading
445+
* @param multipliedLeading the variable leading
441446
*/
447+
public void setLeading(final float fixedLeading, final float multipliedLeading) {
448+
this.leading = fixedLeading;
449+
this.multipliedLeading = multipliedLeading;
450+
}
442451

443-
public void setLeading(final float leading) {
444-
this.leading = leading;
452+
/**
453+
* @see com.itextpdf.text.Phrase#setLeading(float)
454+
*/
455+
public void setLeading(final float fixedLeading) {
456+
this.leading = fixedLeading;
457+
this.multipliedLeading = 0;
458+
}
459+
460+
/**
461+
* Sets the variable leading. The resultant leading will be
462+
* multipliedLeading*maxFontSize where maxFontSize is the
463+
* size of the biggest font in the line.
464+
* @param multipliedLeading the variable leading
465+
*/
466+
public void setMultipliedLeading(final float multipliedLeading) {
467+
this.leading = 0;
468+
this.multipliedLeading = multipliedLeading;
445469
}
446470

447471
/**
@@ -466,8 +490,29 @@ public float getLeading() {
466490
return leading;
467491
}
468492

493+
/**
494+
* Gets the variable leading
495+
* @return the leading
496+
*/
497+
public float getMultipliedLeading() {
498+
return multipliedLeading;
499+
}
500+
501+
/**
502+
* Gets the total leading.
503+
* This method is based on the assumption that the
504+
* font of the Paragraph is the font of all the elements
505+
* that make part of the paragraph. This isn't necessarily
506+
* true.
507+
* @return the total leading (fixed and multiplied)
508+
*/
469509
public float getTotalLeading() {
470-
return getLeading();
510+
float m = font == null ?
511+
Font.DEFAULTSIZE * multipliedLeading : font.getCalculatedLeading(multipliedLeading);
512+
if (m > 0 && !hasLeading()) {
513+
return m;
514+
}
515+
return getLeading() + m;
471516
}
472517

473518
/**

itext/src/main/java/com/itextpdf/text/Section.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,8 @@ protected Section() {
173173
protected Section(final Paragraph title, final int numberDepth) {
174174
this.numberDepth = numberDepth;
175175
this.title = title;
176-
title.setRole(new PdfName("H" + numberDepth));
176+
if (title != null)
177+
title.setRole(new PdfName("H" + numberDepth));
177178
}
178179

179180
// implementation of the Element-methods

itext/src/main/java/com/itextpdf/text/Version.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public final class Version {
6666
* This String contains the version number of this iText release.
6767
* For debugging purposes, we request you NOT to change this constant.
6868
*/
69-
private String release = "5.4.4";
69+
private String release = "5.4.5";
7070

7171
/**
7272
* The license key.

0 commit comments

Comments
 (0)