public class PageSplitter extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
CENTERED_STYLE |
private javafx.scene.text.Font |
font |
static String |
HEADING_STYLE |
private double |
initialHeigth |
private double |
lineSpacing |
private double |
pageHeigth |
private double |
pageWidth |
static String |
PARAGRAPH_STYLE |
private TextSizingUtility |
sizing |
private IWordSplitter |
splitter |
static String[] |
STYLES |
| Constructor and Description |
|---|
PageSplitter(double pageHeigth,
double pageWidth,
double lineSpacing,
double initialHeigth,
javafx.scene.text.Font font)
Initialize the page splitter.
|
| Modifier and Type | Method and Description |
|---|---|
private boolean |
isLineTooLong(double lineWidth) |
(package private) void |
overrideTextSizingUtility(TextSizingUtility sizing)
Override the sizing utility for test purposes.
|
void |
setWordSplitter(IWordSplitter splitter) |
List<Page> |
splitIntoPages(ch.sahits.game.openpatrician.util.model.Text text)
Splitting up the text onto pages.
|
private List<Page> |
splitIntoPages(ch.sahits.game.openpatrician.util.model.Text text,
boolean eliminateWhiteSpaces)
Splitting up the text onto pages.
|
private double |
updatePageHeight(String line,
double currentPageHeight)
Compute the line height and add it to the page height.
|
public static final String CENTERED_STYLE
public static final String PARAGRAPH_STYLE
public static final String HEADING_STYLE
public static final String[] STYLES
private final double pageHeigth
private final double pageWidth
private final double lineSpacing
private final double initialHeigth
private final javafx.scene.text.Font font
private TextSizingUtility sizing
private IWordSplitter splitter
public PageSplitter(double pageHeigth,
double pageWidth,
double lineSpacing,
double initialHeigth,
javafx.scene.text.Font font)
pageHeigth - height of a pagepageWidth - width of a pagelineSpacing - spacing between two linesinitialHeigth - initial height of the pagefont - to be used.void overrideTextSizingUtility(TextSizingUtility sizing)
sizing - public void setWordSplitter(IWordSplitter splitter)
public List<Page> splitIntoPages(ch.sahits.game.openpatrician.util.model.Text text)
text - to be splitprivate List<Page> splitIntoPages(ch.sahits.game.openpatrician.util.model.Text text, boolean eliminateWhiteSpaces)
text - to be spliteliminateWhiteSpaces - flag indicating if the words on a line should be concatenated (remove spaces)private boolean isLineTooLong(double lineWidth)
private double updatePageHeight(String line, double currentPageHeight)
line - to be checkedcurrentPageHeight - current page height without lineCopyright © 2011-2015 Sahits GmbH. All Rights Reserved.