Package com.openhtmltopdf.util
Class OpenUtil
- java.lang.Object
-
- com.openhtmltopdf.util.OpenUtil
-
public class OpenUtil extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanareAllCharactersPrintable(String str)Returnstrue, when all characters of the given string are printable.static intfirstNonZero(int... values)First non-zero value or zero if none.static booleanisCodePointPrintable(int codePoint)Checks if a code point is printable.static booleanisSafeFontCodePointToPrint(int codePoint)Whether the code point should be passed through to the font for rendering.static IntegerparseIntegerOrNull(String possibleInteger)
-
-
-
Method Detail
-
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
public static boolean areAllCharactersPrintable(String str)
Returnstrue, when all characters of the given string are printable.- Parameters:
str- a non-null string to test- Returns:
- whether all characters are printable
-
firstNonZero
public static int firstNonZero(int... values)
First non-zero value or zero if none.
-
-