Enlightenment CVS committal

Author  : raster
Project : e17
Module  : libs/evas

Dir     : e17/libs/evas/src/lib/engines/common


Modified Files:
        evas_font_draw.c evas_font_load.c 


Log Message:


evas lets you choose font hinting - in theory. :)
===================================================================
RCS file: 
/cvsroot/enlightenment/e17/libs/evas/src/lib/engines/common/evas_font_draw.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -3 -r1.20 -r1.21
--- evas_font_draw.c    11 Dec 2005 04:55:20 -0000      1.20
+++ evas_font_draw.c    27 Feb 2006 14:03:27 -0000      1.21
@@ -6,6 +6,7 @@
    RGBA_Font_Glyph *fg;
    char key[6];
    FT_Error error;
+   FT_Int32 lflags;
 
    key[0] = ((index       ) & 0x7f) + 1;
    key[1] = ((index >> 7  ) & 0x7f) + 1;
@@ -18,8 +19,11 @@
    if (fg) return fg;
    
 //   error = FT_Load_Glyph(fi->src->ft.face, index, FT_LOAD_NO_BITMAP);
-   error = FT_Load_Glyph(fi->src->ft.face, index,
-                        FT_LOAD_RENDER);
+   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);
    if (error) return NULL;
 
    fg = malloc(sizeof(struct _RGBA_Font_Glyph));
===================================================================
RCS file: 
/cvsroot/enlightenment/e17/libs/evas/src/lib/engines/common/evas_font_load.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -3 -r1.28 -r1.29
--- evas_font_load.c    2 Dec 2005 03:15:08 -0000       1.28
+++ evas_font_load.c    27 Feb 2006 14:03:27 -0000      1.29
@@ -232,11 +232,13 @@
    if (!fi) return NULL;
    fn = calloc(1, sizeof(RGBA_Font));
    if (!fn)
-      {
-         free(fi);
-         return NULL;
-      }
+     {
+       free(fi);
+       return NULL;
+     }
    fn->fonts = evas_list_append(fn->fonts, fi);
+   fn->hinting = FONT_BYTECODE_HINT;
+   fi->hinting = fn->hinting;
    return fn;
 }
 
@@ -250,11 +252,13 @@
    if (!fi) return NULL;
    fn = calloc(1, sizeof(RGBA_Font));
    if (!fn)
-      {
-         free(fi);
-         return NULL;
-      }
+     {
+       free(fi);
+       return NULL;
+     }
    fn->fonts = evas_list_append(fn->fonts, fi);
+   fn->hinting = FONT_BYTECODE_HINT;
+   fi->hinting = fn->hinting;
    return fn;
 }
 
@@ -271,6 +275,7 @@
        fn->fonts = evas_list_append(fn->fonts, fi);
        return fn;
      }
+   fi->hinting = fn->hinting;
    return NULL;
 }
 
@@ -287,6 +292,7 @@
        fn->fonts = evas_list_append(fn->fonts, fi);
        return fn;
      }
+   fi->hinting = fn->hinting;
    return NULL;
 }
 
@@ -313,6 +319,46 @@
    free(fn);
 }
 
+void
+evas_common_font_hinting_set(RGBA_Font *fn, Font_Hint_Flags hinting)
+{
+   Evas_List *l;
+   
+   if (!fn)
+     return;
+   fn->hinting = hinting;
+   for (l = fn->fonts; l; l = l->next)
+     {
+       RGBA_Font_Int *fi;
+
+       fi = l->data;
+       fi->hinting = fn->hinting;
+     }
+}
+
+Evas_Bool
+evas_common_hinting_available(Font_Hint_Flags hinting)
+{
+   if (hinting == FONT_NO_HINT) return 1;
+   else if (hinting == FONT_AUTO_HINT)
+     {
+#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
+       return 1;
+#else  
+       return 0;
+#endif
+     }
+   else if (hinting == FONT_BYTECODE_HINT)
+     {
+#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
+       return 1;
+#else
+       return 0;
+#endif
+     }
+   return 0;
+}
+
 static Evas_Bool
 font_modify_cache_cb(Evas_Hash *hash, const char *key, void *data, void *fdata)
 {




-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to