fop 1.1

## org.apache.fop.afp.fonts
Class CharacterSetBuilder

    java.lang.Object
      org.apache.fop.afp.fonts.CharacterSetBuilder

    public abstract class CharacterSetBuilder

extends java.lang.Object

The CharacterSetBuilder is responsible building the a CharacterSet instance that holds the font metric data. The data is either read from disk and passed to a CharacterSet (*) or a FopCharacterSet is instantiated that is composed of a Typeface instance configured with this data.

-*- For referenced fonts CharacterSetBuilder is responsible for reading the font attributes from binary code page files and the character set metric files. In IBM font structure, a code page maps each character of text to the characters in a character set. Each character is translated into a code point. When the character is printed, each code point is matched to a character ID on the code page specified. The character ID is then matched to the image (raster pattern or outline pattern) of the character in the character set specified. The image in the character set is the image that is printed in the document. To be a valid code page for a particular character set, all character IDs in the code page must be included in that character set.

This class will read the font information from the binary code page files and character set metric files in order to determine the correct metrics to use when rendering the formatted object.

Field Summary
`protected static org.apache.commons.logging.Log` `LOG` Static logging instance

Method Summary
`CharacterSet` `build(java.lang.String characterSetName, java.lang.String codePageName, java.lang.String encoding, Typeface typeface, AFPEventProducer eventProducer)` Load the font details and metrics into the CharacterSetMetric object, this will use the actual afp code page and character set files to load the object with the necessary metrics.
`CharacterSet` `buildDBCS(java.lang.String characterSetName, java.lang.String codePageName, java.lang.String encoding, CharacterSetType charsetType, ResourceAccessor accessor, AFPEventProducer eventProducer)` Load the font details and metrics into the CharacterSetMetric object, this will use the actual afp code page and character set files to load the object with the necessary metrics.
`CharacterSet` `buildSBCS(java.lang.String characterSetName, java.lang.String codePageName, java.lang.String encoding, ResourceAccessor accessor, AFPEventProducer eventProducer)` Load the font details and metrics into the CharacterSetMetric object, this will use the actual afp code page and character set files to load the object with the necessary metrics.
`protected void` `closeInputStream(java.io.InputStream inputStream)` Closes the inputstream
`static CharacterSetBuilder` `getDoubleByteInstance()` Factory method for the double-byte (CID Keyed font (Type 0)) implementation of AFPFontReader.
`static CharacterSetBuilder` `getSingleByteInstance()` Factory method for the single-byte implementation of AFPFontReader.
`protected java.util.Map<java.lang.String,java.lang.String>` `loadCodePage(java.lang.String codePage, java.lang.String encoding, ResourceAccessor accessor, AFPEventProducer eventProducer)` Load the code page information from the appropriate file.
`protected java.io.InputStream` `openInputStream(ResourceAccessor accessor, java.lang.String filename, AFPEventProducer eventProducer)` Returns an InputStream to a given file path and filename * @param accessor the resource accessor
`protected org.apache.fop.afp.fonts.CharacterSetBuilder.FontControl` `processFontControl(StructuredFieldReader structuredFieldReader)` Process the font control details using the structured field reader.
`protected static org.apache.fop.afp.fonts.CharacterSetBuilder.FontDescriptor` `processFontDescriptor(StructuredFieldReader structuredFieldReader)` Process the font descriptor details using the structured field reader.
`protected void` `processFontIndex(StructuredFieldReader structuredFieldReader, CharacterSetOrientation cso, java.util.Map<java.lang.String,java.lang.String> codepage, double metricNormalizationFactor)` Process the font index details for the character set orientation.
`protected CharacterSetOrientation[]` `processFontOrientation(StructuredFieldReader structuredFieldReader)` Process the font orientation details from using the structured field reader.
`protected void` `processFontPosition(StructuredFieldReader structuredFieldReader, CharacterSetOrientation[] characterSetOrientations, double metricNormalizationFactor)` Populate the CharacterSetOrientation object in the suplied array with the font position details using the supplied structured field reader.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### LOG

    protected static final org.apache.commons.logging.Log LOG

  Static logging instance

Method Detail

### getSingleByteInstance

    public static CharacterSetBuilder getSingleByteInstance()

  Factory method for the single-byte implementation of AFPFontReader.

  Returns:
    AFPFontReader

### getDoubleByteInstance

    public static CharacterSetBuilder getDoubleByteInstance()

  Factory method for the double-byte (CID Keyed font (Type 0)) implementation of AFPFontReader.

  Returns:
    AFPFontReader

### openInputStream

    protected java.io.InputStream openInputStream(ResourceAccessor accessor,
                                                  java.lang.String filename,
                                                  AFPEventProducer eventProducer)
                                           throws java.io.IOException

  Returns an InputStream to a given file path and filename * @param accessor the resource accessor

  Parameters:
    `filename` - the file name
    `eventProducer` - for handling AFP related events
  Returns:
    an inputStream
  Throws:
    `java.io.IOException` - in the event that an I/O exception of some sort has occurred

### closeInputStream

    protected void closeInputStream(java.io.InputStream inputStream)

  Closes the inputstream

  Parameters:
    `inputStream` - the inputstream to close

### buildSBCS

    public CharacterSet buildSBCS(java.lang.String characterSetName,
                                  java.lang.String codePageName,
                                  java.lang.String encoding,
                                  ResourceAccessor accessor,
                                  AFPEventProducer eventProducer)
                           throws java.io.IOException

  Load the font details and metrics into the CharacterSetMetric object, this will use the actual afp code page and character set files to load the object with the necessary metrics.

  Parameters:
    `characterSetName` - name of the characterset
    `codePageName` - name of the code page file
    `encoding` - encoding name
    `accessor` - used to load codepage and characterset
    `eventProducer` - for handling AFP related events
  Returns:
    CharacterSet object
  Throws:
    `java.io.IOException` - if an I/O error occurs

### buildDBCS

    public CharacterSet buildDBCS(java.lang.String characterSetName,
                                  java.lang.String codePageName,
                                  java.lang.String encoding,
                                  CharacterSetType charsetType,
                                  ResourceAccessor accessor,
                                  AFPEventProducer eventProducer)
                           throws java.io.IOException

  Load the font details and metrics into the CharacterSetMetric object, this will use the actual afp code page and character set files to load the object with the necessary metrics. This method is to be used for double byte character sets (DBCS).

  Parameters:
    `characterSetName` - name of the characterset
    `codePageName` - name of the code page file
    `encoding` - encoding name
    `charsetType` - the characterset type
    `accessor` - used to load codepage and characterset
    `eventProducer` - for handling AFP related events
  Returns:
    CharacterSet object
  Throws:
    `java.io.IOException` - if an I/O error occurs

### build

    public CharacterSet build(java.lang.String characterSetName,
                              java.lang.String codePageName,
                              java.lang.String encoding,
                              Typeface typeface,
                              AFPEventProducer eventProducer)
                       throws java.io.IOException

  Load the font details and metrics into the CharacterSetMetric object, this will use the actual afp code page and character set files to load the object with the necessary metrics.

  Parameters:
    `characterSetName` - the CharacterSetMetric object to populate
    `codePageName` - the name of the code page to use
    `encoding` - name of the encoding in use
    `typeface` - base14 font name
    `eventProducer` - for handling AFP related events
  Returns:
    CharacterSet object
  Throws:
    `java.io.IOException` - if an I/O error occurs

### loadCodePage

    protected java.util.Map<java.lang.String,java.lang.String> loadCodePage(java.lang.String codePage,
                                                                            java.lang.String encoding,
                                                                            ResourceAccessor accessor,
                                                                            AFPEventProducer eventProducer)
                                                                     throws java.io.IOException

  Load the code page information from the appropriate file. The file name to load is determined by the code page name and the file extension 'CDP'.

  Parameters:
    `codePage` - the code page identifier
    `encoding` - the encoding to use for the character decoding
    `accessor` - the resource accessor
    `eventProducer` - for handling AFP related events
  Returns:
    a code page mapping (key: GCGID, value: Unicode character)
  Throws:
    `java.io.IOException` - if an I/O exception of some sort has occurred.

### processFontDescriptor

    protected static org.apache.fop.afp.fonts.CharacterSetBuilder.FontDescriptor processFontDescriptor(StructuredFieldReader structuredFieldReader)
                                                                                                throws java.io.IOException

  Process the font descriptor details using the structured field reader.

  Parameters:
    `structuredFieldReader` - the structured field reader
  Returns:
    a class representing the font descriptor
  Throws:
    `java.io.IOException` - if an I/O exception of some sort has occurred.

### processFontControl

    protected org.apache.fop.afp.fonts.CharacterSetBuilder.FontControl processFontControl(StructuredFieldReader structuredFieldReader)
                                                                                   throws java.io.IOException

  Process the font control details using the structured field reader.

  Parameters:
    `structuredFieldReader` - the structured field reader
  Returns:
    the FontControl
  Throws:
    `java.io.IOException` - if an I/O exception of some sort has occurred.

### processFontOrientation

    protected CharacterSetOrientation[] processFontOrientation(StructuredFieldReader structuredFieldReader)
                                                        throws java.io.IOException

  Process the font orientation details from using the structured field reader.

  Parameters:
    `structuredFieldReader` - the structured field reader
  Returns:
    CharacterSetOrientation array
  Throws:
    `java.io.IOException` - if an I/O exception of some sort has occurred.

### processFontPosition

    protected void processFontPosition(StructuredFieldReader structuredFieldReader,
                                       CharacterSetOrientation[] characterSetOrientations,
                                       double metricNormalizationFactor)
                                throws java.io.IOException

  Populate the CharacterSetOrientation object in the suplied array with the font position details using the supplied structured field reader.

  Parameters:
    `structuredFieldReader` - the structured field reader
    `characterSetOrientations` - the array of CharacterSetOrientation objects
    `metricNormalizationFactor` - factor to apply to the metrics to get normalized font metric values
  Throws:
    `java.io.IOException` - if an I/O exception of some sort has occurred.

### processFontIndex

    protected void processFontIndex(StructuredFieldReader structuredFieldReader,
                                    CharacterSetOrientation cso,
                                    java.util.Map<java.lang.String,java.lang.String> codepage,
                                    double metricNormalizationFactor)
                             throws java.io.IOException

  Process the font index details for the character set orientation.

  Parameters:
    `structuredFieldReader` - the structured field reader
    `cso` - the CharacterSetOrientation object to populate
    `codepage` - the map of code pages
    `metricNormalizationFactor` - factor to apply to the metrics to get normalized font metric values
  Throws:
    `java.io.IOException` - if an I/O exception of some sort has occurred.

fop 1.1

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