From 0ffacd6aec80d94cf45a871bd50c9a9321f4ec0d Mon Sep 17 00:00:00 2001 From: cosmonaut Date: Wed, 6 Dec 2023 17:33:41 -0800 Subject: [PATCH 1/4] msdf testing --- WellspringCS.cs | 35 +++++------------------------------ 1 file changed, 5 insertions(+), 30 deletions(-) diff --git a/WellspringCS.cs b/WellspringCS.cs index ea4d0df..7aea1fe 100644 --- a/WellspringCS.cs +++ b/WellspringCS.cs @@ -101,29 +101,9 @@ namespace WellspringCS [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr Wellspring_CreateFont( IntPtr fontBytes, - uint fontBytesLength - ); - - [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] - public static extern IntPtr Wellspring_CreatePacker( - IntPtr Font, - float fontSize, - uint width, - uint height, - uint strideInBytes, - uint padding - ); - - [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] - public static extern uint Wellspring_PackFontRanges( - IntPtr packer, - IntPtr ranges, /* FontRange array */ - uint numRanges - ); - - [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] - public static extern IntPtr Wellspring_GetPixelDataPointer( - IntPtr packer + uint fontBytesLength, + IntPtr atlasJsonBytes, + uint atlasJsonBytesLength ); [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] @@ -132,12 +112,12 @@ namespace WellspringCS [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern void Wellspring_StartTextBatch( IntPtr textBatch, - IntPtr packer + IntPtr font ); [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern byte Wellspring_TextBounds( - IntPtr packer, + IntPtr font, float x, float y, HorizontalAlignment horizontalAlignment, @@ -175,11 +155,6 @@ namespace WellspringCS IntPtr textBatch ); - [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] - public static extern void Wellspring_DestroyPacker( - IntPtr packer - ); - [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern void Wellspring_DestroyFont( IntPtr font -- 2.25.1 From 82093d2b0d4ee8510820213cbcd248418528a88c Mon Sep 17 00:00:00 2001 From: cosmonaut Date: Thu, 7 Dec 2023 22:54:04 -0800 Subject: [PATCH 2/4] ABI changes --- WellspringCS.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/WellspringCS.cs b/WellspringCS.cs index 7aea1fe..5de4f3d 100644 --- a/WellspringCS.cs +++ b/WellspringCS.cs @@ -103,7 +103,8 @@ namespace WellspringCS IntPtr fontBytes, uint fontBytesLength, IntPtr atlasJsonBytes, - uint atlasJsonBytesLength + uint atlasJsonBytesLength, + out float pixelsPerEm ); [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] @@ -118,8 +119,7 @@ namespace WellspringCS [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern byte Wellspring_TextBounds( IntPtr font, - float x, - float y, + int pixelSize, HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment, IntPtr strBytes, /* UTF-8 bytes */ @@ -132,6 +132,7 @@ namespace WellspringCS IntPtr textBatch, float x, float y, + int pixelSize, float depth, in Color color, HorizontalAlignment horizontalAlignment, -- 2.25.1 From 9d62a80dc7d5f339d5384bfb4d2954087151409c Mon Sep 17 00:00:00 2001 From: cosmonaut Date: Thu, 7 Dec 2023 23:49:59 -0800 Subject: [PATCH 3/4] add distanceRange to CreateFont --- WellspringCS.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/WellspringCS.cs b/WellspringCS.cs index 5de4f3d..1e1764e 100644 --- a/WellspringCS.cs +++ b/WellspringCS.cs @@ -104,7 +104,8 @@ namespace WellspringCS uint fontBytesLength, IntPtr atlasJsonBytes, uint atlasJsonBytesLength, - out float pixelsPerEm + out float pixelsPerEm, + out float distanceRange ); [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] -- 2.25.1 From 6e9879505978c6a7f05bc8ee1145587703ede0bf Mon Sep 17 00:00:00 2001 From: cosmonaut Date: Sat, 9 Dec 2023 17:40:17 -0800 Subject: [PATCH 4/4] wellspring API update --- WellspringCS.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/WellspringCS.cs b/WellspringCS.cs index 1e1764e..d685aa4 100644 --- a/WellspringCS.cs +++ b/WellspringCS.cs @@ -129,12 +129,9 @@ namespace WellspringCS ); [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] - public static extern byte Wellspring_Draw( + public static extern byte Wellspring_AddToTextBatch( IntPtr textBatch, - float x, - float y, int pixelSize, - float depth, in Color color, HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment, -- 2.25.1