org.apache.fop.pdf

## Class PDFCMap

- java.lang.Object
- - org.apache.fop.pdf.PDFObject
  - - org.apache.fop.pdf.AbstractPDFStream
    - - org.apache.fop.pdf.PDFStream
      - - org.apache.fop.pdf.PDFCMap

All Implemented Interfaces:
  PDFWritable

Direct Known Subclasses:
  PDFToUnicodeCMap

    public class PDFCMap
    extends PDFStream

Class representing the CMap encodings. CMaps are defined in the "Predefined CJK CMap names" table. In section 5.6.4 of PDF reference 1.4.

### Field Summary

Fields
`protected Object` `base` base CMap (String or PDFStream)
`static String` `ENC_83PV_RKSJ_H` 83pv-RKSJ-H Mac OS, JIS X 0208 character set with KanjiTalk6 extensions, Shift-JIS encoding, Script Manager code 1
`static String` `ENC_90MS_RKSJ_H` 90ms-RKSJ-H Microsoft Code Page 932 (lfCharSet 0x80), JIS X 0208 character set with NEC and IBM extensions
`static String` `ENC_90MS_RKSJ_V` 90ms-RKSJ-V Vertical version of 90ms-RKSJ-H
`static String` `ENC_90MSP_RKSJ_H` 90msp-RKSJ-H Same as 90ms-RKSJ-H, but replaces half-width Latin characters with proportional forms
`static String` `ENC_90MSP_RKSJ_V` 90msp-RKSJ-V Vertical version of 90msp-RKSJ-H
`static String` `ENC_90PV_RKSJ_H` 90pv-RKSJ-H Mac OS, JIS X 0208 character set with KanjiTalk7 extensions, Shift-JIS encoding, Script Manager code 1
`static String` `ENC_ADD_RKSJ_H` Add-RKSJ-H JIS X 0208 character set with Fujitsu FMR extensions, Shift-JIS encoding
`static String` `ENC_ADD_RKSJ_V` Add-RKSJ-V Vertical version of Add-RKSJ-H
`static String` `ENC_B5PC_H` B5pc-H Mac OS, Big Five character set, Big Five encoding, Script Manager code 2
`static String` `ENC_B5PC_V` B5pc-V Vertical version of B5pc-H
`static String` `ENC_CNS_EUC_H` CNS-EUC-H CNS 11643-1992 character set, EUC-TW encoding
`static String` `ENC_CNS_EUC_V` CNS-EUC-V Vertical version of CNS-EUC-H
`static String` `ENC_ETEN_B5_H` ETen-B5-H Microsoft Code Page 950 (lfCharSet 0x88), Big Five character set with ETen extensions
`static String` `ENC_ETEN_B5_V` ETen-B5-V Vertical version of ETen-B5-H
`static String` `ENC_ETENMS_B5_H` ETenms-B5-H Same as ETen-B5-H, but replaces half-width Latin characters with proportional forms
`static String` `ENC_ETENMS_B5_V` ETenms-B5-V Vertical version of ETenms-B5-H
`static String` `ENC_EUC_H` EUC-H JIS X 0208 character set, EUC-JP encoding
`static String` `ENC_EUC_V` EUC-V Vertical version of EUC-H
`static String` `ENC_EXT_RKSJ_H` Ext-RKSJ-H JIS C 6226 (JIS78) character set with NEC extensions, Shift-JIS encoding
`static String` `ENC_EXT_RKSJ_V` Ext-RKSJ-V Vertical version of Ext-RKSJ-H
`static String` `ENC_GB_EUC_H` GB-EUC-H Microsoft Code Page 936 (lfCharSet 0x86), GB 2312-80 character set, EUC-CN encoding
`static String` `ENC_GB_EUC_V` GB-EUC-V Vertical version of GB-EUC-H
`static String` `ENC_GBK_EUC_H` GBK-EUC-H Microsoft Code Page 936 (lfCharSet 0x86), GBK character set, GBK encoding
`static String` `ENC_GBK_EUC_V` GBK-EUC-V Vertical version of GBK-EUC-H
`static String` `ENC_GBK2K_H` GBK2K-H GB 18030-2000 character set, mixed 1-, 2-, and 4-byte encoding
`static String` `ENC_GBK2K_V` GBK2K-V Vertical version of GBK2K-H
`static String` `ENC_GBKP_EUC_H` GBKp-EUC-H Same as GBK-EUC-H, but replaces half-width Latin characters with proportional forms and maps character code 0x24 to a dollar sign ($) instead of a yuan symbol
`static String` `ENC_GBKP_EUC_V` GBKp-EUC-V Vertical version of GBKp-EUC-H
`static String` `ENC_GBPC_EUC_H` GBpc-EUC-H Mac OS, GB 2312-80 character set, EUC-CN encoding, Script Manager code 19
`static String` `ENC_GBPC_EUC_V` GBpc-EUC-V Vertical version of GBpc-EUC-H
`static String` `ENC_H` H JIS X 0208 character set, ISO-2022-JP encoding
`static String` `ENC_HKSCS_B5_H` HKscs-B5-H Hong Kong SCS, an extension to the Big Five character set and encoding
`static String` `ENC_HKSCS_B5_V` HKscs-B5-V Vertical version of HKscs-B5-H
`static String` `ENC_IDENTITY_H` Identity-H The horizontal identity mapping for 2-byte CIDs; may be used with CIDFonts using any Registry, Ordering, and Supplement values.
`static String` `ENC_IDENTTITY_V` Identity-V Vertical version of Identity-H.
`static String` `ENC_KSC_EUC_H` KSC-EUC-H KS X 1001:1992 character set, EUC-KR encoding
`static String` `ENC_KSC_EUC_V` KSC-EUC-V Vertical version of KSC-EUC-H
`static String` `ENC_KSCMS_UHC_H` KSCms-UHC-H Microsoft Code Page 949 (lfCharSet 0x81), KS X 1001:1992 character set plus 8822 additional hangul, Unified Hangul Code (UHC) encoding
`static String` `ENC_KSCMS_UHC_HW_H` KSCms-UHC-HW-H Same as KSCms-UHC-H, but replaces proportional Latin characters with half-width forms
`static String` `ENC_KSCMS_UHC_HW_V` KSCms-UHC-HW-V Vertical version of KSCms-UHC-HW-H
`static String` `ENC_KSCMS_UHC_V` KSCms-UHC-V Vertical version of KSCms-UHC-H
`static String` `ENC_KSCPC_EUC_H` KSCpc-EUC-H Mac OS, KS X 1001:1992 character set with Mac OS KH extensions, Script Manager Code 3
`static String` `ENC_UNICNS_UCS2_H` UniCNS-UCS2-H Unicode (UCS-2) encoding for the Adobe-CNS1 character collection
`static String` `ENC_UNICNS_UCS2_V` UniCNS-UCS2-V Vertical version of UniCNS-UCS2-H
`static String` `ENC_UNIGB_UCS2_H` UniGB-UCS2-H Unicode (UCS-2) encoding for the Adobe-GB1 character collection
`static String` `ENC_UNIGB_UCS2_V` UniGB-UCS2-V Vertical version of UniGB-UCS2-H
`static String` `ENC_UNIJIS_UCS2_H` UniJIS-UCS2-H Unicode (UCS-2) encoding for the Adobe-Japan1 character collection
`static String` `ENC_UNIJIS_UCS2_HW_H` UniJIS-UCS2-HW-H Same as UniJIS-UCS2-H, but replaces proportional Latin characters with half-width forms
`static String` `ENC_UNIJIS_UCS2_HW_V` UniJIS-UCS2-HW-V Vertical version of UniJIS-UCS2-HW-H
`static String` `ENC_UNIJIS_UCS2_V` UniJIS-UCS2-V Vertical version of UniJIS-UCS2-H
`static String` `ENC_UNIKSC_UCS2_H` UniKS-UCS2-H Unicode (UCS-2) encoding for the Adobe-Korea1 character collection
`static String` `ENC_UNIKSC_UCS2_V` UniKS-UCS2-V Vertical version of UniKS-UCS2-H
`static String` `ENC_V` V Vertical version of H
`protected String` `name` /CMapName attribute, one of the predefined constants
`protected PDFCIDSystemInfo` `sysInfo` /CIDSystemInfo attribute
`protected byte` `wMode` font's writing direction
`static byte` `WMODE_HORIZONTAL` horizontal writing direction
`static byte` `WMODE_VERTICAL` vertical writing direction

### Fields inherited from class org.apache.fop.pdf.PDFStream

`data`

### Fields inherited from class org.apache.fop.pdf.PDFObject

`log`

### Constructor Summary

Constructors
Constructor and Description
`PDFCMap(String name, PDFCIDSystemInfo sysInfo)` create the /CMap object

### Method Summary

All Methods Instance Methods Concrete Methods
`protected CMapBuilder` `createCMapBuilder(Writer writer)` Creates the CMapBuilder that will build the CMap's content.
`int` `output(OutputStream stream)` Overload the base object method so we don't have to copy byte arrays around so much Write the PDF represention of this object
`void` `setUseCMap(PDFStream base)` set the base CMap
`void` `setUseCMap(String base)` set the base CMap
`void` `setWMode(byte mode)` set the writing direction

### Methods inherited from class org.apache.fop.pdf.PDFStream

`add, add, getBufferOutputStream, getBufferWriter, getDataLength, getSizeHint, outputRawStreamData, setData, streamHashCode`

### Methods inherited from class org.apache.fop.pdf.AbstractPDFStream

`encodeAndWriteStream, encodeStream, get, getChildren, getDefaultFilterName, getDictionary, getFilterList, multipleFiltersAllowed, outputStreamData, populateStreamDict, prepareImplicitFilters, put, registerChildren, setDocument, setupFilterList, supportsObjectStream`

### Methods inherited from class org.apache.fop.pdf.PDFObject

`contentEquals, encode, encodeBinaryToHexString, encodeString, encodeText, formatObject, getDocument, getDocumentSafely, getGeneration, getObjectID, getObjectNumber, getParent, hasObjectNumber, makeReference, outputInline, referencePDF, setObjectNumber, setObjectNumber, setObjectNumber, setParent, toPDF, toPDFString`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### ENC_GB_EUC_H

    public static final String ENC_GB_EUC_H

GB-EUC-H Microsoft Code Page 936 (lfCharSet 0x86), GB 2312-80 character set, EUC-CN encoding

See Also:
  Constant Field Values

#### ENC_GB_EUC_V

    public static final String ENC_GB_EUC_V

GB-EUC-V Vertical version of GB-EUC-H

See Also:
  Constant Field Values

#### ENC_GBPC_EUC_H

    public static final String ENC_GBPC_EUC_H

GBpc-EUC-H Mac OS, GB 2312-80 character set, EUC-CN encoding, Script Manager code 19

See Also:
  Constant Field Values

#### ENC_GBPC_EUC_V

    public static final String ENC_GBPC_EUC_V

GBpc-EUC-V Vertical version of GBpc-EUC-H

See Also:
  Constant Field Values

#### ENC_GBK_EUC_H

    public static final String ENC_GBK_EUC_H

GBK-EUC-H Microsoft Code Page 936 (lfCharSet 0x86), GBK character set, GBK encoding

See Also:
  Constant Field Values

#### ENC_GBK_EUC_V

    public static final String ENC_GBK_EUC_V

GBK-EUC-V Vertical version of GBK-EUC-H

See Also:
  Constant Field Values

#### ENC_GBKP_EUC_H

    public static final String ENC_GBKP_EUC_H

GBKp-EUC-H Same as GBK-EUC-H, but replaces half-width Latin characters with proportional forms and maps character code 0x24 to a dollar sign ($) instead of a yuan symbol

See Also:
  Constant Field Values

#### ENC_GBKP_EUC_V

    public static final String ENC_GBKP_EUC_V

GBKp-EUC-V Vertical version of GBKp-EUC-H

See Also:
  Constant Field Values

#### ENC_GBK2K_H

    public static final String ENC_GBK2K_H

GBK2K-H GB 18030-2000 character set, mixed 1-, 2-, and 4-byte encoding

See Also:
  Constant Field Values

#### ENC_GBK2K_V

    public static final String ENC_GBK2K_V

GBK2K-V Vertical version of GBK2K-H

See Also:
  Constant Field Values

#### ENC_UNIGB_UCS2_H

    public static final String ENC_UNIGB_UCS2_H

UniGB-UCS2-H Unicode (UCS-2) encoding for the Adobe-GB1 character collection

See Also:
  Constant Field Values

#### ENC_UNIGB_UCS2_V

    public static final String ENC_UNIGB_UCS2_V

UniGB-UCS2-V Vertical version of UniGB-UCS2-H

See Also:
  Constant Field Values

#### ENC_B5PC_H

    public static final String ENC_B5PC_H

B5pc-H Mac OS, Big Five character set, Big Five encoding, Script Manager code 2

See Also:
  Constant Field Values

#### ENC_B5PC_V

    public static final String ENC_B5PC_V

B5pc-V Vertical version of B5pc-H

See Also:
  Constant Field Values

#### ENC_HKSCS_B5_H

    public static final String ENC_HKSCS_B5_H

HKscs-B5-H Hong Kong SCS, an extension to the Big Five character set and encoding

See Also:
  Constant Field Values

#### ENC_HKSCS_B5_V

    public static final String ENC_HKSCS_B5_V

HKscs-B5-V Vertical version of HKscs-B5-H

See Also:
  Constant Field Values

#### ENC_ETEN_B5_H

    public static final String ENC_ETEN_B5_H

ETen-B5-H Microsoft Code Page 950 (lfCharSet 0x88), Big Five character set with ETen extensions

See Also:
  Constant Field Values

#### ENC_ETEN_B5_V

    public static final String ENC_ETEN_B5_V

ETen-B5-V Vertical version of ETen-B5-H

See Also:
  Constant Field Values

#### ENC_ETENMS_B5_H

    public static final String ENC_ETENMS_B5_H

ETenms-B5-H Same as ETen-B5-H, but replaces half-width Latin characters with proportional forms

See Also:
  Constant Field Values

#### ENC_ETENMS_B5_V

    public static final String ENC_ETENMS_B5_V

ETenms-B5-V Vertical version of ETenms-B5-H

See Also:
  Constant Field Values

#### ENC_CNS_EUC_H

    public static final String ENC_CNS_EUC_H

CNS-EUC-H CNS 11643-1992 character set, EUC-TW encoding

See Also:
  Constant Field Values

#### ENC_CNS_EUC_V

    public static final String ENC_CNS_EUC_V

CNS-EUC-V Vertical version of CNS-EUC-H

See Also:
  Constant Field Values

#### ENC_UNICNS_UCS2_H

    public static final String ENC_UNICNS_UCS2_H

UniCNS-UCS2-H Unicode (UCS-2) encoding for the Adobe-CNS1 character collection

See Also:
  Constant Field Values

#### ENC_UNICNS_UCS2_V

    public static final String ENC_UNICNS_UCS2_V

UniCNS-UCS2-V Vertical version of UniCNS-UCS2-H

See Also:
  Constant Field Values

#### ENC_83PV_RKSJ_H

    public static final String ENC_83PV_RKSJ_H

83pv-RKSJ-H Mac OS, JIS X 0208 character set with KanjiTalk6 extensions, Shift-JIS encoding, Script Manager code 1

See Also:
  Constant Field Values

#### ENC_90MS_RKSJ_H

    public static final String ENC_90MS_RKSJ_H

90ms-RKSJ-H Microsoft Code Page 932 (lfCharSet 0x80), JIS X 0208 character set with NEC and IBM extensions

See Also:
  Constant Field Values

#### ENC_90MS_RKSJ_V

    public static final String ENC_90MS_RKSJ_V

90ms-RKSJ-V Vertical version of 90ms-RKSJ-H

See Also:
  Constant Field Values

#### ENC_90MSP_RKSJ_H

    public static final String ENC_90MSP_RKSJ_H

90msp-RKSJ-H Same as 90ms-RKSJ-H, but replaces half-width Latin characters with proportional forms

See Also:
  Constant Field Values

#### ENC_90MSP_RKSJ_V

    public static final String ENC_90MSP_RKSJ_V

90msp-RKSJ-V Vertical version of 90msp-RKSJ-H

See Also:
  Constant Field Values

#### ENC_90PV_RKSJ_H

    public static final String ENC_90PV_RKSJ_H

90pv-RKSJ-H Mac OS, JIS X 0208 character set with KanjiTalk7 extensions, Shift-JIS encoding, Script Manager code 1

See Also:
  Constant Field Values

#### ENC_ADD_RKSJ_H

    public static final String ENC_ADD_RKSJ_H

Add-RKSJ-H JIS X 0208 character set with Fujitsu FMR extensions, Shift-JIS encoding

See Also:
  Constant Field Values

#### ENC_ADD_RKSJ_V

    public static final String ENC_ADD_RKSJ_V

Add-RKSJ-V Vertical version of Add-RKSJ-H

See Also:
  Constant Field Values

#### ENC_EUC_H

    public static final String ENC_EUC_H

EUC-H JIS X 0208 character set, EUC-JP encoding

See Also:
  Constant Field Values

#### ENC_EUC_V

    public static final String ENC_EUC_V

EUC-V Vertical version of EUC-H

See Also:
  Constant Field Values

#### ENC_EXT_RKSJ_H

    public static final String ENC_EXT_RKSJ_H

Ext-RKSJ-H JIS C 6226 (JIS78) character set with NEC extensions, Shift-JIS encoding

See Also:
  Constant Field Values

#### ENC_EXT_RKSJ_V

    public static final String ENC_EXT_RKSJ_V

Ext-RKSJ-V Vertical version of Ext-RKSJ-H

See Also:
  Constant Field Values

#### ENC_H

    public static final String ENC_H

H JIS X 0208 character set, ISO-2022-JP encoding

See Also:
  Constant Field Values

#### ENC_V

    public static final String ENC_V

V Vertical version of H

See Also:
  Constant Field Values

#### ENC_UNIJIS_UCS2_H

    public static final String ENC_UNIJIS_UCS2_H

UniJIS-UCS2-H Unicode (UCS-2) encoding for the Adobe-Japan1 character collection

See Also:
  Constant Field Values

#### ENC_UNIJIS_UCS2_V

    public static final String ENC_UNIJIS_UCS2_V

UniJIS-UCS2-V Vertical version of UniJIS-UCS2-H

See Also:
  Constant Field Values

#### ENC_UNIJIS_UCS2_HW_H

    public static final String ENC_UNIJIS_UCS2_HW_H

UniJIS-UCS2-HW-H Same as UniJIS-UCS2-H, but replaces proportional Latin characters with half-width forms

See Also:
  Constant Field Values

#### ENC_UNIJIS_UCS2_HW_V

    public static final String ENC_UNIJIS_UCS2_HW_V

UniJIS-UCS2-HW-V Vertical version of UniJIS-UCS2-HW-H

See Also:
  Constant Field Values

#### ENC_KSC_EUC_H

    public static final String ENC_KSC_EUC_H

KSC-EUC-H KS X 1001:1992 character set, EUC-KR encoding

See Also:
  Constant Field Values

#### ENC_KSC_EUC_V

    public static final String ENC_KSC_EUC_V

KSC-EUC-V Vertical version of KSC-EUC-H

See Also:
  Constant Field Values

#### ENC_KSCMS_UHC_H

    public static final String ENC_KSCMS_UHC_H

KSCms-UHC-H Microsoft Code Page 949 (lfCharSet 0x81), KS X 1001:1992 character set plus 8822 additional hangul, Unified Hangul Code (UHC) encoding

See Also:
  Constant Field Values

#### ENC_KSCMS_UHC_V

    public static final String ENC_KSCMS_UHC_V

KSCms-UHC-V Vertical version of KSCms-UHC-H

See Also:
  Constant Field Values

#### ENC_KSCMS_UHC_HW_H

    public static final String ENC_KSCMS_UHC_HW_H

KSCms-UHC-HW-H Same as KSCms-UHC-H, but replaces proportional Latin characters with half-width forms

See Also:
  Constant Field Values

#### ENC_KSCMS_UHC_HW_V

    public static final String ENC_KSCMS_UHC_HW_V

KSCms-UHC-HW-V Vertical version of KSCms-UHC-HW-H

See Also:
  Constant Field Values

#### ENC_KSCPC_EUC_H

    public static final String ENC_KSCPC_EUC_H

KSCpc-EUC-H Mac OS, KS X 1001:1992 character set with Mac OS KH extensions, Script Manager Code 3

See Also:
  Constant Field Values

#### ENC_UNIKSC_UCS2_H

    public static final String ENC_UNIKSC_UCS2_H

UniKS-UCS2-H Unicode (UCS-2) encoding for the Adobe-Korea1 character collection

See Also:
  Constant Field Values

#### ENC_UNIKSC_UCS2_V

    public static final String ENC_UNIKSC_UCS2_V

UniKS-UCS2-V Vertical version of UniKS-UCS2-H

See Also:
  Constant Field Values

#### ENC_IDENTITY_H

    public static final String ENC_IDENTITY_H

Identity-H The horizontal identity mapping for 2-byte CIDs; may be used with CIDFonts using any Registry, Ordering, and Supplement values. It maps 2-byte character codes ranging from 0 to 65,535 to the same 2-byte CID value, interpreted high-order byte first.

See Also:
  Constant Field Values

#### ENC_IDENTTITY_V

    public static final String ENC_IDENTTITY_V

Identity-V Vertical version of Identity-H. The mapping is the same as for Identity-H.

See Also:
  Constant Field Values

#### name

    protected String name

/CMapName attribute, one of the predefined constants

#### sysInfo

    protected PDFCIDSystemInfo sysInfo

/CIDSystemInfo attribute

#### WMODE_HORIZONTAL

    public static final byte WMODE_HORIZONTAL

horizontal writing direction

See Also:
  Constant Field Values

#### WMODE_VERTICAL

    public static final byte WMODE_VERTICAL

vertical writing direction

See Also:
  Constant Field Values

#### wMode

    protected byte wMode

font's writing direction

#### base

    protected Object base

base CMap (String or PDFStream)

### Constructor Detail

#### PDFCMap

    public PDFCMap(String name,
                   PDFCIDSystemInfo sysInfo)

create the /CMap object

Parameters:
  `name` - one the registered names (see Table 7.20 on p 215)
  `sysInfo` - the attributes of the character collection of the CIDFont

### Method Detail

#### setWMode

    public void setWMode(byte mode)

set the writing direction

Parameters:
  `mode` - is either `WMODE_HORIZONTAL` or `WMODE_VERTICAL`

#### setUseCMap

    public void setUseCMap(String base)

set the base CMap

Parameters:
  `base` - the name of the base CMap

#### setUseCMap

    public void setUseCMap(PDFStream base)

set the base CMap

Parameters:
  `base` - the stream to be used as base CMap

#### createCMapBuilder

    protected CMapBuilder createCMapBuilder(Writer writer)

Creates the CMapBuilder that will build the CMap's content.

Parameters:
  `writer` - a Writer to write the CMap's contents to
Returns:
  the newly created CMapBuilder

#### output

    public int output(OutputStream stream)
               throws IOException

Overload the base object method so we don't have to copy byte arrays around so much Write the PDF represention of this object

Overrides:
  `output` in class `PDFStream`
Parameters:
  `stream` - the stream to write the PDF to
Returns:
  the number of bytes written
Throws:
  `IOException` - if there is an error writing to the stream