Package com.ribs.pdf
Class LatinGlyphMapper
- java.lang.Object
-
- com.ribs.pdf.GlyphMapper
-
- com.ribs.pdf.LatinGlyphMapper
-
public class LatinGlyphMapper extends GlyphMapper
A LatinGlyphMapper is a concrete subclass of GlyphMapper that can handle the standard pdf encodings that map single byte character codes from a named encoding, with possible modifications by a Differences array.This class uses the java.nio.charset package to handle macRoman and winAnsi base encodings.
It can also handle a null encoding, which it does by using the adobestandard mapping. Note that this is the right thing for the standard fonts, but not exactly correct all the time. In PDF, a null encoding actually specifies the font's internal (1 byte) encoding.
-
-
Constructor Summary
Constructors Constructor Description LatinGlyphMapper(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 len, char[] outchars)
The workhorse.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.-
Methods inherited from class com.ribs.pdf.GlyphMapper
adobeGlyphNameToUnicode, createGlyphMapper, main, mapCharsToGIDs, setCIDToGIDMap, supportsCIDToGIDMapping
-
-
-
-
Constructor Detail
-
LatinGlyphMapper
public LatinGlyphMapper(java.util.Map fontDict, PDFFile srcfile)
-
-
Method Detail
-
canHandleEncoding
public static boolean canHandleEncoding(java.lang.String pdfEncodingName)
-
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 len)
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 len, 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
-
-