#include <djv_text.h>
Public Types | |
enum | Type { Invalid = 0, Page = 1, Column = 2, Region = 3, Paragraph = 4, Line = 5, Word = 6, Character = 7 } |
Public Member Functions | |
virtual void | encode (Stream *inStream, const PageInfo &inPageInfo) const =0 |
virtual AutoPtr< Chunk > | encodeTXTzChunk (const PageInfo &inPageInfo) const =0 |
virtual AutoPtr< Chunk > | encodeTXTaChunk (const PageInfo &inPageInfo) const =0 |
virtual Rotation | getRotation () const =0 |
virtual void | setRotation (Rotation inRotation)=0 |
virtual Rect | getMinimumRectRequired () const =0 |
virtual String | getFullText () const =0 |
virtual AutoPtr< TextSearcher > | createTextSearcher () const =0 |
Public Member Functions inherited from Celartem::Referable | |
Referable () | |
void | addRef () const |
void | releaseRef () const |
size_t | getReferenceCount () const |
Static Public Member Functions | |
static AutoPtr< TextZone > | create (const PageInfo &inPageInfo) |
static AutoPtr< TextZone > | create (Type inType=Page) |
static AutoPtr< TextZone > | create (const String &inText, Type inType, ssize_t inLeft, ssize_t inTop, ssize_t inWidth, ssize_t inHeight) |
static AutoPtr< TextZone > | create (const String &inText, Type inType, const Rect &inRect) |
static AutoPtr< TextZone > | decode (Stream *inStream, const PageInfo &inPageInfo) |
static AutoPtr< TextZone > | decode (const Chunk *inChunk, const PageInfo &inPageInfo) |
static Rect | calcUnionRect (const AutoPtr< const TextZone > *inZones, size_t inCount) |
static Rect | calcUnionRect (const AutoPtr< TextZone > *inZones, size_t inCount) |
static Rect | calcUnionRect (const TextZone *const *inZones, size_t inCount) |
Static Public Member Functions inherited from Celartem::Referable | |
static void | dumpDbgAllRefCount () |
Public Attributes | |
Type | type |
The type of the text block. More... | |
Rect | rect |
The rectangle of the text block in pixels. More... | |
String | text |
Text of the text block. More... | |
String | heading |
Heading text. More... | |
SimpleArray< AutoPtr< TextZone > > | children |
Child text blocks. More... | |
This structure represents a text block.
Unlike the DjVu file format, the coordinations used by the structure are all in left-to-right, top-to-bottom order and the origin (0,0) is the left-top most of the image.
Please note that this structure should not be initialized as auto variable; all the instances may be referenced by AutoPtr and you don't have to manage the lifetime. All the instance should be initialized via create function.
This enumeration is used to specify the type of TextZone.
Enumerator | |
---|---|
Invalid |
Invalid; reserved. |
Page |
Page. |
Column |
Column. |
Region |
Region. |
Paragraph |
Paragraph. |
Line |
Line. |
Word |
Word. |
Character |
Character. |
|
static |
Create the instance with the specified parameters.
inText | Text stored in this text block. |
inType | The type of the text block. |
inLeft | Left of the text block in pixels. |
inTop | Top of the text block in pixels. |
inWidth | Width of the text block in pixels. |
inHeight | Height of the text block in pixels. |
|
inlinestatic |
Create the instance with the specified parameters.
inText | Text stored in this text block. |
inType | The type of the text block. |
inRect | The position of the text block. |
|
pure virtual |
Create a new instance of TextSearcher.
|
static |
Decode the DjVu's TXTa
block.
To decode TXTz
chunk, you should firstly decompress the chunk using InflateStream. This method is for advanced purpose and for normal purpose, you had better use decode(const Chunk*).
inStream | The stream which contains TXTa block. |
inPageInfo | The dimensions and rotation status of the page is used during decoding the TXTa string. |
TXTa
block.
|
static |
Decode the DjVu's TXTa
or TXTz
block.
inChunk | The stream which contains TXTa block. |
inPageInfo | The dimensions and rotation status of the page is used during decoding the TXT* string. |
TXT*
block.
|
pure virtual |
Encode the instance to the DjVu's TXTa
block.
This method is for advanced purpose and for normal purpose, you had better use encodeTXTzChunk or encodeTXTaChunk. To encode TXTz
chunk, you should compress the returned data using DeflateStream.
inStream | The stream to write on. |
inPageInfo | The dimensions and rotation status of the page is used during encoding the TXTa string. |
|
pure virtual |
Encode the instance to the DjVu's TXTa
chunk.
inPageInfo | The dimensions and rotation status of the page is used during encoding the TXTa string. |
TXTa
Chunk.
|
pure virtual |
Encode the instance to the DjVu's TXTz
chunk.
inPageInfo | The dimensions and rotation status of the page is used during encoding the TXTz string. |
TXTz
Chunk.
|
pure virtual |
|
pure virtual |
|
pure virtual |
Get the current rotation angle.
|
pure virtual |
SimpleArray<AutoPtr<TextZone> > Celartem::DjVu::TextZone::children |
Child text blocks.
Child text blocks.
text should be empty when the text block has child text blocks (children has any element).
String Celartem::DjVu::TextZone::heading |
Heading text.
Heading text.
This text is used to combine words into a line. For example, "Mr. Brown" is actually separated into two TextZones; "Mr." and "Brown" but there should be a separating space between them and heading of the second TextZone ("Brown") is the space.
Rect Celartem::DjVu::TextZone::rect |
The rectangle of the text block in pixels.
If the text block has child text blocks, this variable is not used and you had better use getMinimumRectRequired method to get the actual rectangle.
String Celartem::DjVu::TextZone::text |
Text of the text block.
Text of the text block.
It should be empty when the text block has child text blocks. To get full text of the subsidiary TextZones instances, use getFullText method.
To search some text from the tree structured TextZone instances, use TextSearcher. It provides a simple interface to deal with searchs.
Type Celartem::DjVu::TextZone::type |
The type of the text block.