Class OpenUtil

java.lang.Object
com.openhtmltopdf.util.OpenUtil

public class OpenUtil extends Object
  • 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

      public static boolean areAllCharactersPrintable(String str)
      Returns true, when all characters of the given string are printable.
      Parameters:
      str - a non-null string to test
      Returns:
      whether all characters are printable
    • parseIntegerOrNull

      public static Integer parseIntegerOrNull(String possibleInteger)
    • firstNonZero

      public static int firstNonZero(int... values)
      First non-zero value or zero if none.