Index

C/C++ Functions

txTextMakeViaBuffer

DT_SLONG txTextMakeViaBuffer(DT_TXDOC text_doc, DT_PDENGINE engine, DT_SLONG nr_of_chars, const DT_UBYTE* buffer, DT_ID_SWORD buffer_format, DT_SWORD unicode_flags, const DT_TX_TEXTFLOW_AREA* area, const DT_TX_ATTRIBS text_attribs[], const DT_STREAM_DESC* fontmap_sd)

Short Description: Make text document - via buffer

The txTextMakeViaBuffer function builds a Unicode text document by reading a plain text file stored in a memory buffer. This function optionally performs Unicode's implicit bidirectional reordering algorithm (BiDi) and auto-detects Unicode scripts (such as Latin, Arabic, Thai etc.) so that complex scripts can be shaped properly.

This function must be called once per text document instance, and only after a successful call to txTextIni. Applications that wish to rebuild their Unicode text using this function must first destroy the existing text document instance by calling txTextExt and then create a new one by calling txTextIni.

Parameters

ParameterDescription

text_doc

Handle of the associated text document instance.

engine

Handle of the previously created D-Type Power Engine instance. See the pdEngineIniViaStream function for details on how to initialize D-Type Power Engine.

nr_of_chars

The length of the text, i.e. the number of characters (not bytes) in the memory buffer.

buffer

A valid pointer to a memory buffer in which the plain text file resides.

buffer_format

Format of the text in the memory buffer. Can be one of the following:

TX_BUFFER_FORMAT_1  1   /* 1 byte per character — for ANSI */ 
TX_BUFFER_FORMAT_2  2   /* 2 bytes per character — for UCS2 */ 
TX_BUFFER_FORMAT_3  3   /* 3 bytes per character */ 
TX_BUFFER_FORMAT_4  4   /* 4 bytes per character — for UCS4 */ 

These values have the following meaning:

  • TX_BUFFER_FORMAT_1 indicates that the size of each character in the buffer is 1 byte. All characters have codepoints in the 0 - 255 range.

  • TX_BUFFER_FORMAT_2 indicates that the size of each character in the buffer is 2 bytes (little endian byte ordering). All characters have codepoints in the 0 - 65,535 range.

  • TX_BUFFER_FORMAT_3 indicates that the size of each character in the buffer is 3 bytes (little endian byte ordering). All characters have codepoints in the 0 - 16,777,215 range.

  • TX_BUFFER_FORMAT_4 indicates that the size of each character in the buffer is 4 bytes (little endian byte ordering). All characters have codepoints in the 0 - 4,294,967,295 range.

unicode_flags

See txTextMakeViaStream.

area

See txTextMakeViaStream.

text_attribs

See txTextMakeViaStream.

fontmap_sd

See txTextMakeViaStream.

Return Value

If the Unicode text document was built successfully, the return value will be the number of its characters. Otherwise, the function returns -1.

Comments

See txTextMakeViaStream

Notes

See txTextMakeViaStream

Related Functions

txTextIniViaBuffer
txTextMakeViaStream, txTextMakeViaPowerDoc

 

Index