more work on textblocks! :)

SVN revision: 13263
This commit is contained in:
Carsten Haitzler 2005-02-09 16:10:56 +00:00
parent 6f7b7cbab1
commit ee21eb81ca
5 changed files with 629 additions and 220 deletions

View File

@ -441,13 +441,21 @@ extern "C" {
EAPI void evas_object_textblock_cursor_pos_set (Evas_Object *obj, int pos);
EAPI int evas_object_textblock_cursor_pos_get (Evas_Object *obj);
EAPI int evas_object_textblock_length_get (Evas_Object *obj);
EAPI int evas_object_textblock_cursor_line_get (Evas_Object *obj);
EAPI int evas_object_textblock_lines_get (Evas_Object *obj);
EAPI int evas_object_textblock_line_start_pos_get (Evas_Object *obj);
EAPI int evas_object_textblock_line_end_pos_get (Evas_Object *obj);
EAPI void evas_object_textblock_line_get (Evas_Object *obj, int line, Evas_Coord *lx, Evas_Coord *ly, Evas_Coord *lw, Evas_Coord *lh);
EAPI void evas_object_textblock_char_pos_get (Evas_Object *obj, int pos, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch);
EAPI int evas_object_textblock_char_coords_get (Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch);
EAPI void evas_object_textblock_text_insert (Evas_Object *obj, const char *text);
EAPI char *evas_object_textblock_text_get (Evas_Object *obj, int start, int len);
EAPI char *evas_object_textblock_text_get (Evas_Object *obj, int len);
EAPI void evas_object_textblock_text_del (Evas_Object *obj, int len);
EAPI void evas_object_textblock_format_insert (Evas_Object *obj, const char *format);
EAPI int evas_object_textblock_format_next_pos_get (Evas_Object *obj);
EAPI int evas_object_textblock_format_prev_pos_get (Evas_Object *obj);
EAPI char *evas_object_textblock_format_get (Evas_Object *obj);
EAPI char *evas_object_textblock_current_format_get (Evas_Object *obj);
EAPI void evas_object_textblock_format_del (Evas_Object *obj);
EAPI void evas_object_textblock_format_direction_set (Evas_Object *obj, Evas_Format_Direction dir);
EAPI Evas_Format_Direction evas_object_textblock_format_direction_get (Evas_Object *obj);

File diff suppressed because it is too large Load Diff

View File

@ -97,14 +97,15 @@ int
evas_common_font_utf8_get_next(unsigned char *buf, int *iindex)
{
/* Reads UTF8 bytes from @buf, starting at *@index and returns
* the code point of the next valid code point. @index is
* updated ready for the next call.
* the decoded code point at iindex offset, and advances iidnex
* to the next code point after this.
*
* Returns 0 to indicate an error (e.g. invalid UTF8)
*/
int index = *iindex, r, istart = *iindex;
unsigned char d = buf[index++], d2, d3, d4;
unsigned char d, d2, d3, d4;
d = buf[index++];
if (!d)
return 0;
if (d < 0x80)
@ -148,27 +149,7 @@ evas_common_font_utf8_get_next(unsigned char *buf, int *iindex)
r <<= 6;
r |= (d4 & 0x3f);
}
#if 0
index = istart - 1;
d = buf[index];
if (!(d & 0x80))
*iindex = index;
else
{
while (index > 0)
{
index--;
d = buf[index];
if ((d & 0xc0) != 0x80)
{
*iindex = index;
return r;
}
}
}
#else
*iindex = index;
#endif
return r;
}
@ -176,14 +157,15 @@ int
evas_common_font_utf8_get_prev(unsigned char *buf, int *iindex)
{
/* Reads UTF8 bytes from @buf, starting at *@index and returns
* the code point of the previous valid code point. @index is
* updated ready for the next call.
* the decoded code point at iindex offset, and advances iidnex
* to the next code point after this.
*
* Returns 0 to indicate an error (e.g. invalid UTF8)
*/
int index = *iindex, r, istart = *iindex;
unsigned char d = buf[index++], d2, d3, d4;
unsigned char d, d2, d3, d4;
d = buf[index++];
if (d < 0x80)
{
r = d;
@ -230,7 +212,6 @@ evas_common_font_utf8_get_prev(unsigned char *buf, int *iindex)
r <<= 6;
r |= (d4 & 0x3f);
}
#if 1
index = istart - 1;
d = buf[index];
if (!(d & 0x80))
@ -248,8 +229,35 @@ evas_common_font_utf8_get_prev(unsigned char *buf, int *iindex)
}
}
}
#else
*iindex = index;
#endif
return r;
}
int
evas_common_font_utf8_get_last(unsigned char *buf, int buflen)
{
/* jumps to the nul byte at the buffer end and decodes backwards and
* returns the offset index byte in the buffer where the last character
* in the buffer begins.
*
* Returns -1 to indicate an error
*/
int index;
unsigned char d;
if (buflen < 1) return 0;
index = buflen - 1;
d = buf[index];
if (!(d & 0x80))
return index;
else
{
while (index > 0)
{
index--;
d = buf[index];
if ((d & 0xc0) != 0x80)
return index;
}
}
return 0;
}

View File

@ -167,7 +167,7 @@ evas_common_font_query_char_coords(RGBA_Font *fn, const char *text, int pos, int
chr_x = ((pen_x - kern) >> 8) + fg->glyph_out->left;
chr_y = (pen_y >> 8) + fg->glyph_out->top;
chr_w = fg->glyph_out->bitmap.width + (kern >> 8);
if (text[chr])
/* if (text[chr]) */
{
int advw;
@ -241,7 +241,7 @@ evas_common_font_query_text_at_pos(RGBA_Font *fn, const char *text, int x, int y
chr_x = ((pen_x - kern) >> 8) + fg->glyph_out->left;
chr_y = (pen_y >> 8) + fg->glyph_out->top;
chr_w = fg->glyph_out->bitmap.width + (kern >> 8);
if (text[chr])
/* if (text[chr]) */
{
int advw;

View File

@ -899,6 +899,7 @@ int evas_common_font_query_char_coords (RGBA_Font *fn, const char *
int evas_common_font_query_text_at_pos (RGBA_Font *fn, const char *text, int x, int y, int *cx, int *cy, int *cw, int *ch);
int evas_common_font_utf8_get_next (unsigned char *buf, int *iindex);
int evas_common_font_utf8_get_prev (unsigned char *buf, int *iindex);
int evas_common_font_utf8_get_last (unsigned char *buf, int buflen);
/****/
void evas_common_tilebuf_init (void);