add the api routines to query the text objects
SVN revision: 3455
This commit is contained in:
parent
54af8d51ff
commit
3a1fb0355c
|
@ -323,13 +323,16 @@ double evas_screen_x_to_world(Evas e, int x);
|
||||||
double evas_screen_y_to_world(Evas e, int y);
|
double evas_screen_y_to_world(Evas e, int y);
|
||||||
|
|
||||||
/* text query ops */
|
/* text query ops */
|
||||||
char *evas_get_text_string(Evas e, Evas_Object o);
|
char *evas_get_text_string(Evas e, Evas_Object o);
|
||||||
char *evas_get_text_font(Evas e, Evas_Object o);
|
char *evas_get_text_font(Evas e, Evas_Object o);
|
||||||
int evas_get_text_size(Evas e, Evas_Object o);
|
int evas_get_text_size(Evas e, Evas_Object o);
|
||||||
int evas_text_at_position(Evas e, Evas_Object o, double x, double y, int *char_x, int *char_y, int *char_w, int *char_h);
|
int evas_text_at_position(Evas e, Evas_Object o, double x, double y, int *char_x, int *char_y, int *char_w, int *char_h);
|
||||||
void evas_text_at(Evas e, Evas_Object o, int index, int *char_x, int *char_y, int *char_w, int *char_h);
|
void evas_text_at(Evas e, Evas_Object o, int index, int *char_x, int *char_y, int *char_w, int *char_h);
|
||||||
void evas_text_get_ascent_descent(Evas e, Evas_Object o, double *ascent, double *descent);
|
void evas_text_get_ascent_descent(Evas e, Evas_Object o, double *ascent, double *descent);
|
||||||
|
void evas_text_get_max_ascent_descent(Evas e, Evas_Object o, double *ascent, double *descent);
|
||||||
|
void evas_text_get_advance(Evas e, Evas_Object o, double *h_advance, double *v_advance);
|
||||||
|
double evas_text_get_inset(Evas e, Evas_Object o);
|
||||||
|
|
||||||
/* object query ops */
|
/* object query ops */
|
||||||
void evas_get_color(Evas e, Evas_Object o, int *r, int *g, int *b, int *a);
|
void evas_get_color(Evas e, Evas_Object o, int *r, int *g, int *b, int *a);
|
||||||
Evas_Object evas_get_object_under_mouse(Evas e);
|
Evas_Object evas_get_object_under_mouse(Evas e);
|
||||||
|
|
|
@ -297,6 +297,145 @@ evas_text_get_ascent_descent(Evas e, Evas_Object o,
|
||||||
if (descent) *descent = d;
|
if (descent) *descent = d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
evas_text_get_max_ascent_descent(Evas e, Evas_Object o,
|
||||||
|
double *ascent, double *descent)
|
||||||
|
{
|
||||||
|
int a, d;
|
||||||
|
Evas_Object_Text oo;
|
||||||
|
|
||||||
|
oo = o;
|
||||||
|
a = 0; d = 0;
|
||||||
|
switch (e->current.render_method)
|
||||||
|
{
|
||||||
|
case RENDER_METHOD_ALPHA_SOFTWARE:
|
||||||
|
{
|
||||||
|
Evas_Imlib_Font *fn;
|
||||||
|
|
||||||
|
fn = __evas_imlib_text_font_new(e->current.display, oo->current.font, oo->current.size);
|
||||||
|
if (fn)
|
||||||
|
{
|
||||||
|
a = __evas_imlib_text_font_get_max_ascent(fn);
|
||||||
|
d = __evas_imlib_text_font_get_max_descent(fn);
|
||||||
|
__evas_imlib_text_font_free(fn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case RENDER_METHOD_BASIC_HARDWARE:
|
||||||
|
break;
|
||||||
|
case RENDER_METHOD_3D_HARDWARE:
|
||||||
|
{
|
||||||
|
Evas_GL_Font *fn;
|
||||||
|
|
||||||
|
fn = __evas_gl_text_font_new(e->current.display, oo->current.font, oo->current.size);
|
||||||
|
if (fn)
|
||||||
|
{
|
||||||
|
a = __evas_gl_text_font_get_max_ascent(fn);
|
||||||
|
d = __evas_gl_text_font_get_max_descent(fn);
|
||||||
|
__evas_gl_text_font_free(fn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case RENDER_METHOD_ALPHA_HARDWARE:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (ascent) *ascent = a;
|
||||||
|
if (descent) *descent = d;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
evas_text_get_advance(Evas e, Evas_Object o,
|
||||||
|
double *h_advance, double *v_advance)
|
||||||
|
{
|
||||||
|
int a, d;
|
||||||
|
Evas_Object_Text oo;
|
||||||
|
|
||||||
|
oo = o;
|
||||||
|
a = 0; d = 0;
|
||||||
|
switch (e->current.render_method)
|
||||||
|
{
|
||||||
|
case RENDER_METHOD_ALPHA_SOFTWARE:
|
||||||
|
{
|
||||||
|
Evas_Imlib_Font *fn;
|
||||||
|
|
||||||
|
fn = __evas_imlib_text_font_new(e->current.display, oo->current.font, oo->current.size);
|
||||||
|
if (fn)
|
||||||
|
{
|
||||||
|
__evas_imlib_text_font_get_advances(fn, oo->current.text, &a, &d);
|
||||||
|
__evas_imlib_text_font_free(fn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case RENDER_METHOD_BASIC_HARDWARE:
|
||||||
|
break;
|
||||||
|
case RENDER_METHOD_3D_HARDWARE:
|
||||||
|
{
|
||||||
|
Evas_GL_Font *fn;
|
||||||
|
|
||||||
|
fn = __evas_gl_text_font_new(e->current.display, oo->current.font, oo->current.size);
|
||||||
|
if (fn)
|
||||||
|
{
|
||||||
|
__evas_gl_text_font_get_advances(fn, oo->current.text, &a, &d);
|
||||||
|
__evas_gl_text_font_free(fn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case RENDER_METHOD_ALPHA_HARDWARE:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (h_advance) *h_advance = a;
|
||||||
|
if (v_advance) *v_advance = d;
|
||||||
|
}
|
||||||
|
|
||||||
|
double
|
||||||
|
evas_text_get_inset(Evas e, Evas_Object o)
|
||||||
|
{
|
||||||
|
Evas_Object_Text oo;
|
||||||
|
int inset;
|
||||||
|
|
||||||
|
oo = o;
|
||||||
|
switch (e->current.render_method)
|
||||||
|
{
|
||||||
|
case RENDER_METHOD_ALPHA_SOFTWARE:
|
||||||
|
{
|
||||||
|
Evas_Imlib_Font *fn;
|
||||||
|
|
||||||
|
fn = __evas_imlib_text_font_new(e->current.display, oo->current.font, oo->current.size);
|
||||||
|
if (fn)
|
||||||
|
{
|
||||||
|
inset = __evas_imlib_text_font_get_first_inset(fn, oo->current.text);
|
||||||
|
__evas_imlib_text_font_free(fn);
|
||||||
|
return (double)inset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case RENDER_METHOD_BASIC_HARDWARE:
|
||||||
|
break;
|
||||||
|
case RENDER_METHOD_3D_HARDWARE:
|
||||||
|
{
|
||||||
|
Evas_GL_Font *fn;
|
||||||
|
|
||||||
|
fn = __evas_gl_text_font_new(e->current.display, oo->current.font, oo->current.size);
|
||||||
|
if (fn)
|
||||||
|
{
|
||||||
|
inset = __evas_gl_text_font_get_first_inset(fn, oo->current.text);
|
||||||
|
__evas_gl_text_font_free(fn);
|
||||||
|
return (double)inset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case RENDER_METHOD_ALPHA_HARDWARE:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
evas_set_text(Evas e, Evas_Object o, char *text)
|
evas_set_text(Evas e, Evas_Object o, char *text)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue