public class TextFlowUtil extends Object
| Constructor and Description |
|---|
TextFlowUtil() |
| Modifier and Type | Method and Description |
|---|---|
protected static TextFlow |
createTextFlow(Iterable<CharSequence> parts,
float fontSize,
org.apache.pdfbox.pdmodel.font.PDFont plainFont,
org.apache.pdfbox.pdmodel.font.PDFont boldFont,
org.apache.pdfbox.pdmodel.font.PDFont italicFont,
org.apache.pdfbox.pdmodel.font.PDFont boldItalicFont)
Actually creates the text flow from the given (markup) text.
|
static TextFlow |
createTextFlow(String text,
float fontSize,
org.apache.pdfbox.pdmodel.font.PDFont font)
Creates a text flow from the given text.
|
static TextFlow |
createTextFlowFromMarkup(String markup,
float fontSize,
BaseFont baseFont)
Convenience alternative to
createTextFlowFromMarkup(String, float, PDFont, PDFont, PDFont, PDFont)
which allows to specifies the fonts to use by using the BaseFont
enum. |
static TextFlow |
createTextFlowFromMarkup(String markup,
float fontSize,
org.apache.pdfbox.pdmodel.font.PDFont plainFont,
org.apache.pdfbox.pdmodel.font.PDFont boldFont,
org.apache.pdfbox.pdmodel.font.PDFont italicFont,
org.apache.pdfbox.pdmodel.font.PDFont boldItalicFont)
Creates a text flow from the given text.
|
static Iterable<CharSequence> |
fromMarkup(CharSequence markup)
Creates a char sequence where new-line, asterisk and underscore are
replaced by their corresponding
ControlCharacter. |
static Iterable<CharSequence> |
fromMarkup(Iterable<CharSequence> markup)
Creates a char sequence where new-line, asterisk and underscore are
replaced by their corresponding
ControlCharacter. |
static Iterable<CharSequence> |
fromPlainText(CharSequence text)
Creates a char sequence where new-line is replaced by the corresponding
ControlCharacter. |
static Iterable<CharSequence> |
fromPlainText(Iterable<CharSequence> text)
Creates a char sequence where new-line is replaced by the corresponding
ControlCharacter. |
protected static org.apache.pdfbox.pdmodel.font.PDFont |
getFont(boolean bold,
boolean italic,
org.apache.pdfbox.pdmodel.font.PDFont plainFont,
org.apache.pdfbox.pdmodel.font.PDFont boldFont,
org.apache.pdfbox.pdmodel.font.PDFont italicFont,
org.apache.pdfbox.pdmodel.font.PDFont boldItalicFont) |
protected static Iterable<CharSequence> |
splitByControlCharacter(ControlCharacters.ControlCharacterFactory controlCharacterFactory,
Iterable<CharSequence> markup)
Splits the sequence by the given control character and replaces its
markup representation by the
ControlCharacter. |
public static TextFlow createTextFlow(String text, float fontSize, org.apache.pdfbox.pdmodel.font.PDFont font) throws IOException
text - the textfontSize - the font size to use.font - the font to use.IOException - by pdfboxpublic static TextFlow createTextFlowFromMarkup(String markup, float fontSize, BaseFont baseFont) throws IOException
createTextFlowFromMarkup(String, float, PDFont, PDFont, PDFont, PDFont)
which allows to specifies the fonts to use by using the BaseFont
enum.markup - the markup text.fontSize - the font size to use.baseFont - the base font describing the bundle of
plain/blold/italic/bold-italic fonts.IOException - by pdfboxpublic static TextFlow createTextFlowFromMarkup(String markup, float fontSize, org.apache.pdfbox.pdmodel.font.PDFont plainFont, org.apache.pdfbox.pdmodel.font.PDFont boldFont, org.apache.pdfbox.pdmodel.font.PDFont italicFont, org.apache.pdfbox.pdmodel.font.PDFont boldItalicFont) throws IOException
Markup supports *bold*, _italic_, and *even _mixed* markup_.is rendered like this:
Markup supports bold, italic, and even mixed markup.Use backslash to escape special characters '*', '_' and '\' itself:
Escape \* with \\\* and \_ with \\\_ in markup.is rendered like this:
Escape * with \* and _ with \_ in markup.
markup - the markup text.fontSize - the font size to use.plainFont - the plain font.boldFont - the bold font.italicFont - the italic font.boldItalicFont - the bold-italic font.IOException - by pdfboxprotected static TextFlow createTextFlow(Iterable<CharSequence> parts, float fontSize, org.apache.pdfbox.pdmodel.font.PDFont plainFont, org.apache.pdfbox.pdmodel.font.PDFont boldFont, org.apache.pdfbox.pdmodel.font.PDFont italicFont, org.apache.pdfbox.pdmodel.font.PDFont boldItalicFont) throws IOException
parts - the parts to create the text flow from.fontSize - the font size to use.plainFont - the plain font.boldFont - the bold font.italicFont - the italic font.boldItalicFont - the bold-italic font.IOException - by pdfboxprotected static org.apache.pdfbox.pdmodel.font.PDFont getFont(boolean bold,
boolean italic,
org.apache.pdfbox.pdmodel.font.PDFont plainFont,
org.apache.pdfbox.pdmodel.font.PDFont boldFont,
org.apache.pdfbox.pdmodel.font.PDFont italicFont,
org.apache.pdfbox.pdmodel.font.PDFont boldItalicFont)
public static Iterable<CharSequence> fromPlainText(CharSequence text)
ControlCharacter.text - the original text.public static Iterable<CharSequence> fromPlainText(Iterable<CharSequence> text)
ControlCharacter.text - the original text.public static Iterable<CharSequence> fromMarkup(CharSequence markup)
ControlCharacter.markup - the markup.public static Iterable<CharSequence> fromMarkup(Iterable<CharSequence> markup)
ControlCharacter.markup - the markup.protected static Iterable<CharSequence> splitByControlCharacter(ControlCharacters.ControlCharacterFactory controlCharacterFactory, Iterable<CharSequence> markup)
ControlCharacter.controlCharacterFactory - the control character to split by.markup - the markup to split.Copyright © 2021. All rights reserved.