com.lowagie.text.pdf

Class CMapAwareDocumentFont

public class CMapAwareDocumentFont extends DocumentFont

Implementation of DocumentFont used while parsing PDF streams.

Since: 2.1.4

Field Summary
CMapcmap
CMap instance.
PdfDictionaryfontDic
The font dictionary.
intspaceWidth
the width of a space for this font, in normalized 1000 point units
Constructor Summary
CMapAwareDocumentFont(PRIndirectReference refFont)
Creates an instance of a CMapAwareFont based on an indirect reference to a font.
Method Summary
intcomputeAverageWidth()
For all widths of all glyphs, compute the average width in normalized 1000 point units.
Stringencode(byte[] bytes, int offset, int len)
Encodes bytes to a String.
intgetWidth(int char1)
voidprocessToUni()
Does some processing if the font dictionary indicates that the font is in unicode.

Field Detail

cmap

private CMap cmap
CMap instance.

fontDic

private PdfDictionary fontDic
The font dictionary.

spaceWidth

private int spaceWidth
the width of a space for this font, in normalized 1000 point units

Constructor Detail

CMapAwareDocumentFont

public CMapAwareDocumentFont(PRIndirectReference refFont)
Creates an instance of a CMapAwareFont based on an indirect reference to a font.

Parameters: refFont the indirect reference to a font

Method Detail

computeAverageWidth

private int computeAverageWidth()
For all widths of all glyphs, compute the average width in normalized 1000 point units. This is used to give some meaningful width in cases where we need an average font width (such as if the width of a space isn't specified by a given font)

Returns: the average width of all non-zero width glyphs in the font

encode

public String encode(byte[] bytes, int offset, int len)
Encodes bytes to a String.

Parameters: bytes the bytes from a stream offset an offset len a length

Returns: a String encoded taking into account if the bytes are in unicode or not.

getWidth

public int getWidth(int char1)

Since: 2.1.5 Override to allow special handling for fonts that don't specify width of space character

See Also: DocumentFont

processToUni

private void processToUni()
Does some processing if the font dictionary indicates that the font is in unicode.