oh my wordy lordy me.. too accurate for its own good soi've had to fidge to

overlap parts as the positioning is done in 24.8 space not integer space


SVN revision: 6553
This commit is contained in:
Carsten Haitzler 2003-01-08 06:39:38 +00:00
parent 6e8c67d976
commit 47280739ac
2 changed files with 19 additions and 8 deletions

View File

@ -678,7 +678,10 @@ evas_object_text_render(Evas_Object *obj, void *output, void *context, void *sur
context, context,
surface, surface,
o->engine_data, o->engine_data,
obj->cur.cache.geometry.x + x, obj->cur.cache.geometry.x + x -
obj->layer->evas->engine.func->font_inset_get(obj->layer->evas->engine.data.output,
o->engine_data,
o->cur.text),
obj->cur.cache.geometry.y + y + obj->cur.cache.geometry.y + y +
(int) (int)
((o->max_ascent * obj->cur.cache.geometry.h) / obj->cur.geometry.h), ((o->max_ascent * obj->cur.cache.geometry.h) / obj->cur.geometry.h),

View File

@ -139,6 +139,7 @@ evas_common_font_query_char_coords(RGBA_Font *fn, const char *text, int pos, int
RGBA_Font_Glyph *fg; RGBA_Font_Glyph *fg;
int chr_x, chr_y, chr_w; int chr_x, chr_y, chr_w;
int gl; int gl;
FT_Vector delta;
pchr = chr; pchr = chr;
gl = evas_common_font_utf8_get_next((unsigned char *)text, &chr); gl = evas_common_font_utf8_get_next((unsigned char *)text, &chr);
@ -146,8 +147,6 @@ evas_common_font_query_char_coords(RGBA_Font *fn, const char *text, int pos, int
index = FT_Get_Char_Index(fn->ft.face, gl); index = FT_Get_Char_Index(fn->ft.face, gl);
if ((use_kerning) && (prev_index) && (index)) if ((use_kerning) && (prev_index) && (index))
{ {
FT_Vector delta;
FT_Get_Kerning(fn->ft.face, prev_index, index, FT_Get_Kerning(fn->ft.face, prev_index, index,
ft_kerning_default, &delta); ft_kerning_default, &delta);
pen_x += delta.x << 2; pen_x += delta.x << 2;
@ -158,7 +157,11 @@ evas_common_font_query_char_coords(RGBA_Font *fn, const char *text, int pos, int
chr_x = (pen_x >> 8) + fg->glyph_out->left; chr_x = (pen_x >> 8) + fg->glyph_out->left;
chr_y = (pen_y >> 8) + fg->glyph_out->top; chr_y = (pen_y >> 8) + fg->glyph_out->top;
chr_w = fg->glyph_out->bitmap.width; chr_w = fg->glyph_out->bitmap.width;
if (text[chr])
{
if (chr_w < (fg->glyph->advance.x >> 16))
chr_w = fg->glyph->advance.x >> 16;
}
if (pchr == pos) if (pchr == pos)
{ {
if (cx) *cx = chr_x; if (cx) *cx = chr_x;
@ -193,6 +196,7 @@ evas_common_font_query_text_at_pos(RGBA_Font *fn, const char *text, int x, int y
RGBA_Font_Glyph *fg; RGBA_Font_Glyph *fg;
int chr_x, chr_y, chr_w; int chr_x, chr_y, chr_w;
int gl; int gl;
FT_Vector delta;
pchr = chr; pchr = chr;
gl = evas_common_font_utf8_get_next((unsigned char *)text, &chr); gl = evas_common_font_utf8_get_next((unsigned char *)text, &chr);
@ -200,8 +204,6 @@ evas_common_font_query_text_at_pos(RGBA_Font *fn, const char *text, int x, int y
index = FT_Get_Char_Index(fn->ft.face, gl); index = FT_Get_Char_Index(fn->ft.face, gl);
if ((use_kerning) && (prev_index) && (index)) if ((use_kerning) && (prev_index) && (index))
{ {
FT_Vector delta;
FT_Get_Kerning(fn->ft.face, prev_index, index, FT_Get_Kerning(fn->ft.face, prev_index, index,
ft_kerning_default, &delta); ft_kerning_default, &delta);
pen_x += delta.x << 6; pen_x += delta.x << 6;
@ -212,8 +214,14 @@ evas_common_font_query_text_at_pos(RGBA_Font *fn, const char *text, int x, int y
chr_x = (pen_x >> 8) + fg->glyph_out->left; chr_x = (pen_x >> 8) + fg->glyph_out->left;
chr_y = (pen_y >> 8) + fg->glyph_out->top; chr_y = (pen_y >> 8) + fg->glyph_out->top;
chr_w = fg->glyph_out->bitmap.width; chr_w = fg->glyph_out->bitmap.width;
if (text[chr])
if ((x >= chr_x) && (x < (chr_x + chr_w)) && {
if (chr_w < (((fg->glyph->advance.x + 0xffff) >> 16) +
(((pen_x & 0xff) + 0xff) >> 8) + 1))
chr_w = ((fg->glyph->advance.x + 0xffff) >> 16) +
(((pen_x & 0xff) + 0xff) >> 8) + 1;
}
if ((x >= chr_x) && (x <= (chr_x + chr_w)) &&
(y > - evas_common_font_max_ascent_get(fn)) && (y > - evas_common_font_max_ascent_get(fn)) &&
(y < evas_common_font_max_descent_get(fn))) (y < evas_common_font_max_descent_get(fn)))
{ {