[Bf-blender-cvs] [b030ec8760a] master: BLF Cleanup: Use FreeType Enum FT_Err_Ok

Harley Acheson noreply at git.blender.org
Fri Mar 25 00:23:47 CET 2022


Commit: b030ec8760a0f3ca9b0eb36c265cb35025fdc7ca
Author: Harley Acheson
Date:   Thu Mar 24 16:20:10 2022 -0700
Branches: master
https://developer.blender.org/rBb030ec8760a0f3ca9b0eb36c265cb35025fdc7ca

BLF Cleanup: Use FreeType Enum FT_Err_Ok

Replace comparisons of FT_Error against 0 with FT_Err_Ok instead.

See D14052 for more details.

Differential Revision: https://developer.blender.org/D14052

Reviewed by Campbell Barton

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

M	source/blender/blenfont/intern/blf.c
M	source/blender/blenfont/intern/blf_font.c
M	source/blender/blenfont/intern/blf_glyph.c

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

diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c
index 17d6e431632..2b5a2cdf606 100644
--- a/source/blender/blenfont/intern/blf.c
+++ b/source/blender/blenfont/intern/blf.c
@@ -129,7 +129,7 @@ bool BLF_has_glyph(int fontid, unsigned int unicode)
 {
   FontBLF *font = blf_get(fontid);
   if (font) {
-    return FT_Get_Char_Index(font->face, unicode) != 0;
+    return FT_Get_Char_Index(font->face, unicode) != FT_Err_Ok;
   }
   return false;
 }
diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c
index f833eb96f38..60ff5f6470f 100644
--- a/source/blender/blenfont/intern/blf_font.c
+++ b/source/blender/blenfont/intern/blf_font.c
@@ -1340,7 +1340,7 @@ bool blf_font_size(FontBLF *font, float size, unsigned int dpi)
   size = (float)ft_size / 64.0f;
 
   if (font->size != size || font->dpi != dpi) {
-    if (FT_Set_Char_Size(font->face, 0, ft_size, dpi, dpi) == 0) {
+    if (FT_Set_Char_Size(font->face, 0, ft_size, dpi, dpi) == FT_Err_Ok) {
       font->size = size;
       font->dpi = dpi;
     }
diff --git a/source/blender/blenfont/intern/blf_glyph.c b/source/blender/blenfont/intern/blf_glyph.c
index 4810e46b1d2..28531c5afc1 100644
--- a/source/blender/blenfont/intern/blf_glyph.c
+++ b/source/blender/blenfont/intern/blf_glyph.c
@@ -258,7 +258,7 @@ static FT_GlyphSlot blf_glyph_load(FontBLF *font, FT_UInt glyph_index)
     }
   }
 
-  if (FT_Load_Glyph(font->face, glyph_index, load_flags) == 0) {
+  if (FT_Load_Glyph(font->face, glyph_index, load_flags) == FT_Err_Ok) {
     return font->face->glyph;
   }
   return NULL;
@@ -280,7 +280,7 @@ static bool blf_glyph_render_bitmap(FontBLF *font, FT_GlyphSlot glyph)
 
   /* Render the glyph curves to a bitmap. */
   FT_Error err = FT_Render_Glyph(glyph, render_mode);
-  if (err != 0) {
+  if (err != FT_Err_Ok) {
     return false;
   }



More information about the Bf-blender-cvs mailing list