svn update: 57457 (latest:57457)
[framework/uifw/evas.git] / src / lib / engines / common / evas_text_utils.h
1 #ifndef _EVAS_TEXT_UTILS_H
2 # define _EVAS_TEXT_UTILS_H
3
4 typedef struct _Evas_Text_Props Evas_Text_Props;
5 typedef struct _Evas_Text_Props_Info Evas_Text_Props_Info;
6 typedef struct _Evas_Font_Glyph_Info Evas_Font_Glyph_Info;
7
8 # include "evas_font_ot.h"
9 # include "language/evas_bidi_utils.h"
10 # include "language/evas_language_utils.h"
11
12 struct _Evas_Text_Props
13 {
14    /* Start and len represent the start offset and the length in the
15     * glyphs_info and ot_data fields, they are both internal */
16    size_t start;
17    size_t len;
18    size_t text_offset; /* The text offset from the start of the info */
19    size_t text_len; /* The length of the original text */
20    Evas_BiDi_Props bidi;
21    Evas_Script_Type script;
22    Evas_Text_Props_Info *info;
23 };
24
25 struct _Evas_Text_Props_Info
26 {
27    unsigned int refcount;
28    Evas_Font_Glyph_Info *glyph;
29    Evas_Font_OT_Info *ot;
30 };
31
32 /* Sorted in visual order when created */
33 struct _Evas_Font_Glyph_Info
34 {
35    unsigned int index; /* Should conform to FT */
36    Evas_Coord x_bear;
37 #if 0
38    /* This one is rarely used, only in draw, in which we already get the glyph
39     * so it doesn't really save time. Leaving it here just so no one will
40     * add it thinking it was accidentally skipped */
41    Evas_Coord y_bear;
42 #endif
43    Evas_Coord width;
44    Evas_Coord advance;
45 };
46
47
48 void
49 evas_common_text_props_bidi_set(Evas_Text_Props *props,
50       Evas_BiDi_Paragraph_Props *bidi_par_props, size_t start);
51
52 void
53 evas_common_text_props_script_set(Evas_Text_Props *props,
54       const Eina_Unicode *str);
55
56 EAPI Eina_Bool
57 evas_common_text_props_content_create(void *_fn, const Eina_Unicode *text,
58       Evas_Text_Props *text_props, int len);
59
60 void
61 evas_common_text_props_content_copy_and_ref(Evas_Text_Props *dst,
62       const Evas_Text_Props *src);
63
64 void
65 evas_common_text_props_content_ref(Evas_Text_Props *props);
66
67 void
68 evas_common_text_props_content_unref(Evas_Text_Props *props);
69
70
71 EAPI void
72 evas_common_text_props_split(Evas_Text_Props *base, Evas_Text_Props *ext,
73       int cutoff);
74 EAPI void
75 evas_common_text_props_merge(Evas_Text_Props *item1, const Evas_Text_Props *item2);
76 #endif