freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2] gsoc-anurag-2023-final b2f570a2b 08/11: [dense] Implement FT


From: Werner Lemberg
Subject: [freetype2] gsoc-anurag-2023-final b2f570a2b 08/11: [dense] Implement FT_New_Face2 and fix glyph loading
Date: Mon, 9 Oct 2023 18:16:50 -0400 (EDT)

branch: gsoc-anurag-2023-final
commit b2f570a2bbcd7c3872dbb5dfa8240d8edbc6bade
Author: Anurag Thakur <anurag105csec21@bpitindia.edu.in>
Commit: Anurag Thakur <anurag105csec21@bpitindia.edu.in>

    [dense] Implement FT_New_Face2 and fix glyph loading
    
    * include/freetype/freetype.h: Add filed "size" to FT_Open_Args
    
    * src/base/ftobjs.c: Use slot from face's glyph_array in FT_Load_Glyph
    Implement FT_New_Face2
---
 include/freetype/freetype.h |  5 +++++
 src/base/ftobjs.c           | 23 ++++++++++++++++++++++-
 2 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h
index 3f9769976..2079ae663 100644
--- a/include/freetype/freetype.h
+++ b/include/freetype/freetype.h
@@ -2534,6 +2534,10 @@ FT_BEGIN_HEADER
    *   params ::
    *     Extra parameters passed to the font driver when opening a new face.
    *
+   *   size ::
+   *     Size at which the glyphs will be rendered. Use same value as
+   *     @FT_Set_Pixel_Sizes
+   *
    * @note:
    *   The stream type is determined by the contents of `flags`:
    *
@@ -2571,6 +2575,7 @@ FT_BEGIN_HEADER
     FT_Module       driver;
     FT_Int          num_params;
     FT_Parameter*   params;
+    FT_UInt         size;
 
   } FT_Open_Args;
 
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index 148681f57..9bec44fd5 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -922,7 +922,7 @@
     /* The validity test for `glyph_index' is performed by the */
     /* font drivers.                                           */
 
-    slot = face->glyph;
+    slot = face->glyph_array[glyph_index];
     ft_glyphslot_clear( slot );
 
     driver  = face->driver;
@@ -1630,6 +1630,27 @@
     return ft_open_face_internal( library, &args, face_index, aface, 1 );
   }
 
+  FT_EXPORT_DEF( FT_Error )
+  FT_New_Face2( FT_Library   library,
+                const char*  pathname,
+                FT_Long      face_index,
+                FT_Face     *aface,
+                FT_UInt      size)
+  {
+    FT_Open_Args  args;
+
+     /* test for valid `library' and `aface' delayed to `FT_Open_Face' */
+     if ( !pathname )
+       return FT_THROW( Invalid_Argument );
+
+     args.flags    = FT_OPEN_PATHNAME;
+     args.size     = size;
+     args.pathname = (char*)pathname;
+     args.stream   = NULL;
+
+     return ft_open_face_internal( library, &args, face_index, aface, 1 );
+  }
+
 #endif
 
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]