[Bf-blender-cvs] [4300050e20a] master: Cleanup: rename kerning table to ascii_table

Campbell Barton noreply at git.blender.org
Mon Aug 16 06:36:05 CEST 2021


Commit: 4300050e20a7fa5c06a990c1f7df3792b7fed656
Author: Campbell Barton
Date:   Mon Aug 16 14:13:53 2021 +1000
Branches: master
https://developer.blender.org/rB4300050e20a7fa5c06a990c1f7df3792b7fed656

Cleanup: rename kerning table to ascii_table

It wasn't obvious this was only for ASCII characters.

===================================================================

M	source/blender/blenfont/intern/blf_font.c
M	source/blender/blenfont/intern/blf_glyph.c
M	source/blender/blenfont/intern/blf_internal_types.h

===================================================================

diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c
index 512e2babf74..d9396bd0f90 100644
--- a/source/blender/blenfont/intern/blf_font.c
+++ b/source/blender/blenfont/intern/blf_font.c
@@ -372,7 +372,7 @@ BLI_INLINE void blf_kerning_step_fast(FontBLF *font,
 
   if (g_prev != NULL) {
     if ((c_prev < KERNING_CACHE_TABLE_SIZE) && (c < GLYPH_ASCII_TABLE_SIZE)) {
-      *pen_x_p += font->kerning_cache->table[c][c_prev];
+      *pen_x_p += font->kerning_cache->ascii_table[c][c_prev];
     }
     else {
       FT_Vector delta;
diff --git a/source/blender/blenfont/intern/blf_glyph.c b/source/blender/blenfont/intern/blf_glyph.c
index 35938a7d5c3..a2571860c94 100644
--- a/source/blender/blenfont/intern/blf_glyph.c
+++ b/source/blender/blenfont/intern/blf_glyph.c
@@ -95,10 +95,10 @@ KerningCacheBLF *blf_kerning_cache_new(FontBLF *font, GlyphCacheBLF *gc)
           .y = 0,
       };
       if (g && g_prev && FT_Get_Kerning(font->face, g_prev->idx, g->idx, kc->mode, &delta) == 0) {
-        kc->table[i][j] = (int)delta.x >> 6;
+        kc->ascii_table[i][j] = (int)delta.x >> 6;
       }
       else {
-        kc->table[i][j] = 0;
+        kc->ascii_table[i][j] = 0;
       }
     }
   }
diff --git a/source/blender/blenfont/intern/blf_internal_types.h b/source/blender/blenfont/intern/blf_internal_types.h
index 6bcacc62a30..ece9a5ffae4 100644
--- a/source/blender/blenfont/intern/blf_internal_types.h
+++ b/source/blender/blenfont/intern/blf_internal_types.h
@@ -55,9 +55,11 @@ typedef struct KerningCacheBLF {
   /* kerning mode. */
   FT_UInt mode;
 
-  /* only cache a ascii glyph pairs. Only store the x
-   * offset we are interested in, instead of the full FT_Vector. */
-  int table[KERNING_CACHE_TABLE_SIZE][KERNING_CACHE_TABLE_SIZE];
+  /**
+   * Cache a ascii glyph pairs. Only store the x offset we are interested in,
+   * instead of the full #FT_Vector since it's not used for drawing at the moment.
+   */
+  int ascii_table[KERNING_CACHE_TABLE_SIZE][KERNING_CACHE_TABLE_SIZE];
 } KerningCacheBLF;
 
 typedef struct GlyphCacheBLF {



More information about the Bf-blender-cvs mailing list