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.
Parameter | Description |
---|---|
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:
|
unicode_flags |
See txTextMakeViaStream. |
area |
See txTextMakeViaStream. |
text_attribs |
See txTextMakeViaStream. |
fontmap_sd |
See txTextMakeViaStream. |
If the Unicode text document was built successfully, the return value will be the number of its characters. Otherwise, the function returns -1.
txTextIniViaBuffer
txTextMakeViaStream, txTextMakeViaPowerDoc