forked from enlightenment/efl
Evas textblock: Added support for numeric escape sequences.
Patch by Raoul Hecky. SVN revision: 59780
This commit is contained in:
parent
422d9358bf
commit
dbe7a9800e
|
@ -380,3 +380,7 @@
|
||||||
|
|
||||||
* Font-engine: Conform to the API changes in Harfbuzz 0.6.0
|
* Font-engine: Conform to the API changes in Harfbuzz 0.6.0
|
||||||
|
|
||||||
|
2011-05-29 Raoul Hecky
|
||||||
|
|
||||||
|
* Textblock: Added support for numeric escape codes. e.g "<".
|
||||||
|
|
||||||
|
|
|
@ -4590,6 +4590,42 @@ _escaped_char_match(const char *s, int *adv)
|
||||||
*/
|
*/
|
||||||
static inline const char *
|
static inline const char *
|
||||||
_escaped_char_get(const char *s, const char *s_end)
|
_escaped_char_get(const char *s, const char *s_end)
|
||||||
|
{
|
||||||
|
/* Handle numeric escape codes. */
|
||||||
|
if (s[1] == '#')
|
||||||
|
{
|
||||||
|
static char utf8_escape[7]; /* Support up to 6 bytes utf8 */
|
||||||
|
char ustr[10];
|
||||||
|
Eina_Unicode uchar[2] = { 0, 0 };
|
||||||
|
char *utf8_char;
|
||||||
|
size_t len = 0;
|
||||||
|
int base = 10;
|
||||||
|
s += 2; /* Skip "&#" */
|
||||||
|
|
||||||
|
if (tolower(*s) == 'x')
|
||||||
|
{
|
||||||
|
s++;
|
||||||
|
base = 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
len = s_end - s;
|
||||||
|
if (len >= sizeof(ustr) + 1)
|
||||||
|
len = sizeof(ustr);
|
||||||
|
|
||||||
|
memcpy(ustr, s, len);
|
||||||
|
ustr[len] = '\0';
|
||||||
|
uchar[0] = strtol(ustr, NULL, base);
|
||||||
|
|
||||||
|
if (uchar[0] == 0)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
utf8_char = eina_unicode_unicode_to_utf8(uchar, NULL);
|
||||||
|
strcpy(utf8_escape, utf8_char);
|
||||||
|
free(utf8_char);
|
||||||
|
|
||||||
|
return utf8_escape;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
const char *map_itr, *map_end;
|
const char *map_itr, *map_end;
|
||||||
|
|
||||||
|
@ -4603,6 +4639,8 @@ _escaped_char_get(const char *s, const char *s_end)
|
||||||
if (map_itr < map_end)
|
if (map_itr < map_end)
|
||||||
_escaped_advance_after_end_of_string(&map_itr);
|
_escaped_advance_after_end_of_string(&map_itr);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue