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_query.c 


Log Message:


fix font geometry issues...

===================================================================
RCS file: 
/cvsroot/enlightenment/e17/libs/evas/src/lib/engines/common/evas_font_draw.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- evas_font_draw.c    20 Mar 2005 15:57:55 -0000      1.11
+++ evas_font_draw.c    28 Apr 2005 04:57:12 -0000      1.12
@@ -80,7 +80,8 @@
    int im_w, im_h;
    int c;
    RGBA_Font_Int *fi;
-
+   FT_Face pface = NULL;
+   
    fi = fn->fonts->data;
    
    im = dst->image->data;
@@ -131,14 +132,16 @@
        /* hmmm kerning means i can't sanely do my own cached metric tables! */
        /* grrr - this means font face sharing is kinda... not an option if */
        /* you want performance */
-       if ((use_kerning) && (prev_index) && (index))
+        if ((use_kerning) && (prev_index) && (index) &&
+           (pface == fi->src->ft.face))
          {
             FT_Vector delta;
             
-            FT_Get_Kerning(fi->src->ft.face, prev_index, index,
-                           ft_kerning_default, &delta);
-            pen_x += delta.x << 2;
+            if (FT_Get_Kerning(fi->src->ft.face, prev_index, index,
+                               ft_kerning_default, &delta) == 0)
+              pen_x += delta.x << 2;
          }
+       pface = fi->src->ft.face;
        fg = evas_common_font_int_cache_glyph_get(fi, index);
        if (!fg) continue;
        
===================================================================
RCS file: 
/cvsroot/enlightenment/e17/libs/evas/src/lib/engines/common/evas_font_query.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -3 -r1.15 -r1.16
--- evas_font_query.c   20 Mar 2005 15:57:55 -0000      1.15
+++ evas_font_query.c   28 Apr 2005 04:57:12 -0000      1.16
@@ -10,11 +10,13 @@
    int chr;
    FT_UInt prev_index;
    RGBA_Font_Int *fi;
+   FT_Face pface = NULL;
    
    fi = fn->fonts->data;
    
    start_x = 0;
    end_x = 0;
+   
    pen_x = 0;
    pen_y = 0;
    evas_common_font_size_use(fn);
@@ -30,23 +32,30 @@
        gl = evas_common_font_utf8_get_next((unsigned char *)text, &chr);
        if (gl == 0) break;
        index = evas_common_font_glyph_search(fn, &fi, gl);
-       if ((use_kerning) && (prev_index) && (index))
+        /* hmmm kerning means i can't sanely do my own cached metric tables! */
+       /* grrr - this means font face sharing is kinda... not an option if */
+       /* you want performance */
+       if ((use_kerning) && (prev_index) && (index) &&
+           (pface == fi->src->ft.face))
          {
             FT_Vector delta;
             
-            FT_Get_Kerning(fi->src->ft.face, prev_index, index,
-                           ft_kerning_default, &delta);
-            pen_x += delta.x << 2;
+            if (FT_Get_Kerning(fi->src->ft.face, prev_index, index,
+                               ft_kerning_default, &delta) == 0)
+              pen_x += delta.x << 2;
          }
+       pface = fi->src->ft.face;
        fg = evas_common_font_int_cache_glyph_get(fi, index);
        if (!fg) continue;
 
-       chr_x = (pen_x >> 8) + fg->glyph_out->left;
-       chr_y = (pen_y >> 8)  + fg->glyph_out->top;
+        chr_x = (pen_x + (fg->glyph_out->left << 8)) >> 8;
+       chr_y = (pen_y + (fg->glyph_out->top << 8)) >> 8;
        chr_w = fg->glyph_out->bitmap.width;
        
-       if (!prev_index) start_x = chr_x;
-       if ((chr_x + chr_w) > end_x) end_x = chr_x + chr_w;
+       if ((!prev_index) && (chr_x < 0))
+         start_x = chr_x;
+       if ((chr_x + chr_w) > end_x)
+         end_x = chr_x + chr_w;
        
        pen_x += fg->glyph->advance.x >> 8;
        prev_index = index;
@@ -88,6 +97,7 @@
    int chr;
    FT_UInt prev_index;
    RGBA_Font_Int *fi;
+   FT_Face pface = NULL;
    
    fi = fn->fonts->data;
    
@@ -107,19 +117,24 @@
        gl = evas_common_font_utf8_get_next((unsigned char *)text, &chr);
        if (gl == 0) break;
        index = evas_common_font_glyph_search(fn, &fi, gl);
-       if ((use_kerning) && (prev_index) && (index))
+        /* hmmm kerning means i can't sanely do my own cached metric tables! */
+       /* grrr - this means font face sharing is kinda... not an option if */
+       /* you want performance */
+       if ((use_kerning) && (prev_index) && (index) &&
+           (pface == fi->src->ft.face))
          {
             FT_Vector delta;
             
-            FT_Get_Kerning(fi->src->ft.face, prev_index, index,
-                           ft_kerning_default, &delta);
-            pen_x += delta.x << 2;
+            if (FT_Get_Kerning(fi->src->ft.face, prev_index, index,
+                               ft_kerning_default, &delta) == 0)
+              pen_x += delta.x << 2;
          }
+       pface = fi->src->ft.face;
        fg = evas_common_font_int_cache_glyph_get(fi, index);
        if (!fg) continue;
        
-       chr_x = (pen_x >> 8) + fg->glyph_out->left;
-       chr_y = (pen_y >> 8) + fg->glyph_out->top;
+        chr_x = (pen_x + (fg->glyph_out->left << 8)) >> 8;
+       chr_y = (pen_y + (fg->glyph_out->top << 8)) >> 8;
        chr_w = fg->glyph_out->bitmap.width;
        
        pen_x += fg->glyph->advance.x >> 8;
@@ -140,6 +155,7 @@
    int asc, desc;
    FT_UInt prev_index;
    RGBA_Font_Int *fi;
+   FT_Face pface = NULL;
    
    fi = fn->fonts->data;
    
@@ -165,19 +181,28 @@
        if (gl == 0) break;
        index = evas_common_font_glyph_search(fn, &fi, gl);
        kern = 0;
-       if ((use_kerning) && (prev_index) && (index))
+        /* hmmm kerning means i can't sanely do my own cached metric tables! */
+       /* grrr - this means font face sharing is kinda... not an option if */
+       /* you want performance */
+       if ((use_kerning) && (prev_index) && (index) &&
+           (pface == fi->src->ft.face))
          {
-            FT_Get_Kerning(fi->src->ft.face, prev_index, index,
-                           ft_kerning_default, &delta);
-            kern = delta.x << 2;
-            pen_x += kern;
+            FT_Vector delta;
+            
+            if (FT_Get_Kerning(fi->src->ft.face, prev_index, index,
+                               ft_kerning_default, &delta) == 0)
+              {
+                 kern = delta.x << 2;
+                 pen_x += kern;
+              }
          }
+       pface = fi->src->ft.face;
        fg = evas_common_font_int_cache_glyph_get(fi, index);
        if (!fg) continue;
        
        if (kern < 0) kern = 0; 
-       chr_x = ((pen_x - kern) >> 8) + fg->glyph_out->left;
-       chr_y = (pen_y >> 8) + fg->glyph_out->top;
+        chr_x = ((pen_x - kern) + (fg->glyph_out->left << 8)) >> 8;
+       chr_y = (pen_y + (fg->glyph_out->top << 8)) >> 8;
        chr_w = fg->glyph_out->bitmap.width + (kern >> 8);
 /*     if (text[chr]) */
          {
@@ -217,6 +242,7 @@
    int asc, desc;
    FT_UInt prev_index;
    RGBA_Font_Int *fi;
+   FT_Face pface = NULL;
    
    fi = fn->fonts->data;
    
@@ -242,19 +268,28 @@
        if (gl == 0) break;
        index = evas_common_font_glyph_search(fn, &fi, gl);
        kern = 0;
-       if ((use_kerning) && (prev_index) && (index))
+        /* hmmm kerning means i can't sanely do my own cached metric tables! */
+       /* grrr - this means font face sharing is kinda... not an option if */
+       /* you want performance */
+       if ((use_kerning) && (prev_index) && (index) &&
+           (pface == fi->src->ft.face))
          {
-            FT_Get_Kerning(fi->src->ft.face, prev_index, index,
-                           ft_kerning_default, &delta);
-            kern = delta.x << 2;
-            pen_x += kern;
+            FT_Vector delta;
+            
+            if (FT_Get_Kerning(fi->src->ft.face, prev_index, index,
+                               ft_kerning_default, &delta) == 0)
+              {
+                 kern = delta.x << 2;
+                 pen_x += kern;
+              }
          }
+       pface = fi->src->ft.face;
        fg = evas_common_font_int_cache_glyph_get(fi, index);
        if (!fg) continue;
        
        if (kern < 0) kern = 0; 
-       chr_x = ((pen_x - kern) >> 8) + fg->glyph_out->left;
-       chr_y = (pen_y >> 8) + fg->glyph_out->top;
+        chr_x = ((pen_x - kern) + (fg->glyph_out->left << 8)) >> 8;
+       chr_y = (pen_y + (fg->glyph_out->top << 8)) >> 8;
        chr_w = fg->glyph_out->bitmap.width + (kern >> 8);
 /*     if (text[chr]) */
          {




-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans!
Take this survey and enter to win a one-year sub to SourceForge.net
Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start!  http://www.idcswdc.com/cgi-bin/survey?id=105hix
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to