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
class PDFToUnicodeCMap.ToUnicodeCMapBuilder extends CMapBuilder
-
-
Field Summary
-
Fields inherited from class org.apache.fop.pdf.CMapBuilder
name, writer
-
-
Constructor Summary
Constructors Constructor Description ToUnicodeCMapBuilder(java.io.Writer writer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private int
endOfRange(char[] charArray, int startOfRange)
Find the end of the current range.private java.lang.String
padCharIndex(int charIndex)
private java.lang.String
padHexString(java.lang.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 bytes can be written 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
writeBFEntries()
Writes the character mappings for this font.protected void
writeBFRangeEntries(char[] charArray)
Writes the entries for character ranges for a base font.void
writeCMap()
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
-
-
-
-
Method Detail
-
writeCMap
public void writeCMap() throws java.io.IOException
Writes the CMap to a Writer.- Overrides:
writeCMap
in classCMapBuilder
- Throws:
java.io.IOException
- if an I/O error occurs
-
writeBFEntries
protected void writeBFEntries() throws java.io.IOException
Writes the character mappings for this font.- Overrides:
writeBFEntries
in classCMapBuilder
- Throws:
java.io.IOException
- if i/o exception
-
writeBFCharEntries
protected void writeBFCharEntries(char[] charArray) throws java.io.IOException
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:
java.io.IOException
-
padCharIndex
private java.lang.String padCharIndex(int charIndex)
-
writeBFRangeEntries
protected void writeBFRangeEntries(char[] charArray) throws java.io.IOException
Writes the entries for character ranges for a base font.- Parameters:
charArray
- all the characters to map- Throws:
java.io.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 bytes can be written in the same bfrange entry.- Parameters:
charArray
- The array to be tested.firstItem
- The first of the two items in the array to be tested. The second item is firstItem + 1.- Returns:
- True if both 1) the next item in the array is sequential with this one, and 2) the first byte of the character in the first position is equal to the first byte of the character in the second position.
-
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
private java.lang.String padHexString(java.lang.String input, int numChars)
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.
-
-