Package com.openhtmltopdf.util
Class OpenUtil
java.lang.Object
com.openhtmltopdf.util.OpenUtil
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
Returnstrue
, when all characters of the given string are printable.static int
firstNonZero
(int... values) First non-zero value or zero if none.static boolean
isCodePointPrintable
(int codePoint) Checks if a code point is printable.static boolean
isSafeFontCodePointToPrint
(int codePoint) Whether the code point should be passed through to the font for rendering.static Integer
parseIntegerOrNull
(String possibleInteger)
-
Constructor Details
-
OpenUtil
private OpenUtil()
-
-
Method Details
-
isCodePointPrintable
public static boolean isCodePointPrintable(int codePoint) Checks if a code point is printable. If false, it can be safely discarded at the rendering stage, else it should be replaced with the replacement character, if a suitable glyph can not be found. NOTE: This should only be called after a character has been shown to be NOT present in the font. It can not be called beforehand because some fonts contain private area characters and so on. Issue#588.- Parameters:
codePoint
-- Returns:
- whether codePoint is printable
-
isSafeFontCodePointToPrint
public static boolean isSafeFontCodePointToPrint(int codePoint) Whether the code point should be passed through to the font for rendering. It effectively filters out characters that have been shown to be problematic in some (broken) fonts such as visible soft-hyphens. -
areAllCharactersPrintable
Returnstrue
, when all characters of the given string are printable.- Parameters:
str
- a non-null string to test- Returns:
- whether all characters are printable
-
parseIntegerOrNull
-
firstNonZero
public static int firstNonZero(int... values) First non-zero value or zero if none.
-