diff --git a/MonoGame.Framework.Content.Pipeline/Graphics/Font/SharpFontImporter.cs b/MonoGame.Framework.Content.Pipeline/Graphics/Font/SharpFontImporter.cs index bea4814ebc0..619134c0a1d 100644 --- a/MonoGame.Framework.Content.Pipeline/Graphics/Font/SharpFontImporter.cs +++ b/MonoGame.Framework.Content.Pipeline/Graphics/Font/SharpFontImporter.cs @@ -55,6 +55,9 @@ public void Import(FontDescription options, string fontName) // The height used to calculate the Y offset for each character. YOffsetMin = -face->size->metrics.ascender >> 6; + + CheckError(FreeType.FT_Done_Face(face)); + CheckError(FreeType.FT_Done_FreeType(library)); } private void CheckError(int error) diff --git a/MonoGame.Framework.Content.Pipeline/Utilities/FreeTypeAPI.cs b/MonoGame.Framework.Content.Pipeline/Utilities/FreeTypeAPI.cs index 758a4b15cf5..abc19c708d1 100644 --- a/MonoGame.Framework.Content.Pipeline/Utilities/FreeTypeAPI.cs +++ b/MonoGame.Framework.Content.Pipeline/Utilities/FreeTypeAPI.cs @@ -246,10 +246,18 @@ unsafe partial class FreeType [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial int FT_Init_FreeType(out FT_Library* library); + [LibraryImport(Library, StringMarshalling = StringMarshalling.Utf8)] + [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] + public static partial int FT_Done_FreeType(FT_Library* library); + [LibraryImport(Library, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial int FT_New_Face(FT_Library* library, string filepathname, long face_index, out FT_Face* aface); + [LibraryImport(Library, StringMarshalling = StringMarshalling.Utf8)] + [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] + public static partial int FT_Done_Face(FT_Face* aface); + [LibraryImport(Library, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial uint FT_Get_Char_Index(FT_Face* face, ulong charcode);