[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[pdf-devel] Request for a new Text module method: pdf_text_get_printable
From: |
Aleksander Morgado |
Subject: |
[pdf-devel] Request for a new Text module method: pdf_text_get_printable () |
Date: |
Tue, 13 Apr 2010 22:17:06 +0200 |
Hi all,
I filled a new Flyspray task with a new small task to implement a new
Text module API method:
http://www.gnupdf.org/flyspray/index.php?do=details&task_id=116
It's quite a small change, not dangerous and quite useful when playing
with pdf_text_t objects...
Comments welcome!
Details:
When programming with pdf_text_t objects, more than once it makes sense
to actually try to get a printable string of the contents in the
pdf_text_t; a string that can be passed to any printf-like method as
argument for the '%s' format string.
This method may be something like this:
const pdf_char_t *
pdf_text_get_printable (pdf_text_t text);
In GNU/Linux systems, it would return a constant non-modifiable and
NUL-terminated UTF-8 string. In Windows, this could be a NUL-terminated
UTF-16 string to be used in their printf-like methods for UTF-16
strings.
Hints:
* Initially, the printable string is not allocated.
* The first time this pdf_text_get_printable() method is called in a
given pdf_text_t, it will internally setup the proper string contents to
be returned.
* The following times this method is called, and IF the pdf_text_t
contents have not been modified, the same internal string is returned.
* Whenever the contents of the pdf_text_t are modified, the internal
buffer should be freed, so that any new call to pdf_text_get_printable()
will re-create the printable string again with the proper contents.
Once this is implemented, it will be possible to actually print the
pdf_text_t with any of our DEBUG macros, like:
PDF_DEBUG_BASE ("The text object contains: '%s'",
pdf_text_get_printable (text_object));
--
Aleksander
- [pdf-devel] Request for a new Text module method: pdf_text_get_printable (),
Aleksander Morgado <=