Class WhitespaceStripper
java.lang.Object
com.openhtmltopdf.layout.WhitespaceStripper
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static booleancanCollapseThrough(Styleable styleable) private static StringcollapseWhitespace(InlineBox iB, IdentValue whitespace, String text, boolean collapseLeading) private static StringcollapseWhitespaceNormalOrNoWrap(String text, boolean collapseLeading) Collapse whitespace for normal or no-wrap modes.static voidstripInlineContent(List<Styleable> inlineContent) Strips whitespace early in inline content generation.private static voidstripTextContent(List<Styleable> stripped) private static booleanstripWhitespace(InlineBox iB, boolean collapseLeading) this function strips all whitespace from the text according to the CSS 2.1 spec on whitespace handling.
-
Field Details
-
SPACE
- See Also:
-
EOL
- See Also:
-
EOLC
public static final char EOLC- See Also:
-
linefeed_space_collapse
-
linefeed_to_space
-
tab_to_space
-
space_collapse
-
space_before_linefeed_collapse
-
-
Constructor Details
-
WhitespaceStripper
public WhitespaceStripper()
-
-
Method Details
-
stripInlineContent
Strips whitespace early in inline content generation. This can be done because "whitespage" does not ally to :first-line and :first-letter. For dynamic pseudo-classes we are allowed to choose which properties apply. NOTE: TheinlineContentparameter may be modified- Parameters:
inlineContent- the inline content to strip the whitespaces on
-
canCollapseThrough
-
stripTextContent
-
stripWhitespace
this function strips all whitespace from the text according to the CSS 2.1 spec on whitespace handling. It accounts for the different whitespace settings like normal, nowrap, pre, etc- Parameters:
collapseLeading-style-tc- the TextContent to strip. The text in it is modified.- Returns:
- whether the next leading space should collapse or not.
-
collapseWhitespaceNormalOrNoWrap
Collapse whitespace for normal or no-wrap modes. Much faster (15x in simple testing) than using multiple regular expressions. NOTE: Slightly different behavior to using regular expressions as definition of space characters differ, but I believe this is the correct definition according to CSS specifications.- Parameters:
text-collapseLeading-- Returns:
-
collapseWhitespace
private static String collapseWhitespace(InlineBox iB, IdentValue whitespace, String text, boolean collapseLeading)
-