freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] gsoc-anurag-2023 67c1c3064: Load all glyphs when creating fa


From: Werner Lemberg
Subject: [freetype2] gsoc-anurag-2023 67c1c3064: Load all glyphs when creating face
Date: Wed, 23 Aug 2023 12:26:58 -0400 (EDT)

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

    Load all glyphs when creating face
---
 include/freetype/freetype.h |  1 +
 src/base/ftobjs.c           | 25 ++++++++++++++++++++++++-
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h
index 75f87bca6..cbca9d2be 100644
--- a/include/freetype/freetype.h
+++ b/include/freetype/freetype.h
@@ -1276,6 +1276,7 @@ FT_BEGIN_HEADER
     FT_ListRec        sizes_list;
 
     FT_Generic        autohint;   /* face-specific auto-hinter data */
+    FT_GlyphSlot*     garray;
     void*             extensions; /* unused                         */
 
     FT_Face_Internal  internal;
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index 43681a2af..472bb681c 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -914,7 +914,7 @@
     /* The validity test for `glyph_index' is performed by the */
     /* font drivers.                                           */
 
-    slot = face->glyph;
+    slot = face->garray[face->glyph->glyph_index];
     ft_glyphslot_clear( slot );
 
     driver  = face->driver;
@@ -2782,6 +2782,29 @@
         // FT_Outline_Decompose here
 
       }
+
+      face->garray = (FT_GlyphSlot*)malloc(
+          face->driver->clazz->slot_object_size * face->num_glyphs );
+      error           = FT_Set_Char_Size( face, 0, 160 * 64, 300, 300 );
+      int glyph_index = FT_Get_Char_Index( face, 'A' );
+      // error           = FT_Load_Glyph( face, glyph_index, 
FT_LOAD_NO_HINTING );
+
+      for ( int gindex = 0; gindex < face->num_glyphs; gindex++ )
+      {
+        driver = face->driver;
+        FT_Driver_Class clazz  = driver->clazz;
+        memory = driver->root.memory;
+
+        FT_ALLOC(face->garray[gindex], clazz->slot_object_size);
+        face->garray[gindex]->face = face;
+        ft_glyphslot_init(face->garray[gindex]);
+        face->garray[gindex]->next = face->garray[gindex];
+        face->glyph = face->garray[gindex];
+
+        FT_Load_Glyph(face, glyph_index, FT_LOAD_NO_HINTING);
+      }
+
+
     }
 
     /* some checks */



reply via email to

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