Evas text: apply italic correction for run-time slanted texts (disabled).
authortasn <tasn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 29 May 2012 14:43:17 +0000 (14:43 +0000)
committertasn <tasn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 29 May 2012 14:43:17 +0000 (14:43 +0000)
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: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@71506 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/engines/common/evas_font.h
src/lib/engines/common/evas_font_main.c
src/lib/engines/common/evas_font_query.c

index dc6992d..ed6655b 100644 (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);
index 1bbf5c3..94f4f77 100644 (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)
index af2cc84..cd54a29 100644 (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;