fop 1.1

## org.apache.fop.fonts
Class AbstractCodePointMapping

    java.lang.Object
      org.apache.fop.fonts.AbstractCodePointMapping

All Implemented Interfaces:
  SingleByteEncoding

Direct Known Subclasses:
  CodePointMapping

    public class AbstractCodePointMapping

extends java.lang.Object
implements SingleByteEncoding

Abstract base class for code point mapping classes (1-byte character encodings).

Field Summary

Fields inherited from interface org.apache.fop.fonts.SingleByteEncoding
`NOT_FOUND_CODE_POINT`

Constructor Summary
`AbstractCodePointMapping(java.lang.String name, int[] table)` Main constructor.
`AbstractCodePointMapping(java.lang.String name, int[] table, java.lang.String[] charNameMap)` Extended constructor.

Method Summary
`protected void` `buildFromTable(int[] table)` Builds the internal lookup structures based on a given table.
`java.lang.String[]` `getCharNameMap()` Returns the array of character names for this encoding.
`short` `getCodePointForGlyph(java.lang.String charName)` Returns the index of a character/glyph with the given name.
`java.lang.String` `getName()` Returns the encoding's name.
`char[]` `getUnicodeCharMap()` Returns a character array with Unicode scalar values which can be used to map encoding code points to Unicode values.
`char` `getUnicodeForIndex(int idx)` Returns the main Unicode value that is associated with the given code point in the encoding.
`char` `mapChar(char c)` Maps a Unicode character to a code point in the encoding.
`java.lang.String` `toString()`

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

Constructor Detail

### AbstractCodePointMapping

    public AbstractCodePointMapping(java.lang.String name,
                                    int[] table)

  Main constructor.

  Parameters:
    `name` - the name of the encoding
    `table` - the table ([code point, unicode scalar value]+) with the mapping

### AbstractCodePointMapping

    public AbstractCodePointMapping(java.lang.String name,
                                    int[] table,
                                    java.lang.String[] charNameMap)

  Extended constructor.

  Parameters:
    `name` - the name of the encoding
    `table` - the table ([code point, unicode scalar value]+) with the mapping
    `charNameMap` - all character names in the encoding (a value of null will be converted to ".notdef")

Method Detail

### buildFromTable

    protected void buildFromTable(int[] table)

  Builds the internal lookup structures based on a given table.

  Parameters:
    `table` - the table ([code point, unicode scalar value]+) with the mapping

### getName

    public java.lang.String getName()

  Returns the encoding's name.

  Specified by:
    `getName` in interface `SingleByteEncoding`
  Returns:
    the name of the encoding

### mapChar

    public final char mapChar(char c)

  Maps a Unicode character to a code point in the encoding.

  Specified by:
    `mapChar` in interface `SingleByteEncoding`
  Parameters:
    `c` - the Unicode character to map
  Returns:
    the code point in the encoding or 0 (=.notdef) if not found

### getUnicodeForIndex

    public final char getUnicodeForIndex(int idx)

  Returns the main Unicode value that is associated with the given code point in the encoding. Note that multiple Unicode values can theoretically be mapped to one code point in the encoding.

  Parameters:
    `idx` - the code point in the encoding
  Returns:
    the Unicode value (or ? (NOT A CHARACTER) if no Unicode value is at that point)

### getUnicodeCharMap

    public final char[] getUnicodeCharMap()

  Returns a character array with Unicode scalar values which can be used to map encoding code points to Unicode values. Note that this does not return all possible Unicode values that the encoding maps.

  Specified by:
    `getUnicodeCharMap` in interface `SingleByteEncoding`
  Returns:
    a character array with Unicode scalar values

### getCodePointForGlyph

    public short getCodePointForGlyph(java.lang.String charName)

  Returns the index of a character/glyph with the given name. Note that this method is relatively slow and should only be used for fallback operations.

  Parameters:
    `charName` - the character name
  Returns:
    the index of the character in the encoding or -1 if it doesn't exist

### getCharNameMap

    public java.lang.String[] getCharNameMap()

  Returns the array of character names for this encoding.

  Specified by:
    `getCharNameMap` in interface `SingleByteEncoding`
  Returns:
    the array of character names (unmapped code points are represented by a ".notdef" value)

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

fop 1.1

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