Package org.apache.fop.pdf
Class PDFToUnicodeCMap.ToUnicodeCMapBuilder
java.lang.Object
org.apache.fop.pdf.CMapBuilder
org.apache.fop.pdf.PDFToUnicodeCMap.ToUnicodeCMapBuilder
- Enclosing class:
PDFToUnicodeCMap
-
Field Summary
Fields inherited from class org.apache.fop.pdf.CMapBuilder
name, writer
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate int
endOfRange
(char[] charArray, int startOfRange) Find the end of the current range.private String
padCharIndex
(int charIndex) private String
padHexString
(String input, int numChars) Prepends the input string with a sufficient number of "0" characters to get the returned string to be numChars length.private boolean
partOfRange
(char[] charArray, int arrayIndex) Determine whether this array element should be part of a bfchar entry or a bfrange entry.private boolean
sameRangeEntryAsNext
(char[] charArray, int firstItem) Determine whether two code points can be included in the same bfrange entry.private boolean
startOfRange
(char[] charArray, int arrayIndex) Determine whether this array element should be the start of a bfrange entry.protected void
writeBFCharEntries
(char[] charArray) Writes the entries for single characters of a base font (only characters which cannot be expressed as part of a character range).protected void
Writes the character mappings for this font.protected void
writeBFRangeEntries
(char[] charArray) Writes the entries for character ranges for a base font.void
Writes the CMap to a Writer.Methods inherited from class org.apache.fop.pdf.CMapBuilder
writeCIDInit, writeCIDRange, writeCIDSystemInfo, writeCIDSystemInfo, writeCodeSpaceRange, writeCodeSpaceRange, writeName, writePreStream, writeStreamAfterComments, writeStreamComments, writeType, writeUseCMap, writeVersion, writeWrapUp
-
Constructor Details
-
ToUnicodeCMapBuilder
-
-
Method Details
-
writeCMap
Writes the CMap to a Writer.- Overrides:
writeCMap
in classCMapBuilder
- Throws:
IOException
- if an I/O error occurs
-
writeBFEntries
Writes the character mappings for this font.- Overrides:
writeBFEntries
in classCMapBuilder
- Throws:
IOException
- if i/o exception
-
writeBFCharEntries
Writes the entries for single characters of a base font (only characters which cannot be expressed as part of a character range).- Parameters:
charArray
- all the characters to map- Throws:
IOException
-
padCharIndex
-
writeBFRangeEntries
Writes the entries for character ranges for a base font.- Parameters:
charArray
- all the characters to map- Throws:
IOException
-
endOfRange
private int endOfRange(char[] charArray, int startOfRange) Find the end of the current range.- Parameters:
charArray
- The array which is being tested.startOfRange
- The index to the array element that is the start of the range.- Returns:
- The index to the element that is the end of the range.
-
partOfRange
private boolean partOfRange(char[] charArray, int arrayIndex) Determine whether this array element should be part of a bfchar entry or a bfrange entry.- Parameters:
charArray
- The array to be tested.arrayIndex
- The index to the array element to be tested.- Returns:
- True if this array element should be included in a range.
-
sameRangeEntryAsNext
private boolean sameRangeEntryAsNext(char[] charArray, int firstItem) Determine whether two code points can be included in the same bfrange entry. Range sizes are limited to a maximum of 256 (128 for surrogate pairs).- Parameters:
charArray
- The array holding the code points to be tested.firstItem
- The first char of the first code point in the array to be tested. The first byte of the second code point is firstItem + n, where n is the number of chars in the firstItem code point.- Returns:
- True if both: 1) the next code point in the array is sequential with this one, and 2) this code point and the next are both NOT surrogate pairs or this code point and the next are both surrogate pairs and the high-surrogates are the same, and 3) the resulting range cannot be greater than 256 in size.
-
startOfRange
private boolean startOfRange(char[] charArray, int arrayIndex) Determine whether this array element should be the start of a bfrange entry.- Parameters:
charArray
- The array to be tested.arrayIndex
- The index to the array element to be tested.- Returns:
- True if this array element is the beginning of a range.
-
padHexString
Prepends the input string with a sufficient number of "0" characters to get the returned string to be numChars length.- Parameters:
input
- The input string.numChars
- The minimum characters in the output string.- Returns:
- The padded string.
-