- All Implemented Interfaces:
Element,TextElementArray,Serializable,Cloneable,Iterable<Element>,Collection<Element>,List<Element>,RandomAccess,SequencedCollection<Element>
Deprecated.
A
Phrase is a series of Chunks.
A Phrase has a main Font, but some chunks within the phrase can have a Font
that differs from the main Font. All the Chunks in a Phrase have the same
leading.
Example:
// When no parameters are passed, the default leading = 16
Phrase phrase0 = new Phrase();
Phrase phrase1 = new Phrase("this is a phrase");
// In this example the leading is passed as a parameter
Phrase phrase2 = new Phrase(16, "this is a phrase with leading 16");
// When a Font is passed (explicitly or embedded in a chunk), the default leading = 1.5 * size of the font
Phrase phrase3 = new Phrase("this is a phrase with a red, normal font Courier, size 12",
FontFactory.getFont(FontFactory.COURIER, 12, Font.NORMAL, new Color(255, 0, 0)));
Phrase phrase4 = new Phrase(new Chunk("this is a phrase"));
Phrase phrase5 = new Phrase(18, new Chunk("this is a phrase", FontFactory.getFont(FontFactory.HELVETICA, 16,
Font.BOLD, new Color(255, 0, 0)));
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected FontDeprecated.This is the font of this phrase.protected HyphenationEventDeprecated.Null, unless the Phrase has to be hyphenated.protected floatDeprecated.This is the leading of this phrase.Fields inherited from class java.util.AbstractList
modCountFields inherited from interface com.lowagie.text.Element
ALIGN_BASELINE, ALIGN_BOTTOM, ALIGN_CENTER, ALIGN_JUSTIFIED, ALIGN_JUSTIFIED_ALL, ALIGN_LEFT, ALIGN_MIDDLE, ALIGN_RIGHT, ALIGN_TOP, ALIGN_UNDEFINED, ANCHOR, ANNOTATION, AUTHOR, CCITT_BLACKIS1, CCITT_ENCODEDBYTEALIGN, CCITT_ENDOFBLOCK, CCITT_ENDOFLINE, CCITTG3_1D, CCITTG3_2D, CCITTG4, CELL, CHAPTER, CHUNK, CREATIONDATE, CREATOR, FOOTNOTE, HEADER, IMGRAW, IMGTEMPLATE, JBIG2, JPEG, JPEG2000, KEYWORDS, LIST, LISTITEM, MARKED, MODIFICATIONDATE, MULTI_COLUMN_TEXT, PARAGRAPH, PHRASE, PRODUCER, PTABLE, RECTANGLE, ROW, SECTION, SUBJECT, TABLE, TITLE, YMARK -
Constructor Summary
ConstructorsConstructorDescriptionPhrase()Deprecated.Constructs aPhrasewithout specifying a leading.Phrase(float leading) Deprecated.Constructs aPhrasewith a certain leading.Deprecated.Constructs aPhrasewith a certainChunkand a certain leading.Deprecated.Constructs aPhrasewith a certain leading and a certainString.Deprecated.Constructs aPhrasewith a certain leading, a certainStringand a certainFont.Deprecated.Constructs aPhrasewith a certainChunk.Deprecated.Copy constructor forPhrase.Deprecated.Constructs aPhrasewith a certainString.Deprecated.Constructs aPhrasewith a certainStringand a certainFont. -
Method Summary
Modifier and TypeMethodDescriptionvoidDeprecated.Adds aChunk, anAnchoror anotherPhraseto thisPhrase.booleanDeprecated.Adds an object to theTextElementArray.booleanDeprecated.Adds aChunk,Anchoror anotherPhraseto thisPhrase.booleanaddAll(Collection<? extends Element> collection) Deprecated.Adds a collection ofChunks to thisPhrase.protected booleanDeprecated.Adds a Chunk.protected voidaddSpecial(Object object) Deprecated.Adds aObjectto theParagraph.Deprecated.Gets all the chunks in this element.Deprecated.Returns the content as a String object.getFont()Deprecated.Gets the font of the firstChunkthat appears in thisPhrase.Deprecated.Getter for the hyphenation settings.static final PhrasegetInstance(int leading, String string) Deprecated.Gets a special kind of Phrase that changes some characters into corresponding symbols.static final PhrasegetInstance(int leading, String string, Font font) Deprecated.Gets a special kind of Phrase that changes some characters into corresponding symbols.static final PhrasegetInstance(String string) Deprecated.Gets a special kind of Phrase that changes some characters into corresponding symbols.floatDeprecated.Gets the leading of this phrase.booleanDeprecated.Checks you if the leading of this phrase is defined.booleanDeprecated.Checks if this element is a content object.booleanisEmpty()Deprecated.Checks is thisPhrasecontains no or 1 emptyChunk.booleanDeprecated.Checks if this element is nestable.booleanprocess(ElementListener listener) Deprecated.Processes the element by adding it (or the different parts) to anElementListener.voidDeprecated.Sets the main font of this Phrase.voidsetHyphenation(HyphenationEvent hyphenation) Deprecated.Setter for the hyphenation.voidsetLeading(float leading) Deprecated.Sets the leading of this phrase.inttype()Deprecated.Gets the type of the text element.Methods inherited from class java.util.ArrayList
addAll, addFirst, addLast, clear, clone, contains, ensureCapacity, equals, forEach, get, getFirst, getLast, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeFirst, removeIf, removeLast, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSizeMethods inherited from class java.util.AbstractCollection
containsAll, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, stream, toArrayMethods inherited from interface java.util.List
containsAll, reversed
-
Field Details
-
leading
protected float leadingDeprecated.This is the leading of this phrase. -
font
Deprecated.This is the font of this phrase. -
hyphenation
Deprecated.Null, unless the Phrase has to be hyphenated.- Since:
- 2.1.2
-
-
Constructor Details
-
Phrase
public Phrase()Deprecated.Constructs aPhrasewithout specifying a leading. -
Phrase
Deprecated.Copy constructor forPhrase.- Parameters:
phrase- an object ofPhrase, that you want to create a new object from
-
Phrase
public Phrase(float leading) Deprecated.Constructs aPhrasewith a certain leading.- Parameters:
leading- the leading
-
Phrase
Deprecated.Constructs aPhrasewith a certainChunk.- Parameters:
chunk- aChunk
-
Phrase
Deprecated.Constructs aPhrasewith a certainChunkand a certain leading.- Parameters:
leading- the leadingchunk- aChunk
-
Phrase
Deprecated.Constructs aPhrasewith a certainString.- Parameters:
string- aString
-
Phrase
Deprecated.Constructs aPhrasewith a certainStringand a certainFont.- Parameters:
string- aStringfont- aFont
-
Phrase
Deprecated.Constructs aPhrasewith a certain leading and a certainString.- Parameters:
leading- the leadingstring- aString
-
Phrase
Deprecated.Constructs aPhrasewith a certain leading, a certainStringand a certainFont.- Parameters:
leading- the leadingstring- aStringfont- aFont
-
-
Method Details
-
getInstance
Deprecated.Gets a special kind of Phrase that changes some characters into corresponding symbols.- Parameters:
string- input- Returns:
- a newly constructed Phrase
-
getInstance
Deprecated.Gets a special kind of Phrase that changes some characters into corresponding symbols.- Parameters:
leading- leading spacesstring- input- Returns:
- a newly constructed Phrase
-
getInstance
Deprecated.Gets a special kind of Phrase that changes some characters into corresponding symbols.- Parameters:
leading- leading spacesstring- inputfont- font to be used- Returns:
- a newly constructed Phrase
-
process
Deprecated.Processes the element by adding it (or the different parts) to anElementListener. -
type
public int type()Deprecated.Gets the type of the text element. -
getChunks
Deprecated.Gets all the chunks in this element. -
isContent
public boolean isContent()Deprecated.Description copied from interface:ElementChecks if this element is a content object. If not, it's a metadata object. -
isNestable
public boolean isNestable()Deprecated.Description copied from interface:ElementChecks if this element is nestable.- Specified by:
isNestablein interfaceElement- Returns:
- true if this element can be nested inside other elements.
- Since:
- iText 2.0.8
- See Also:
-
add
Deprecated.Adds aChunk, anAnchoror anotherPhraseto thisPhrase.- Specified by:
addin interfaceList<Element>- Overrides:
addin classArrayList<Element>- Parameters:
index- index at which the specified element is to be insertedelement- an object of typeChunk,AnchororPhrase- Throws:
ClassCastException- when you try to add something that isn't aChunk,AnchororPhrase
-
add
Deprecated.Adds aChunk,Anchoror anotherPhraseto thisPhrase.- Parameters:
o- an object of typeChunk,AnchororPhrase- Returns:
- a boolean
- Throws:
ClassCastException- when you try to add something that isn't aChunk,AnchororPhrase
-
add
Deprecated.Description copied from interface:TextElementArrayAdds an object to theTextElementArray. -
addAll
Deprecated.Adds a collection ofChunks to thisPhrase.- Specified by:
addAllin interfaceCollection<Element>- Specified by:
addAllin interfaceList<Element>- Overrides:
addAllin classArrayList<Element>- Parameters:
collection- a collection ofChunks,Anchors andPhrases.- Returns:
trueif the action succeeded,falseif not.- Throws:
ClassCastException- when you try to add something that isn't aChunk,AnchororPhrase
-
addChunk
Deprecated.Adds a Chunk.This method is a hack to solve a problem I had with phrases that were split between chunks in the wrong place.
- Parameters:
chunk- a Chunk to add to the Phrase- Returns:
- true if adding the Chunk succeeded
-
addSpecial
Deprecated.Adds aObjectto theParagraph.- Parameters:
object- the object to add.
-
getLeading
public float getLeading()Deprecated.Gets the leading of this phrase.- Returns:
- the linespacing
-
setLeading
public void setLeading(float leading) Deprecated.Sets the leading of this phrase.- Parameters:
leading- the new leading
-
hasLeading
public boolean hasLeading()Deprecated.Checks you if the leading of this phrase is defined.- Returns:
- true if the leading is defined
-
getFont
Deprecated.Gets the font of the firstChunkthat appears in thisPhrase.- Returns:
- a
Font
-
setFont
Deprecated.Sets the main font of this Phrase.Please note that this font will only be used on new content added to the Phrase. It won't change the font of existing content.
- Parameters:
font- the new font
-
getContent
Deprecated.Returns the content as a String object. This method differs from toString because toString will return an ArrayList with the toString value of the Chunks in this Phrase.- Returns:
- an
String
-
isEmpty
public boolean isEmpty()Deprecated.Checks is thisPhrasecontains no or 1 emptyChunk. -
getHyphenation
Deprecated.Getter for the hyphenation settings.- Returns:
- a HyphenationEvent
- Since:
- 2.1.2
-
setHyphenation
Deprecated.Setter for the hyphenation.- Parameters:
hyphenation- a HyphenationEvent instance- Since:
- 2.1.2
-