Haru Free PDF Library
Encoding handling

Functions

HPDF_Encoder HPDF_GetEncoder (HPDF_Doc pdf, const char *encoding_name)
 Get encoder object handle by specified encoding name. More...
 
HPDF_Encoder HPDF_GetCurrentEncoder (HPDF_Doc pdf)
 Get current encoder handle of document object. More...
 
HPDF_STATUS HPDF_SetCurrentEncoder (HPDF_Doc pdf, const char *encoding_name)
 Set current encoder for document. More...
 
HPDF_EncoderType HPDF_Encoder_GetType (HPDF_Encoder encoder)
 Get encoder object type. More...
 
HPDF_ByteType HPDF_Encoder_GetByteType (HPDF_Encoder encoder, const char *text, HPDF_UINT index)
 Get byte type of a text char at index position. More...
 
HPDF_UNICODE HPDF_Encoder_GetUnicode (HPDF_Encoder encoder, HPDF_UINT16 code)
 Convert a specified character code to Unicode value. More...
 
HPDF_WritingMode HPDF_Encoder_GetWritingMode (HPDF_Encoder encoder)
 Get writing mode for the encoding object. More...
 
HPDF_STATUS HPDF_UseJPEncodings (HPDF_Doc pdf)
 Enable Japanese encodings. More...
 
HPDF_STATUS HPDF_UseKREncodings (HPDF_Doc pdf)
 Enable Korean encodings. More...
 
HPDF_STATUS HPDF_UseCNSEncodings (HPDF_Doc pdf)
 Enable simplified Chinese encodings. More...
 
HPDF_STATUS HPDF_UseCNTEncodings (HPDF_Doc pdf)
 Enable traditional Chinese encodings. More...
 
HPDF_STATUS HPDF_UseUTFEncodings (HPDF_Doc pdf)
 Enable UTF-8 encoding. More...
 

Detailed Description

Routines for working with texts and characters in different encodings

Function Documentation

◆ HPDF_Encoder_GetByteType()

HPDF_ByteType HPDF_Encoder_GetByteType ( HPDF_Encoder  encoder,
const char *  text,
HPDF_UINT  index 
)

Get byte type of a text char at index position.

Parameters
encoderEncoder object handle.
textText to analyze.
indexCharacter index.
Returns
Character byte type value.
See also
_HPDF_ByteType
Examples
character_map.c.

◆ HPDF_Encoder_GetType()

HPDF_EncoderType HPDF_Encoder_GetType ( HPDF_Encoder  encoder)

Get encoder object type.

Parameters
encoderEncoder object handle.
Returns
Encoder object type value.
See also
_HPDF_EncoderType
Examples
character_map.c.

◆ HPDF_Encoder_GetUnicode()

HPDF_UNICODE HPDF_Encoder_GetUnicode ( HPDF_Encoder  encoder,
HPDF_UINT16  code 
)

Convert a specified character code to Unicode value.

Parameters
encoderEncoder object handle.
codeCharacter code to convert.
Returns
Character Unicode value.
Examples
character_map.c.

◆ HPDF_Encoder_GetWritingMode()

HPDF_WritingMode HPDF_Encoder_GetWritingMode ( HPDF_Encoder  encoder)

Get writing mode for the encoding object.

Parameters
encoderEncoder object handle.
Returns
Encoder writing mode value.
See also
_HPDF_WritingMode

◆ HPDF_GetCurrentEncoder()

HPDF_Encoder HPDF_GetCurrentEncoder ( HPDF_Doc  pdf)

Get current encoder handle of document object.

The current encoder is set by invoking HPDF_SetCurrentEncoder() and it is used to processing a text when application calls HPDF_Info_SetInfoAttr().

The default value is NULL.

Parameters
pdfDocument object handle.
Returns
Encoder object handle or NULL.
See also
HPDF_Info_SetInfoAttr()

◆ HPDF_GetEncoder()

HPDF_Encoder HPDF_GetEncoder ( HPDF_Doc  pdf,
const char *  encoding_name 
)

Get encoder object handle by specified encoding name.

Parameters
pdfDocument object handle.
encoding_nameValid encoding name
Returns
Encoder object handle on success, otherwise, it returns NULL and call error handler
Error codes
Examples
character_map.c, outline_demo.c, outline_demo_jp.c, and text_annotation.c.

◆ HPDF_SetCurrentEncoder()

HPDF_STATUS HPDF_SetCurrentEncoder ( HPDF_Doc  pdf,
const char *  encoding_name 
)

Set current encoder for document.

Parameters
pdfDocument object handle.
encoding_nameValid encoding name
Returns
Encoder object handle on success, otherwise returns NULL and calls error handler.
Error codes
Examples
utf8.c.

◆ HPDF_UseCNSEncodings()

HPDF_STATUS HPDF_UseCNSEncodings ( HPDF_Doc  pdf)

Enable simplified Chinese encodings.

Application can following simplified Chinese encodings after HPDF_UseCNSEncodings() call:

Encoding
GB-EUC-H
GB-EUC-V
GBK-EUC-H
GBK-EUC-V
Parameters
pdfDocument object handle.
Returns
HPDF_OK on success, otherwise returns error code and calls error handler.
Error codes
Examples
character_map.c, and chfont_demo.c.

◆ HPDF_UseCNTEncodings()

HPDF_STATUS HPDF_UseCNTEncodings ( HPDF_Doc  pdf)

Enable traditional Chinese encodings.

Application can following traditional Chinese encodings after HPDF_UseCNTEncodings() call:

Encoding
GB-EUC-H
GB-EUC-V
GBK-EUC-H
GBK-EUC-V
Parameters
pdfDocument object handle.
Returns
HPDF_OK on success, otherwise returns error code and calls error handler.
Error codes
Examples
character_map.c.

◆ HPDF_UseJPEncodings()

HPDF_STATUS HPDF_UseJPEncodings ( HPDF_Doc  pdf)

Enable Japanese encodings.

Application can following Japanese encodings after HPDF_UseJPEncodings() call:

Encoding
90ms-RKSJ-H
90ms-RKSJ-V
90msp-RKSJ-H
EUC-H
EUC-V
Parameters
pdfDocument object handle.
Returns
HPDF_OK on success, otherwise returns error code and calls error handler.
Error codes
Examples
character_map.c, chfont_demo.c, jpfont_demo.c, outline_demo_jp.c, and ttfont_demo_jp.c.

◆ HPDF_UseKREncodings()

HPDF_STATUS HPDF_UseKREncodings ( HPDF_Doc  pdf)

Enable Korean encodings.

Application can following Korean encodings after HPDF_UseKREncodings() call:

Encoding
KSC-EUC-H
KSC-EUC-V
KSCms-UHC-H
KSCms-UHC-HW-H
KSCms-UHC-HW-V
Parameters
pdfDocument object handle.
Returns
HPDF_OK on success, otherwise returns error code and calls error handler.
Error codes
Examples
character_map.c.

◆ HPDF_UseUTFEncodings()

HPDF_STATUS HPDF_UseUTFEncodings ( HPDF_Doc  pdf)

Enable UTF-8 encoding.

Application can include UTF-8 encoded Unicode text (up to 3-byte UTF-8 sequences).

Note
UTF-8 encoding works only with TrueType fonts.
Parameters
pdfDocument object handle.
Returns
HPDF_OK on success, otherwise returns error code and calls error handler.
Error codes
Examples
utf8.c.