Top Description Fields Constructors Methods
org.apache.pdfbox.pdmodel.font

pack-priv final Class ToUnicodeWriter

extends Object
Class Inheritance
Imports
java.io.BufferedWriter, .IOException, .OutputStream, .OutputStreamWriter, java.nio.charset.StandardCharsets, java.util.ArrayList, .List, .Map, .TreeMap, org.apache.pdfbox.util.Hex

Writes ToUnicode Mapping Files.
Author
John Hewson

Field Summary

Modifier and TypeField and Description
private final Map<Integer, String>
pack-priv static final int
MAX_ENTRIES_PER_OPERATOR

To test corner case of PDFBOX-4302.

private int

Constructor Summary

AccessConstructor and Description
pack-priv
ToUnicodeWriter()

Creates a new ToUnicode CMap writer.

Method Summary

Modifier and TypeMethod and Description
public void
add(int
CID
cid
,
String
Unicode text, up to 512 bytes.
text
)

Adds the given CID to Unicode mapping.

pack-priv static boolean
pack-priv static boolean
allowCodeRange(int prev, int next)

pack-priv static boolean
public void
setWMode(int
1 for vertical, 0 for horizontal (default)
wMode
)

Sets the WMode (writing mode) of this CMap.

private void
public void
writeTo(OutputStream
ASCII output stream
out
)

Writes the CMap as ASCII to the given output stream.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cidToUnicodeback to summary
private final Map<Integer, String> cidToUnicode
MAX_ENTRIES_PER_OPERATORback to summary
pack-priv static final int MAX_ENTRIES_PER_OPERATOR

To test corner case of PDFBOX-4302.

wModeback to summary
private int wMode

Constructor Detail

ToUnicodeWriterback to summary
pack-priv ToUnicodeWriter()

Creates a new ToUnicode CMap writer.

Method Detail

addback to summary
public void add(int cid, String text)

Adds the given CID to Unicode mapping.

Parameters
cid:int

CID

text:String

Unicode text, up to 512 bytes.

allowCIDToUnicodeRangeback to summary
pack-priv static boolean allowCIDToUnicodeRange(Map.Entry<Integer, String> prev, Map.Entry<Integer, String> next)
allowCodeRangeback to summary
pack-priv static boolean allowCodeRange(int prev, int next)
allowDestinationRangeback to summary
pack-priv static boolean allowDestinationRange(String prev, String next)
setWModeback to summary
public void setWMode(int wMode)

Sets the WMode (writing mode) of this CMap.

Parameters
wMode:int

1 for vertical, 0 for horizontal (default)

writeLineback to summary
private void writeLine(BufferedWriter writer, String text) throws IOException
writeToback to summary
public void writeTo(OutputStream out) throws IOException

Writes the CMap as ASCII to the given output stream.

Parameters
out:OutputStream

ASCII output stream

Exceptions
IOException:
if the stream could not be written