Package com.ribs.pdf
Class GlyphMapper
- java.lang.Object
- 
- com.ribs.pdf.GlyphMapper
 
- 
- Direct Known Subclasses:
- IndentityGlyphMapper,- LatinGlyphMapper
 
 public abstract class GlyphMapper extends java.lang.Object
- 
- 
Constructor SummaryConstructors Constructor Description GlyphMapper(java.util.Map fontDict, PDFFile srcfile)Creates a new mapper for the font.
 - 
Method SummaryAll Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static intadobeGlyphNameToUnicode(java.lang.String name, java.util.Map fontDict)Maps a single glyph name string to a unicode value.static booleancanHandleEncoding(java.lang.String pdfEncodingName)Returns true if this subclass knows how to handle the given encodingstatic GlyphMappercreateGlyphMapper(java.util.Map fontDict, PDFFile srcfile)Search routine to find a GlyphMapper subclassabstract booleanisMultiByte()Returns true if the encoding consumes more than single byte for a character.static voidmain(java.lang.String[] args)abstract intmapBytesToChars(byte[] inbytes, int offset, int len, char[] outchars)The workhorse.intmapCharsToGIDs(char[] cidbuffer, int numcids, int[] gidbuffer)Does the cid->gid mapping, if it knows how.abstract intmaximumOutputBufferSize(byte[] inbytes, int offset, int len)Quickly returns the maximum number of chars that could result from the conversion of inbytes bytes according to the encoding.voidsetCIDToGIDMap(java.lang.Object mapobj)Sets the cid to glyph index map info.booleansupportsCIDToGIDMapping()Returns true if encoding knows how to convert to glyph indices.
 
- 
- 
- 
Constructor Detail- 
GlyphMapperpublic GlyphMapper(java.util.Map fontDict, PDFFile srcfile)Creates a new mapper for the font. For Latin fonts, the encodingDict is the dict pulled out of the pdf file (with /BaseFont & /Differences entries) more complex encoding dicts could contain cmaps or other info.
 
- 
 - 
Method Detail- 
canHandleEncodingpublic static boolean canHandleEncoding(java.lang.String pdfEncodingName) Returns true if this subclass knows how to handle the given encoding
 - 
isMultiBytepublic abstract boolean isMultiByte() 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.
 - 
maximumOutputBufferSizepublic abstract int maximumOutputBufferSize(byte[] inbytes, int offset, int len)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.
 - 
mapBytesToCharspublic abstract int mapBytesToChars(byte[] inbytes, int offset, int len, char[] outchars)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.
 - 
supportsCIDToGIDMappingpublic boolean supportsCIDToGIDMapping() Returns true if encoding knows how to convert to glyph indices.
 - 
setCIDToGIDMappublic void setCIDToGIDMap(java.lang.Object mapobj) Sets the cid to glyph index map info. This object will will be interpreted as whatever format is appropriate for the particular glyphmapper.
 - 
mapCharsToGIDspublic int mapCharsToGIDs(char[] cidbuffer, int numcids, int[] gidbuffer)Does the cid->gid mapping, if it knows how. Returns the total number of glyphs created.
 - 
createGlyphMapperpublic static GlyphMapper createGlyphMapper(java.util.Map fontDict, PDFFile srcfile) Search routine to find a GlyphMapper subclass
 - 
adobeGlyphNameToUnicodepublic static int adobeGlyphNameToUnicode(java.lang.String name, java.util.Map fontDict)Maps a single glyph name string to a unicode value. This is an implementation of the algorithm described in http://partners.adobe.com/public/developer/opentype/index_glyph.html
 - 
mainpublic static void main(java.lang.String[] args) 
 
- 
 
-