2011-01-30 02:36:39 -08:00
|
|
|
#ifndef _EVAS_TEXT_UTILS_H
|
|
|
|
# define _EVAS_TEXT_UTILS_H
|
|
|
|
|
2013-01-15 09:35:11 -08:00
|
|
|
typedef struct _Evas_Text_Props Evas_Text_Props;
|
2013-01-12 00:40:46 -08:00
|
|
|
// special case props
|
2013-01-15 09:35:11 -08:00
|
|
|
typedef struct _Evas_Text_Props_One Evas_Text_Props_One;
|
2013-01-12 00:40:46 -08:00
|
|
|
|
2011-02-01 04:17:52 -08:00
|
|
|
typedef struct _Evas_Text_Props_Info Evas_Text_Props_Info;
|
2013-01-15 09:35:11 -08:00
|
|
|
typedef struct _Evas_Font_Array_Data Evas_Font_Array_Data;
|
|
|
|
typedef struct _Evas_Font_Array Evas_Font_Array;
|
2011-02-01 04:17:52 -08:00
|
|
|
typedef struct _Evas_Font_Glyph_Info Evas_Font_Glyph_Info;
|
2011-01-30 02:36:39 -08:00
|
|
|
|
2012-06-12 08:25:27 -07:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
EVAS_TEXT_PROPS_MODE_NONE = 0,
|
|
|
|
EVAS_TEXT_PROPS_MODE_SHAPE
|
|
|
|
} Evas_Text_Props_Mode;
|
|
|
|
|
2011-01-30 02:36:39 -08:00
|
|
|
# include "evas_font_ot.h"
|
|
|
|
# include "language/evas_bidi_utils.h"
|
|
|
|
# include "language/evas_language_utils.h"
|
|
|
|
|
2011-04-20 07:20:51 -07:00
|
|
|
/* Used for showing "malformed" or missing chars */
|
|
|
|
#define REPLACEMENT_CHAR 0xFFFD
|
|
|
|
|
2012-07-04 02:39:23 -07:00
|
|
|
typedef struct _Evas_Glyph Evas_Glyph;
|
2012-12-17 13:27:07 -08:00
|
|
|
typedef struct _Evas_Glyph_Array Evas_Glyph_Array;
|
|
|
|
|
|
|
|
struct _Evas_Glyph_Array
|
|
|
|
{
|
|
|
|
Eina_Inarray *array;
|
2013-06-14 03:55:53 -07:00
|
|
|
void *fi;
|
2012-12-17 13:27:07 -08:00
|
|
|
unsigned int refcount;
|
|
|
|
};
|
2012-07-04 02:39:23 -07:00
|
|
|
|
2011-01-30 02:36:39 -08:00
|
|
|
struct _Evas_Text_Props
|
|
|
|
{
|
2013-01-12 00:40:46 -08:00
|
|
|
Evas_Text_Props_Info *info; // 8/4
|
|
|
|
Evas_Glyph_Array *glyphs; // 8/4
|
|
|
|
void *font_instance; // 8/4
|
2011-02-01 04:17:52 -08:00
|
|
|
/* Start and len represent the start offset and the length in the
|
|
|
|
* glyphs_info and ot_data fields, they are both internal */
|
2013-01-12 00:40:46 -08:00
|
|
|
// i only wonder if generation needs 32bits... :)
|
|
|
|
int generation; // 4
|
|
|
|
// Evas_BiDi_Props bidi; // 4 // bidi.dir == enum
|
|
|
|
// Evas_Script_Type script; // 4 // enum
|
|
|
|
// Eina_Bool changed : 1; // 1
|
|
|
|
// Eina_Bool prepare : 1;
|
|
|
|
// // +3 pad
|
|
|
|
// ** the below saves 8 bytes (72 -> 64 on 64bit)
|
|
|
|
Evas_BiDi_Direction bidi_dir : 2; // 2 (enough for values)
|
|
|
|
Evas_Script_Type script : 7; // cont (enough for values)
|
|
|
|
Eina_Bool changed : 1; // cont (bool)
|
|
|
|
Eina_Bool prepare : 1; // cont (bool)
|
|
|
|
// we have space here for at LEAST 5 bits (round up to 2 bytes) but due
|
|
|
|
// to common padding we actually can add 5 + 16 (21) more bits for free
|
|
|
|
Eina_Bool szlen_mode : 5; // use 5 of he 21 bits
|
|
|
|
// this can go here as the above is nicely aligned....
|
|
|
|
// this is really big... 32 bytes. MOSt of the time the following...
|
|
|
|
// start == text_offset == 0 AND len == text_len == smallish value (8 or
|
|
|
|
// 16 bit is enough to store it most of the time).
|
|
|
|
size_t start; // 8/4
|
|
|
|
size_t len; // 8/4
|
|
|
|
size_t text_offset; // 8/4 /* The text offset from the start of the info */
|
|
|
|
size_t text_len; // 8/4 /* The length of the original text */
|
|
|
|
};
|
|
|
|
|
|
|
|
#define EVAS_TP_SZLEN_FULL 0
|
|
|
|
#define EVAS_TP_SZLEN_ONE 1
|
|
|
|
|
|
|
|
// special case textprop for ONE char! should use this for textgrid but
|
|
|
|
// we have to modify every bit of code that usea a textprop to go thru a
|
|
|
|
// getter or setter etc. etc.
|
|
|
|
struct _Evas_Text_Props_One
|
|
|
|
{
|
|
|
|
Evas_Text_Props_Info *info; // 8/4
|
|
|
|
Evas_Glyph_Array *glyphs; // 8/4
|
|
|
|
void *font_instance; // 8/4
|
|
|
|
/* Start and len represent the start offset and the length in the
|
|
|
|
* glyphs_info and ot_data fields, they are both internal */
|
|
|
|
// i only wonder if generation needs 32bits... :)
|
|
|
|
int generation; // 4
|
|
|
|
// Evas_BiDi_Props bidi; // 4 // bidi.dir == enum
|
|
|
|
// Evas_Script_Type script; // 4 // enum
|
|
|
|
// Eina_Bool changed : 1; // 1
|
|
|
|
// Eina_Bool prepare : 1;
|
|
|
|
// // +3 pad
|
|
|
|
// ** the below saves 8 bytes (72 -> 64 on 64bit)
|
|
|
|
Evas_BiDi_Direction bidi_dir : 2; // 2 (enough for values)
|
|
|
|
Evas_Script_Type script : 7; // cont (enough for values)
|
|
|
|
Eina_Bool changed : 1; // cont (bool)
|
|
|
|
Eina_Bool prepare : 1; // cont (bool)
|
|
|
|
// we have space here for at LEAST 5 bits (round up to 2 bytes) but due
|
|
|
|
// to common padding we actually can add 5 + 16 (21) more bits for free
|
|
|
|
Eina_Bool szlen_mode : 5; // use 5 of he 21 bits
|
2011-01-30 02:36:39 -08:00
|
|
|
};
|
|
|
|
|
2011-02-01 04:17:52 -08:00
|
|
|
struct _Evas_Text_Props_Info
|
|
|
|
{
|
2013-01-12 00:40:46 -08:00
|
|
|
Evas_Font_Glyph_Info *glyph; // 8/4
|
|
|
|
Evas_Font_OT_Info *ot; // 8/4
|
|
|
|
unsigned int refcount; // 4
|
2011-02-01 04:17:52 -08:00
|
|
|
};
|
|
|
|
|
2013-01-15 09:35:11 -08:00
|
|
|
struct _Evas_Font_Array_Data
|
|
|
|
{
|
|
|
|
struct {
|
|
|
|
unsigned char r, g, b, a;
|
|
|
|
} color;
|
|
|
|
int x;
|
|
|
|
Evas_Glyph_Array *glyphs;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _Evas_Font_Array
|
|
|
|
{
|
|
|
|
Eina_Inarray *array;
|
|
|
|
unsigned int refcount;
|
|
|
|
};
|
|
|
|
|
2011-02-01 04:17:52 -08:00
|
|
|
/* Sorted in visual order when created */
|
|
|
|
struct _Evas_Font_Glyph_Info
|
|
|
|
{
|
2013-01-12 00:40:46 -08:00
|
|
|
unsigned int index; // 4 /* Should conform to FT */
|
|
|
|
#if 1
|
|
|
|
// done with shorts to save space... if we need 32k or bigger glyphs and
|
|
|
|
// relative layout info... worry then.
|
2013-03-11 08:18:21 -07:00
|
|
|
Evas_Coord pen_after; // 4
|
|
|
|
short x_bear, y_bear, width; // 6
|
2013-01-12 00:40:46 -08:00
|
|
|
#else
|
|
|
|
Evas_Coord x_bear; // 4
|
2011-02-01 04:17:52 -08:00
|
|
|
/* This one is rarely used, only in draw, in which we already get the glyph
|
|
|
|
* so it doesn't really save time. Leaving it here just so no one will
|
|
|
|
* add it thinking it was accidentally skipped */
|
2013-01-12 00:40:46 -08:00
|
|
|
Evas_Coord y_bear; // 4
|
|
|
|
Evas_Coord width; // 4
|
|
|
|
Evas_Coord pen_after; // 4
|
|
|
|
#endif
|
2011-02-01 04:17:52 -08:00
|
|
|
};
|
|
|
|
|
2012-12-17 13:27:07 -08:00
|
|
|
void
|
|
|
|
evas_common_font_glyphs_ref(Evas_Glyph_Array *array);
|
|
|
|
void
|
|
|
|
evas_common_font_glyphs_unref(Evas_Glyph_Array *array);
|
|
|
|
|
2013-01-15 09:35:11 -08:00
|
|
|
void
|
|
|
|
evas_common_font_fonts_ref(Evas_Font_Array *array);
|
|
|
|
void
|
|
|
|
evas_common_font_fonts_unref(Evas_Font_Array *array);
|
|
|
|
|
2011-01-30 02:36:39 -08:00
|
|
|
void
|
|
|
|
evas_common_text_props_bidi_set(Evas_Text_Props *props,
|
|
|
|
Evas_BiDi_Paragraph_Props *bidi_par_props, size_t start);
|
|
|
|
|
|
|
|
void
|
2011-05-29 02:20:18 -07:00
|
|
|
evas_common_text_props_script_set(Evas_Text_Props *props, Evas_Script_Type scr);
|
2011-01-30 02:36:39 -08:00
|
|
|
|
2011-02-01 04:17:52 -08:00
|
|
|
EAPI Eina_Bool
|
2011-05-29 02:20:18 -07:00
|
|
|
evas_common_text_props_content_create(void *_fi, const Eina_Unicode *text,
|
2011-04-13 01:37:01 -07:00
|
|
|
Evas_Text_Props *text_props, const Evas_BiDi_Paragraph_Props *par_props,
|
2012-06-12 07:14:52 -07:00
|
|
|
size_t par_pos, int len, Evas_Text_Props_Mode mode);
|
2011-02-01 04:17:52 -08:00
|
|
|
|
2011-01-30 02:36:39 -08:00
|
|
|
void
|
|
|
|
evas_common_text_props_content_copy_and_ref(Evas_Text_Props *dst,
|
|
|
|
const Evas_Text_Props *src);
|
|
|
|
|
2011-01-30 02:43:34 -08:00
|
|
|
void
|
|
|
|
evas_common_text_props_content_ref(Evas_Text_Props *props);
|
|
|
|
|
2012-11-21 01:12:42 -08:00
|
|
|
void
|
|
|
|
evas_common_text_props_content_nofree_unref(Evas_Text_Props *props);
|
|
|
|
|
2011-01-30 02:36:39 -08:00
|
|
|
void
|
|
|
|
evas_common_text_props_content_unref(Evas_Text_Props *props);
|
|
|
|
|
2011-06-02 08:36:50 -07:00
|
|
|
EAPI int
|
2011-07-17 03:47:54 -07:00
|
|
|
evas_common_text_props_cluster_next(const Evas_Text_Props *props, int pos);
|
|
|
|
|
2011-07-18 00:41:27 -07:00
|
|
|
EAPI int
|
|
|
|
evas_common_text_props_cluster_prev(const Evas_Text_Props *props, int pos);
|
|
|
|
|
2011-07-17 03:47:54 -07:00
|
|
|
EAPI int
|
|
|
|
evas_common_text_props_index_find(const Evas_Text_Props *props, int _cutoff);
|
2011-01-30 05:58:06 -08:00
|
|
|
|
2012-12-13 02:36:00 -08:00
|
|
|
EAPI Eina_Bool
|
2011-01-30 02:40:30 -08:00
|
|
|
evas_common_text_props_split(Evas_Text_Props *base, Evas_Text_Props *ext,
|
|
|
|
int cutoff);
|
2011-01-30 02:41:42 -08:00
|
|
|
EAPI void
|
|
|
|
evas_common_text_props_merge(Evas_Text_Props *item1, const Evas_Text_Props *item2);
|
2011-04-12 02:05:47 -07:00
|
|
|
|
2013-12-30 01:07:15 -08:00
|
|
|
/* Common to Textblock and Filters */
|
2013-12-30 01:13:32 -08:00
|
|
|
Eina_Bool evas_common_format_color_parse(const char *str, int slen, unsigned char *r, unsigned char *g, unsigned char *b, unsigned char *a);
|
2013-12-30 01:07:15 -08:00
|
|
|
|
2011-01-30 02:36:39 -08:00
|
|
|
#endif
|