Class IndentityGlyphMapper
- java.lang.Object
-
- com.inductiveautomation.rm.pdf.reader.GlyphMapper
-
- com.inductiveautomation.rm.pdf.reader.IndentityGlyphMapper
-
public class IndentityGlyphMapper extends GlyphMapper
A concrete subclass of GlyphMapper for the Identity-H & Identity-V maps input bytes -> cids is done with no mapping, just interpreting the bytes as big-endian shorts. Also supports mapping to GIDs via an embedded CIDToGIDMapNote that for fonts with CIDToGIDMaps, it might be tempting to provide a way to skip the CID step and just go from input bytes to GIDs. However, all the font metric info is based on CIDs, so we're always going to have to convert to CIDs no matter what.
-
-
Constructor Summary
Constructors Constructor Description IndentityGlyphMapper(java.util.Map fontDict, PDFFile srcfile)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static boolean
canHandleEncoding(java.lang.String pdfEncodingName)
boolean
isMultiByte()
Returns true if the encoding consumes more than single byte for a character.int
mapBytesToChars(byte[] inbytes, int offset, int length, char[] outchars)
The workhorse.int
mapCharsToGIDs(char[] cidbuffer, int ncids, int[] gidbuffer)
Does the cid->gid mapping, if it knows how.int
maximumOutputBufferSize(byte[] inbytes, int offset, int length)
Quickly returns the maximum number of chars that could result from the conversion of inbytes bytes according to the encoding.void
setCIDToGIDMap(java.lang.Object mapobj)
For CID fonts that know how to map their cids directly into glyph indices.boolean
supportsCIDToGIDMapping()
Returns true if encoding knows how to convert to glyph indices.-
Methods inherited from class com.inductiveautomation.rm.pdf.reader.GlyphMapper
adobeGlyphNameToUnicode, createGlyphMapper, main
-
-
-
-
Constructor Detail
-
IndentityGlyphMapper
public IndentityGlyphMapper(java.util.Map fontDict, PDFFile srcfile)
-
-
Method Detail
-
canHandleEncoding
public static boolean canHandleEncoding(java.lang.String pdfEncodingName)
-
setCIDToGIDMap
public void setCIDToGIDMap(java.lang.Object mapobj)
For CID fonts that know how to map their cids directly into glyph indices.- Overrides:
setCIDToGIDMap
in classGlyphMapper
-
isMultiByte
public boolean isMultiByte()
Description copied from class:GlyphMapper
Returns true if the encoding consumes more than single byte for a character. Note that encodings that sometimes maps single bytes, but other times maps more than one, should always return true for this routine.- Specified by:
isMultiByte
in classGlyphMapper
-
maximumOutputBufferSize
public int maximumOutputBufferSize(byte[] inbytes, int offset, int length)
Description copied from class:GlyphMapper
Quickly returns the maximum number of chars that could result from the conversion of inbytes bytes according to the encoding. A single byte encoding, like the latin ones, will take a single byte and convert it into a single char, so this routine would just return len. An encoding that takes 2 bytes and converts them to a char would return len/2, etc.- Specified by:
maximumOutputBufferSize
in classGlyphMapper
-
mapBytesToChars
public int mapBytesToChars(byte[] inbytes, int offset, int length, char[] outchars)
Description copied from class:GlyphMapper
The workhorse. Take an input buffer and convert everything. The output buffer should be allocated using the size from the above routine. The actual number of chars in the final output is returned.- Specified by:
mapBytesToChars
in classGlyphMapper
-
supportsCIDToGIDMapping
public boolean supportsCIDToGIDMapping()
Description copied from class:GlyphMapper
Returns true if encoding knows how to convert to glyph indices.- Overrides:
supportsCIDToGIDMapping
in classGlyphMapper
-
mapCharsToGIDs
public int mapCharsToGIDs(char[] cidbuffer, int ncids, int[] gidbuffer)
Description copied from class:GlyphMapper
Does the cid->gid mapping, if it knows how. Returns the total number of glyphs created.- Overrides:
mapCharsToGIDs
in classGlyphMapper
-
-