From 1c6261532ccedaa715641d676ff2a93e3c9dbbaf Mon Sep 17 00:00:00 2001 From: Nick Gravelyn Date: Sat, 31 May 2014 16:16:28 -0700 Subject: [PATCH 1/3] Added RWops versions of OpenFont to support loading TTFs from memory. --- src/SDL2_ttf.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/SDL2_ttf.cs b/src/SDL2_ttf.cs index 94a8e92..7c6d623 100644 --- a/src/SDL2_ttf.cs +++ b/src/SDL2_ttf.cs @@ -100,6 +100,14 @@ namespace SDL2 int ptsize ); + /* IntPtr refers to a SDL_RWops* */ + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr TTF_OpenFontRW( + IntPtr src, + int freesrc, + int ptsize + ); + /* IntPtr refers to a TTF_Font* */ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr TTF_OpenFontIndex( @@ -109,6 +117,15 @@ namespace SDL2 long index ); + /* IntPtr refers to a SDL_RWops* */ + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr TTF_OpenFontIndexRW( + IntPtr src, + int freesrc, + int ptsize, + long index + ); + /* font refers to a TTF_Font* */ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern int TTF_GetFontStyle(IntPtr font); From 07853258b48aaf22b18721651cc32cebf828e019 Mon Sep 17 00:00:00 2001 From: Nick Gravelyn Date: Sat, 31 May 2014 16:42:33 -0700 Subject: [PATCH 2/3] Adding RWops comment --- src/SDL2_ttf.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/SDL2_ttf.cs b/src/SDL2_ttf.cs index 7c6d623..fca8782 100644 --- a/src/SDL2_ttf.cs +++ b/src/SDL2_ttf.cs @@ -101,6 +101,7 @@ namespace SDL2 ); /* IntPtr refers to a SDL_RWops* */ + /* THIS IS AN RWops FUNCTION! */ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr TTF_OpenFontRW( IntPtr src, @@ -118,6 +119,7 @@ namespace SDL2 ); /* IntPtr refers to a SDL_RWops* */ + /* THIS IS AN RWops FUNCTION! */ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr TTF_OpenFontIndexRW( IntPtr src, From 37058ed972f2a598d50b2c9f22d08e3181f99903 Mon Sep 17 00:00:00 2001 From: Nick Gravelyn Date: Sat, 31 May 2014 16:43:26 -0700 Subject: [PATCH 3/3] Fixing comments. --- src/SDL2_ttf.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/SDL2_ttf.cs b/src/SDL2_ttf.cs index fca8782..820f3b6 100644 --- a/src/SDL2_ttf.cs +++ b/src/SDL2_ttf.cs @@ -100,7 +100,8 @@ namespace SDL2 int ptsize ); - /* IntPtr refers to a SDL_RWops* */ + /* IntPtr refers to a TTF_Font* */ + /* src refers to an SDL_RWops* */ /* THIS IS AN RWops FUNCTION! */ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr TTF_OpenFontRW( @@ -118,7 +119,8 @@ namespace SDL2 long index ); - /* IntPtr refers to a SDL_RWops* */ + /* IntPtr refers to a TTF_Font* */ + /* src refers to an SDL_RWops* */ /* THIS IS AN RWops FUNCTION! */ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr TTF_OpenFontIndexRW(