Commit 33ac83e37637f9980d674f60a2621f3ff2e2de64

Werner Lemberg 2018-06-14T21:00:23

Add glyph index and glyph load flags to glyph slot. * include/freetype/freetype.h (FT_GlyphSlotRec): Rename unused `reserved' field to `glyph_index'. * include/freetype/internal/ftobjs.h (FT_Slot_InternalRec): Add `load_flags' field. * src/base/ftobjs.c (FT_Load_Glyph): Set new fields.

diff --git a/ChangeLog b/ChangeLog
index d42fc2f..b1bec04 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
 2018-06-14  Werner Lemberg  <wl@gnu.org>
 
+	Add glyph index and glyph load flags to glyph slot.
+
+	* include/freetype/freetype.h (FT_GlyphSlotRec): Rename unused
+	`reserved' field to `glyph_index'.
+
+	* include/freetype/internal/ftobjs.h (FT_Slot_InternalRec): Add
+	`load_flags' field.
+
+	* src/base/ftobjs.c (FT_Load_Glyph): Set new fields.
+
+2018-06-14  Werner Lemberg  <wl@gnu.org>
+
 	[sfnt] Move `CPAL' stuff into separate files.
 
 	* src/sfnt/sfdriver.c: Include `ttcpal.h'.
diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h
index 56a9620..35e6ed6 100644
--- a/include/freetype/freetype.h
+++ b/include/freetype/freetype.h
@@ -1781,6 +1781,10 @@ FT_BEGIN_HEADER
    *     listed through a direct, single-linked list
    *     using its `next' field.
    *
+   *   glyph_index ::
+   *     The glyph index passed as an argument to @FT_Load_Glyph while
+   *     initializeing the glyph slot (since FreeType version 2.10).
+   *
    *   generic ::
    *     A typeless pointer unused by the FreeType
    *     library or any of its drivers.  It can be
@@ -1975,7 +1979,7 @@ FT_BEGIN_HEADER
     FT_Library        library;
     FT_Face           face;
     FT_GlyphSlot      next;
-    FT_UInt           reserved;       /* retained for binary compatibility */
+    FT_UInt           glyph_index; /* new in 2.10; was reserved previously */
     FT_Generic        generic;
 
     FT_Glyph_Metrics  metrics;
diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h
index 18e01b8..9e92a31 100644
--- a/include/freetype/internal/ftobjs.h
+++ b/include/freetype/internal/ftobjs.h
@@ -434,6 +434,10 @@ FT_BEGIN_HEADER
    *
    *   color_layers ::
    *     Data from (SFNT) COLR/CPAL tables.
+   *
+   *   load_flags ::
+   *     The load flags passed as an argument to @FT_Load_Glyph while
+   *     initializing the glyph slot.
    */
 
 #define FT_GLYPH_OWN_BITMAP  0x1U
@@ -449,6 +453,8 @@ FT_BEGIN_HEADER
 
     FT_Colr_Internal  color_layers;
 
+    FT_Int32        load_flags;
+
   } FT_GlyphSlot_InternalRec;
 
 
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index 364d2ad..bd3c039 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -999,6 +999,9 @@
       }
     }
 
+    slot->glyph_index          = glyph_index;
+    slot->internal->load_flags = load_flags;
+
     /* do we need to render the image or preset the bitmap now? */
     if ( !error                                    &&
          ( load_flags & FT_LOAD_NO_SCALE ) == 0    &&