From 1db5428786fb72b71e16a2680dd85ad983c9bf53 Mon Sep 17 00:00:00 2001 From: ChrisDill Date: Tue, 15 Feb 2022 19:59:26 +0000 Subject: [PATCH] Review font functions --- Raylib-cs/interop/Raylib.cs | 10 +++++----- Raylib-cs/types/Raylib.Utils.cs | 7 +++++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Raylib-cs/interop/Raylib.cs b/Raylib-cs/interop/Raylib.cs index 059065d..eeaec0d 100644 --- a/Raylib-cs/interop/Raylib.cs +++ b/Raylib-cs/interop/Raylib.cs @@ -1431,7 +1431,7 @@ namespace Raylib_cs /// Load font from file with extended parameters [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] - public static extern Font LoadFontEx(sbyte* fileName, int fontSize, int[] fontChars, int charsCount); + public static extern Font LoadFontEx(sbyte* fileName, int fontSize, int* fontChars, int glyphCount); /// Load font from Image (XNA style) [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] @@ -1440,19 +1440,19 @@ namespace Raylib_cs /// Load font from memory buffer, fileType refers to extension: i.e. "ttf"
/// fileData refers to const unsigned char *
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] - public static extern Font LoadFontFromMemory(sbyte* fileType, byte* fileData, int dataSize, int fontSize, int[] fontChars, int charsCount); + public static extern Font LoadFontFromMemory(sbyte* fileType, byte* fileData, int dataSize, int fontSize, int* fontChars, int glyphCount); /// Load font data for further use [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] - public static extern GlyphInfo* LoadFontData(byte* fileData, int dataSize, int fontSize, int[] fontChars, int charsCount, FontType type); + public static extern GlyphInfo* LoadFontData(byte* fileData, int dataSize, int fontSize, int* fontChars, int glyphCount, FontType type); /// Generate image font atlas using chars info [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] - public static extern Image GenImageFontAtlas(GlyphInfo* chars, Rectangle** recs, int charsCount, int fontSize, int padding, int packMethod); + public static extern Image GenImageFontAtlas(GlyphInfo* chars, Rectangle** recs, int glyphCount, int fontSize, int padding, int packMethod); /// Unload font chars info data (RAM) [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] - public static extern void UnloadFontData(GlyphInfo* chars, int charsCount); + public static extern void UnloadFontData(GlyphInfo* chars, int glyphCount); /// Unload Font from GPU memory (VRAM) [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] diff --git a/Raylib-cs/types/Raylib.Utils.cs b/Raylib-cs/types/Raylib.Utils.cs index 2788663..4d6ab6d 100644 --- a/Raylib-cs/types/Raylib.Utils.cs +++ b/Raylib-cs/types/Raylib.Utils.cs @@ -590,10 +590,13 @@ namespace Raylib_cs } /// Load font from file with extended parameters - public static Font LoadFontEx(string fileName, int fontSize, int[] fontChars, int charsCount) + public static Font LoadFontEx(string fileName, int fontSize, int[] fontChars, int glyphCount) { using var str1 = fileName.ToUTF8Buffer(); - return LoadFontEx(str1.AsPointer(), fontSize, fontChars, charsCount); + fixed (int* p = fontChars) + { + return LoadFontEx(str1.AsPointer(), fontSize, p, glyphCount); + } } /// Upload vertex data into GPU and provided VAO/VBO ids