Add `FT_Done_MM_Var'. This is necessary in case the application's memory routines differ from FreeType. A typical example is a Python application on Windows that calls FreeType compiled as a DLL via the `ctypes' interface. * include/freetype/ftmm.h, src/base/ftmm.c (FT_Done_MM_Var): Declare and define. * docs/CHANGES: Updated.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
diff --git a/ChangeLog b/ChangeLog
index 1c61eae..0ead1e5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2018-01-06 Werner Lemberg <wl@gnu.org>
+
+ Add `FT_Done_MM_Var'.
+
+ This is necessary in case the application's memory routines differ
+ from FreeType. A typical example is a Python application on Windows
+ that calls FreeType compiled as a DLL via the `ctypes' interface.
+
+ * include/freetype/ftmm.h, src/base/ftmm.c (FT_Done_MM_Var): Declare
+ and define.
+
+ * docs/CHANGES: Updated.
+
2018-01-03 Werner Lemberg <wl@gnu.org>
[truetype] Round offsets of glyph components only if hinting is on.
diff --git a/docs/CHANGES b/docs/CHANGES
index b9e3d47..0a83aa2 100644
--- a/docs/CHANGES
+++ b/docs/CHANGES
@@ -56,6 +56,9 @@ CHANGES BETWEEN 2.8.1 and 2.8.2
PostScript name is provided, not looking up special entries for
named instances.
+ - A new function `FT_Done_MM_Var' is provided to free the memory
+ returned in a call to `FT_Get_MM_Var'.
+
- On platforms using the `configure' script, the installed
`ftoption.h' file now correctly reflects configuration options
like `--with-harfbuzz'.
diff --git a/include/freetype/ftmm.h b/include/freetype/ftmm.h
index 8502b88..7ba34bb 100644
--- a/include/freetype/ftmm.h
+++ b/include/freetype/ftmm.h
@@ -286,7 +286,7 @@ FT_BEGIN_HEADER
/* <Output> */
/* amaster :: The variation descriptor. */
/* Allocates a data structure, which the user must */
- /* deallocate with `free' after use. */
+ /* deallocate with a call to @FT_Done_MM_Var after use. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
@@ -299,6 +299,26 @@ FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* <Function> */
+ /* FT_Done_MM_Var */
+ /* */
+ /* <Description> */
+ /* Free the memory allocated by @FT_Get_MM_Var. */
+ /* */
+ /* <Input> */
+ /* library :: A handle of the face's parent library object that was */
+ /* used in the call to @FT_Get_MM_Var to create `amaster'. */
+ /* */
+ /* <Return> */
+ /* FreeType error code. 0~means success. */
+ /* */
+ FT_EXPORT( FT_Error )
+ FT_Done_MM_Var( FT_Library library,
+ FT_MM_Var *amaster );
+
+
+ /*************************************************************************/
+ /* */
+ /* <Function> */
/* FT_Set_MM_Design_Coordinates */
/* */
/* <Description> */
diff --git a/src/base/ftmm.c b/src/base/ftmm.c
index c8b6d13..800441b 100644
--- a/src/base/ftmm.c
+++ b/src/base/ftmm.c
@@ -148,6 +148,25 @@
/* documentation is in ftmm.h */
FT_EXPORT_DEF( FT_Error )
+ FT_Done_MM_Var( FT_Library library,
+ FT_MM_Var* amaster )
+ {
+ FT_Memory memory;
+
+
+ if ( !library )
+ return FT_THROW( Invalid_Library_Handle );
+
+ memory = library->memory;
+ FT_FREE( amaster );
+
+ return FT_Err_Ok;
+ }
+
+
+ /* documentation is in ftmm.h */
+
+ FT_EXPORT_DEF( FT_Error )
FT_Set_MM_Design_Coordinates( FT_Face face,
FT_UInt num_coords,
FT_Long* coords )