Evas text: apply italic correction for run-time slanted texts (disabled).

Also, put the slant angle calculations in a macro for easier future changes.
Just have it there so people who want it can turn it on.

SVN revision: 71506
This commit is contained in:
Tom Hacohen 2012-05-29 14:43:17 +00:00
parent d7f811fe8f
commit af55fb6217
3 changed files with 18 additions and 3 deletions

View File

@ -2,7 +2,8 @@
#define _EVAS_FONT_H
#include "evas_text_utils.h"
/* The tangent of the slant angle we do on runtime. */
#define _EVAS_FONT_SLANT_TAN 0.221694663
/* main */
EAPI void evas_common_font_init (void);

View File

@ -342,7 +342,8 @@ evas_common_font_int_cache_glyph_get(RGBA_Font_Int *fi, FT_UInt idx)
FT_Error error;
const FT_Int32 hintflags[3] =
{ FT_LOAD_NO_HINTING, FT_LOAD_FORCE_AUTOHINT, FT_LOAD_NO_AUTOHINT };
static FT_Matrix transform = {0x10000, 0x05000, 0x0000, 0x10000}; // about 12 degree.
static FT_Matrix transform = {0x10000, _EVAS_FONT_SLANT_TAN * 0x10000,
0x00000, 0x10000};
evas_common_font_int_promote(fi);
if (fi->fash)

View File

@ -331,11 +331,24 @@ evas_common_font_query_advance(RGBA_Font *fn, const Evas_Text_Props *text_props,
Evas_Coord ret_adv = 0;
if (text_props->len > 0)
{
RGBA_Font_Int *fi = text_props->font_instance;
const Evas_Font_Glyph_Info *glyph = text_props->info->glyph +
text_props->start;
ret_adv = glyph[text_props->len - 1].pen_after;
const Evas_Font_Glyph_Info *last_glyph = glyph + text_props->len - 1;
ret_adv = last_glyph->pen_after;
if (text_props->start > 0)
ret_adv -= glyph[-1].pen_after;
#if 0
/* Runtime slant adjustment. */
if (fi->runtime_rend & FONT_REND_SLANT)
{
RGBA_Font_Glyph *fg =
evas_common_font_int_cache_glyph_get(fi, last_glyph->index);
if (!fg->glyph_out) evas_common_font_int_cache_glyph_render(fg);
ret_adv += fg->glyph_out->bitmap.rows * _EVAS_FONT_SLANT_TAN;
}
#endif
}
if (h_adv) *h_adv = ret_adv;