Class ToUnicodeWriter

java.lang.Object
org.apache.pdfbox.pdmodel.font.ToUnicodeWriter

final class ToUnicodeWriter extends Object
Writes ToUnicode Mapping Files.
  • Field Details

    • cidToUnicode

      private final Map<Integer,String> cidToUnicode
    • wMode

      private int wMode
    • MAX_ENTRIES_PER_OPERATOR

      static final int MAX_ENTRIES_PER_OPERATOR
      To test corner case of PDFBOX-4302.
      See Also:
  • Constructor Details

    • ToUnicodeWriter

      ToUnicodeWriter()
      Creates a new ToUnicode CMap writer.
  • Method Details

    • setWMode

      public void setWMode(int wMode)
      Sets the WMode (writing mode) of this CMap.
      Parameters:
      wMode - 1 for vertical, 0 for horizontal (default)
    • add

      public void add(int cid, String text)
      Adds the given CID to Unicode mapping.
      Parameters:
      cid - CID
      text - Unicode text, up to 512 bytes.
    • writeTo

      public void writeTo(OutputStream out) throws IOException
      Writes the CMap as ASCII to the given output stream.
      Parameters:
      out - ASCII output stream
      Throws:
      IOException - if the stream could not be written
    • writeLine

      private void writeLine(BufferedWriter writer, String text) throws IOException
      Throws:
      IOException
    • allowCIDToUnicodeRange

      static boolean allowCIDToUnicodeRange(Map.Entry<Integer,String> prev, Map.Entry<Integer,String> next)
    • allowCodeRange

      static boolean allowCodeRange(int prev, int next)
    • allowDestinationRange

      static boolean allowDestinationRange(String prev, String next)