forked from enlightenment/efl
Evas font-engine: Added right_inset_get.
This lets us get the difference between the width and the advance of a string pretty fast, which means we only need to calculate either advance or width, because we can now calculate one from the other. SVN revision: 58181
This commit is contained in:
parent
79c580c65e
commit
533ef3530e
|
@ -58,6 +58,7 @@ EAPI void evas_common_font_all_clear (void);
|
|||
EAPI int evas_common_font_query_kerning (RGBA_Font_Int* fi, FT_UInt left, FT_UInt right, int* kerning);
|
||||
EAPI void evas_common_font_query_size (RGBA_Font *fn, const Eina_Unicode *text, const Evas_Text_Props *intl_props, int *w, int *h);
|
||||
EAPI int evas_common_font_query_inset (RGBA_Font *fn __UNUSED__, const Evas_Text_Props *text_props);
|
||||
EAPI int evas_common_font_query_right_inset (RGBA_Font *fn __UNUSED__, const Evas_Text_Props *text_props);
|
||||
EAPI void evas_common_font_query_advance (RGBA_Font *fn, const Eina_Unicode *text, const Evas_Text_Props *intl_props, int *h_adv, int *v_adv);
|
||||
EAPI int evas_common_font_query_char_coords (RGBA_Font *fn, const Eina_Unicode *text, const Evas_Text_Props *intl_props, int pos, int *cx, int *cy, int *cw, int *ch);
|
||||
EAPI int evas_common_font_query_pen_coords (RGBA_Font *fn, const Eina_Unicode *text, const Evas_Text_Props *intl_props, int pos, int *cpen_x, int *cy, int *cadv, int *ch);
|
||||
|
|
|
@ -66,6 +66,22 @@ evas_common_font_query_inset(RGBA_Font *fn __UNUSED__, const Evas_Text_Props *te
|
|||
return text_props->info->glyph[text_props->start].x_bear;
|
||||
}
|
||||
|
||||
/* text right x inset */
|
||||
EAPI int
|
||||
evas_common_font_query_right_inset(RGBA_Font *fn __UNUSED__, const Evas_Text_Props *text_props)
|
||||
{
|
||||
const Evas_Font_Glyph_Info *gli;
|
||||
if (!text_props->len) return 0;
|
||||
gli = text_props->info->glyph + text_props->start + text_props->len - 1;
|
||||
|
||||
return EVAS_FONT_ROUND_26_6_TO_INT(gli->advance) -
|
||||
(gli->width + gli->x_bear
|
||||
#ifdef OT_SUPPORT
|
||||
+ text_props->info->ot[text_props->start + text_props->len - 1].x_offset
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
/* size of the string (width and height) in pixels
|
||||
* BiDi handling: We receive the shaped string + other props from text_props,
|
||||
* We only care about the size, and the size does not depend on the visual order.
|
||||
|
|
|
@ -683,6 +683,7 @@ struct _Evas_Func
|
|||
int (*image_content_hint_get) (void *data, void *surface);
|
||||
int (*font_pen_coords_get) (void *data, void *font, const Eina_Unicode *text, const Evas_Text_Props *intl_props, int pos, int *cpen_x, int *cy, int *cadv, int *ch);
|
||||
Eina_Bool (*font_text_props_info_create) (void *data __UNUSED__, void *font, Eina_Unicode *text, Evas_Text_Props *intl_props, const Evas_BiDi_Paragraph_Props *par_props, size_t pos, size_t len);
|
||||
int (*font_right_inset_get) (void *data, void *font, const Evas_Text_Props *text_props);
|
||||
};
|
||||
|
||||
struct _Evas_Image_Load_Func
|
||||
|
|
|
@ -90,6 +90,7 @@ static int eng_font_max_ascent_get(void *data, void *font);
|
|||
static int eng_font_max_descent_get(void *data, void *font);
|
||||
static void eng_font_string_size_get(void *data, void *font, char *text, int *w, int *h);
|
||||
static int eng_font_inset_get(void *data, void *font, const Evas_Text_Props *intl_props);
|
||||
static int eng_font_right_inset_get(void *data, void *font, const Evas_Text_Props *intl_props);
|
||||
static int eng_font_h_advance_get(void *data, void *font, char *text);
|
||||
static int eng_font_v_advance_get(void *data, void *font, char *text);
|
||||
static int eng_font_char_coords_get(void *data, void *font, char *text, int pos, int *cx, int *cy, int *cw, int *ch);
|
||||
|
@ -219,7 +220,8 @@ static Evas_Func eng_func =
|
|||
NULL, // eng_image_content_hint_set - software doesn't use it
|
||||
NULL, // eng_image_content_hint_get - software doesn't use it
|
||||
eng_font_pen_coords_get,
|
||||
eng_font_text_props_info_create
|
||||
eng_font_text_props_info_create,
|
||||
eng_font_right_inset_get
|
||||
/* FUTURE software generic calls go here */
|
||||
};
|
||||
|
||||
|
|
|
@ -77,6 +77,7 @@ static int eng_font_max_ascent_get(void *data, void *font);
|
|||
static int eng_font_max_descent_get(void *data, void *font);
|
||||
static void eng_font_string_size_get(void *data, void *font, const char *text, const Evas_Text_Props *intl_props, int *w, int *h);
|
||||
static int eng_font_inset_get(void *data, void *font, const Evas_Text_Props *intl_props);
|
||||
static int eng_font_right_inset_get(void *data, void *font, const Evas_Text_Props *intl_props);
|
||||
static int eng_font_h_advance_get(void *data, void *font, const char *text, const Evas_Text_Props *intl_props);
|
||||
static int eng_font_v_advance_get(void *data, void *font, const char *text, const Evas_Text_Props *intl_props);
|
||||
static int eng_font_char_coords_get(void *data, void *font, const char *text, const Evas_Text_Props *intl_props, int pos, int *cx, int *cy, int *cw, int *ch);
|
||||
|
|
|
@ -516,6 +516,12 @@ eng_font_inset_get(void *data __UNUSED__, void *font, const Evas_Text_Props *tex
|
|||
return evas_common_font_query_inset(font, text_props);
|
||||
}
|
||||
|
||||
static int
|
||||
eng_font_right_inset_get(void *data __UNUSED__, void *font, const Evas_Text_Props *text_props)
|
||||
{
|
||||
return evas_common_font_query_right_inset(font, text_props);
|
||||
}
|
||||
|
||||
static int
|
||||
eng_font_h_advance_get(void *data __UNUSED__, void *font, const Eina_Unicode *text, const Evas_Text_Props *text_props)
|
||||
{
|
||||
|
@ -746,7 +752,8 @@ static Evas_Func func =
|
|||
NULL, // eng_image_content_hint_set - software doesn't use it
|
||||
NULL, // eng_image_content_hint_get - software doesn't use it
|
||||
eng_font_pen_coords_get,
|
||||
eng_font_text_props_info_create
|
||||
eng_font_text_props_info_create,
|
||||
eng_font_right_inset_get
|
||||
/* FUTURE software generic calls go here */
|
||||
};
|
||||
|
||||
|
|
|
@ -573,6 +573,12 @@ eng_font_inset_get(void *data __UNUSED__, void *font, const Evas_Text_Props *tex
|
|||
return evas_common_font_query_inset(font, text_props);
|
||||
}
|
||||
|
||||
static int
|
||||
eng_font_right_inset_get(void *data __UNUSED__, void *font, const Evas_Text_Props *text_props)
|
||||
{
|
||||
return evas_common_font_query_right_inset(font, text_props);
|
||||
}
|
||||
|
||||
static int
|
||||
eng_font_h_advance_get(void *data __UNUSED__, void *font, const Eina_Unicode *text, const Evas_Text_Props *text_props)
|
||||
{
|
||||
|
@ -792,7 +798,8 @@ static Evas_Func func = {
|
|||
NULL, // eng_image_content_hint_set - software doesn't use it
|
||||
NULL, // eng_image_content_hint_get - software doesn't use it
|
||||
eng_font_pen_coords_get,
|
||||
eng_font_text_props_info_create
|
||||
eng_font_text_props_info_create,
|
||||
eng_font_right_inset_get
|
||||
/* FUTURE software generic calls go here */
|
||||
};
|
||||
|
||||
|
|
|
@ -694,6 +694,12 @@ eng_font_inset_get(void *data __UNUSED__, void *font, const Evas_Text_Props *tex
|
|||
return evas_common_font_query_inset(font, text_props);
|
||||
}
|
||||
|
||||
static int
|
||||
eng_font_right_inset_get(void *data __UNUSED__, void *font, const Evas_Text_Props *text_props)
|
||||
{
|
||||
return evas_common_font_query_right_inset(font, text_props);
|
||||
}
|
||||
|
||||
static int
|
||||
eng_font_h_advance_get(void *data __UNUSED__, void *font, const Eina_Unicode *text, const Evas_Text_Props *text_props)
|
||||
{
|
||||
|
@ -926,7 +932,8 @@ static Evas_Func func =
|
|||
NULL, // eng_image_content_hint_set - software doesn't use it
|
||||
NULL, // eng_image_content_hint_get - software doesn't use it
|
||||
eng_font_pen_coords_get,
|
||||
eng_font_text_props_info_create
|
||||
eng_font_text_props_info_create,
|
||||
eng_font_right_inset_get
|
||||
/* FUTURE software generic calls go here */
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue