org.apache.fontbox.cmap

Class CMap

public class CMap extends Object

This class represents a CMap file.

Version: $Revision: 1.3 $

Author: Ben Litchfield (ben@benlitchfield.com)

Constructor Summary
CMap()
Creates a new instance of CMap.
Method Summary
voidaddCodespaceRange(CodespaceRange range)
This will add a codespace range.
voidaddMapping(byte[] src, String dest)
This will add a mapping.
List<CodespaceRange>getCodeSpaceRanges()
Getter for property codeSpaceRanges.
booleanhasOneByteMappings()
This will tell if this cmap has any one byte mappings.
booleanhasTwoByteMappings()
This will tell if this cmap has any two byte mappings.
booleanisInCodeSpaceRanges(byte[] code)
Check whether the given byte array is in codespace ranges or not.
booleanisInCodeSpaceRanges(byte[] code, int offset, int length)
Check whether the given byte array is in codespace ranges or not.
Stringlookup(byte[] code, int offset, int length)
This will perform a lookup into the map.
voiduseCmap(CMap cmap)
Implementation of the usecmap operator.

Constructor Detail

CMap

public CMap()
Creates a new instance of CMap.

Method Detail

addCodespaceRange

public void addCodespaceRange(CodespaceRange range)
This will add a codespace range.

Parameters: range A single codespace range.

addMapping

public void addMapping(byte[] src, String dest)
This will add a mapping.

Parameters: src The src to the mapping. dest The dest to the mapping.

Throws: IOException if the src is invalid.

getCodeSpaceRanges

public List<CodespaceRange> getCodeSpaceRanges()
Getter for property codeSpaceRanges.

Returns: Value of property codeSpaceRanges.

hasOneByteMappings

public boolean hasOneByteMappings()
This will tell if this cmap has any one byte mappings.

Returns: true If there are any one byte mappings, false otherwise.

hasTwoByteMappings

public boolean hasTwoByteMappings()
This will tell if this cmap has any two byte mappings.

Returns: true If there are any two byte mappings, false otherwise.

isInCodeSpaceRanges

public boolean isInCodeSpaceRanges(byte[] code)
Check whether the given byte array is in codespace ranges or not.

Parameters: code The byte array to look for in the codespace range.

Returns: true if the given byte array is in the codespace range.

isInCodeSpaceRanges

public boolean isInCodeSpaceRanges(byte[] code, int offset, int length)
Check whether the given byte array is in codespace ranges or not.

Parameters: code The byte array to look for in the codespace range. offset The starting offset within the byte array. length The length of the part of the array.

Returns: true if the given byte array is in the codespace range.

lookup

public String lookup(byte[] code, int offset, int length)
This will perform a lookup into the map.

Parameters: code The code used to lookup. offset The offset into the byte array. length The length of the data we are getting.

Returns: The string that matches the lookup.

useCmap

public void useCmap(CMap cmap)
Implementation of the usecmap operator. This will copy all of the mappings from one cmap to another.

Parameters: cmap The cmap to load mappings from.

Copyright © 2008-2011 Apache Software Foundation. All Rights Reserved.