From 16b96d533a95c0afa617515261924c5bbd658827 Mon Sep 17 00:00:00 2001 From: cosmonaut Date: Thu, 7 Dec 2023 23:50:34 -0800 Subject: [PATCH] add DistanceRange to Font --- lib/WellspringCS | 2 +- src/Graphics/Font/Font.cs | 9 ++++++--- src/Graphics/Font/TextBatch.cs | 1 + 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/WellspringCS b/lib/WellspringCS index 82093d2..9d62a80 160000 --- a/lib/WellspringCS +++ b/lib/WellspringCS @@ -1 +1 @@ -Subproject commit 82093d2b0d4ee8510820213cbcd248418528a88c +Subproject commit 9d62a80dc7d5f339d5384bfb4d2954087151409c diff --git a/src/Graphics/Font/Font.cs b/src/Graphics/Font/Font.cs index eafe6d2..a38f899 100644 --- a/src/Graphics/Font/Font.cs +++ b/src/Graphics/Font/Font.cs @@ -9,6 +9,7 @@ namespace MoonWorks.Graphics.Font { public Texture Texture { get; } public float PixelsPerEm { get; } + public float DistanceRange { get; } internal IntPtr Handle { get; } @@ -39,7 +40,8 @@ namespace MoonWorks.Graphics.Font (uint) fontFileByteSpan.Length, (IntPtr) atlasFileByteBuffer, (uint) atlasFileByteSpan.Length, - out float pixelsPerEm + out float pixelsPerEm, + out float distanceRange ); var texture = Texture.FromImageFile(graphicsDevice, commandBuffer, Path.ChangeExtension(fontPath, ".png")); @@ -47,14 +49,15 @@ namespace MoonWorks.Graphics.Font NativeMemory.Free(fontFileByteBuffer); NativeMemory.Free(atlasFileByteBuffer); - return new Font(handle, texture, pixelsPerEm); + return new Font(handle, texture, pixelsPerEm, distanceRange); } - private Font(IntPtr handle, Texture texture, float pixelsPerEm) + private Font(IntPtr handle, Texture texture, float pixelsPerEm, float distanceRange) { Handle = handle; Texture = texture; PixelsPerEm = pixelsPerEm; + DistanceRange = distanceRange; StringBytesLength = 32; StringBytes = (byte*) NativeMemory.Alloc((nuint) StringBytesLength); diff --git a/src/Graphics/Font/TextBatch.cs b/src/Graphics/Font/TextBatch.cs index d9abf6a..d492626 100644 --- a/src/Graphics/Font/TextBatch.cs +++ b/src/Graphics/Font/TextBatch.cs @@ -119,6 +119,7 @@ namespace MoonWorks.Graphics.Font } NativeMemory.Free(StringBytes); + Wellspring.Wellspring_DestroyTextBatch(Handle); IsDisposed = true; }