fop 1.0

org.apache.fop.fonts
Class CIDSubset

java.lang.Object
  extended by org.apache.fop.fonts.CIDSubset

public class CIDSubset
extends java.lang.Object

Keeps track of the glyphs used in a document. This information is later used to build a subset of a font.


Constructor Summary
CIDSubset()
           
 
Method Summary
 java.util.BitSet getGlyphIndexBitSet()
          Returns a BitSet with bits set for each available glyph index in the subset.
 int getGlyphIndexForSubsetIndex(int subsetIndex)
          Returns the original index of the glyph inside the (non-subset) font's glyph list.
 char[] getSubsetChars()
          Returns a char array containing all Unicode characters that are in the subset.
 java.util.Map getSubsetGlyphs()
          Returns an unmodifiable Map of the font subset.
 int getSubsetSize()
          Returns the number of glyphs in the subset.
 char getUnicodeForSubsetIndex(int subsetIndex)
          Returns the Unicode value for a subset index (character selector).
 int mapSubsetChar(int glyphIndex, char unicode)
          Maps a character to a character selector for a font subset.
 void setupFirstThreeGlyphs()
          Adds the initial 3 glyphs which are the same for all CID subsets.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CIDSubset

public CIDSubset()
Method Detail

setupFirstThreeGlyphs

public void setupFirstThreeGlyphs()
Adds the initial 3 glyphs which are the same for all CID subsets.


getGlyphIndexForSubsetIndex

public int getGlyphIndexForSubsetIndex(int subsetIndex)
Returns the original index of the glyph inside the (non-subset) font's glyph list. This index can be used to access the character width information, for example.

Parameters:
subsetIndex - the subset index (character selector) to access the glyph
Returns:
the original index (or -1 if no glyph index is available for the subset index)

getUnicodeForSubsetIndex

public char getUnicodeForSubsetIndex(int subsetIndex)
Returns the Unicode value for a subset index (character selector). If there's no such Unicode value, the "NOT A CHARACTER" (0xFFFF) is returned.

Parameters:
subsetIndex - the subset index (character selector)
Returns:
the Unicode value or "NOT A CHARACTER" (0xFFFF)

mapSubsetChar

public int mapSubsetChar(int glyphIndex,
                         char unicode)
Maps a character to a character selector for a font subset. If the character isn't in the subset, yet, it is added and a new character selector returned. Otherwise, the already allocated character selector is returned from the existing map/subset.

Parameters:
glyphIndex - the glyph index of the character
unicode - the Unicode index of the character
Returns:
the subset index

getSubsetGlyphs

public java.util.Map getSubsetGlyphs()
Returns an unmodifiable Map of the font subset. It maps from glyph index to character selector (i.e. the subset index in this case).

Returns:
Map Map<Integer, Integer> of the font subset

getSubsetChars

public char[] getSubsetChars()
Returns a char array containing all Unicode characters that are in the subset.

Returns:
a char array with all used Unicode characters

getSubsetSize

public int getSubsetSize()
Returns the number of glyphs in the subset.

Returns:
the number of glyphs in the subset

getGlyphIndexBitSet

public java.util.BitSet getGlyphIndexBitSet()
Returns a BitSet with bits set for each available glyph index in the subset.

Returns:
a BitSet indicating available glyph indices

fop 1.0

Copyright 1999-2010 The Apache Software Foundation. All Rights Reserved.