rehinting works on the fly now

SVN revision: 20858
This commit is contained in:
Carsten Haitzler 2006-03-01 03:48:03 +00:00
parent 986bc3b7d0
commit f51753a4b8
3 changed files with 46 additions and 13 deletions

View File

@ -4522,3 +4522,32 @@ evas_object_textblock_coords_recalc(Evas_Object *obj)
o->changed = 1;
}
}
void
_evas_object_textblock_rehint(Evas_Object *obj)
{
Evas_Object_Textblock *o;
Evas_Object_List *l, *ll;
o = (Evas_Object_Textblock *)(obj->object_data);
for (l = (Evas_Object_List *)o->lines; l; l = l->next)
{
Evas_Object_Textblock_Line *ln;
ln = (Evas_Object_Textblock_Line *)l;
for (ll = (Evas_Object_List *)ln->items; ll; ll = ll->next)
{
Evas_Object_Textblock_Item *it;
it = (Evas_Object_Textblock_Item *)ll;
if (it->format->font.font)
evas_font_load_hinting_set(obj->layer->evas,
it->format->font.font,
obj->layer->evas->hinting);
}
}
o->formatted.valid = 0;
o->native.valid = 0;
o->changed = 1;
evas_object_change(obj);
}

View File

@ -5,25 +5,26 @@ evas_common_font_int_cache_glyph_get(RGBA_Font_Int *fi, FT_UInt index)
{
RGBA_Font_Glyph *fg;
char key[6];
FT_UInt hindex;
FT_Error error;
FT_Int32 lflags;
key[0] = ((index ) & 0x7f) + 1;
key[1] = ((index >> 7 ) & 0x7f) + 1;
key[2] = ((index >> 14 ) & 0x7f) + 1;
key[3] = ((index >> 21 ) & 0x7f) + 1;
key[4] = ((index >> 28 ) & 0x0f) + 1;
const FT_Int32 hintflags[3] =
{ FT_LOAD_NO_HINTING, FT_LOAD_FORCE_AUTOHINT, FT_LOAD_NO_AUTOHINT };
hindex = index + (fi->hinting * 500000000);
key[0] = ((hindex ) & 0x7f) + 1;
key[1] = ((hindex >> 7 ) & 0x7f) + 1;
key[2] = ((hindex >> 14 ) & 0x7f) + 1;
key[3] = ((hindex >> 21 ) & 0x7f) + 1;
key[4] = ((hindex >> 28 ) & 0x0f) + 1;
key[5] = 0;
fg = evas_hash_find(fi->glyphs, key);
if (fg) return fg;
// error = FT_Load_Glyph(fi->src->ft.face, index, FT_LOAD_NO_BITMAP);
lflags = FT_LOAD_RENDER;
if (fi->hinting == FONT_NO_HINT) lflags |= FT_LOAD_NO_HINTING;
else if (fi->hinting == FONT_AUTO_HINT) lflags |= FT_LOAD_FORCE_AUTOHINT;
else if (fi->hinting == FONT_BYTECODE_HINT) lflags |= FT_LOAD_NO_AUTOHINT;
error = FT_Load_Glyph(fi->src->ft.face, index, lflags);
error = FT_Load_Glyph(fi->src->ft.face, index,
FT_LOAD_RENDER | hintflags[fi->hinting]);
if (error) return NULL;
fg = malloc(sizeof(struct _RGBA_Font_Glyph));

View File

@ -692,9 +692,12 @@ void evas_font_dir_cache_free(void);
char *evas_font_dir_cache_find(char *dir, char *font);
void evas_font_free(Evas *evas, void *font);
void *evas_font_load(Evas *evas, const char *name, const char *source, int size);
void evas_font_load_hinting_set(Evas *evas, void *font, int hinting);
void evas_object_smart_member_cache_invalidate(Evas_Object *obj);
void evas_text_style_pad_get(Evas_Text_Style_Type style, int *l, int *r, int *t, int *b);
void _evas_object_text_rehint(Evas_Object *obj);
void _evas_object_textblock_rehint(Evas_Object *obj);
extern int _evas_alloc_error;
struct _Evas_Imaging_Image