From 2eb72956bfaa39375561ecb19e291fea90da97c1 Mon Sep 17 00:00:00 2001 From: tasn Date: Tue, 29 May 2012 14:43:17 +0000 Subject: [PATCH] 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. git-svn-id: http://svn.enlightenment.org/svn/e/trunk/evas@71506 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/engines/common/evas_font.h | 3 ++- src/lib/engines/common/evas_font_main.c | 3 ++- src/lib/engines/common/evas_font_query.c | 15 ++++++++++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/lib/engines/common/evas_font.h b/src/lib/engines/common/evas_font.h index dc6992d..ed6655b 100644 --- a/src/lib/engines/common/evas_font.h +++ b/src/lib/engines/common/evas_font.h @@ -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); diff --git a/src/lib/engines/common/evas_font_main.c b/src/lib/engines/common/evas_font_main.c index 1bbf5c3..94f4f77 100644 --- a/src/lib/engines/common/evas_font_main.c +++ b/src/lib/engines/common/evas_font_main.c @@ -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) diff --git a/src/lib/engines/common/evas_font_query.c b/src/lib/engines/common/evas_font_query.c index af2cc84..cd54a29 100644 --- a/src/lib/engines/common/evas_font_query.c +++ b/src/lib/engines/common/evas_font_query.c @@ -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; -- 2.7.4