From 6656db4829a7d480b35c332f380d90296383e72c Mon Sep 17 00:00:00 2001 From: JupiterRider <60042618+JupiterRider@users.noreply.github.com> Date: Thu, 28 Dec 2023 16:06:40 +0100 Subject: [PATCH] Change signature of LoadFontFromMemory in raylib/rtext.go to match with purego version --- raylib/rtext.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/raylib/rtext.go b/raylib/rtext.go index f791257..35deef8 100644 --- a/raylib/rtext.go +++ b/raylib/rtext.go @@ -74,14 +74,14 @@ func LoadFontFromImage(image Image, key color.RGBA, firstChar int32) Font { } // LoadFontFromMemory - Load font from memory buffer, fileType refers to extension: i.e. ".ttf" -func LoadFontFromMemory(fileType string, fileData []byte, dataSize int32, fontSize int32, fontChars *int32, charsCount int32) Font { +func LoadFontFromMemory(fileType string, fileData []byte, fontSize int32, codepoints []rune) Font { cfileType := C.CString(fileType) defer C.free(unsafe.Pointer(cfileType)) cfileData := (*C.uchar)(unsafe.Pointer(&fileData[0])) - cdataSize := (C.int)(dataSize) + cdataSize := (C.int)(len(fileData)) cfontSize := (C.int)(fontSize) - cfontChars := (*C.int)(unsafe.Pointer(fontChars)) - ccharsCount := (C.int)(charsCount) + cfontChars := (*C.int)(unsafe.SliceData(codepoints)) + ccharsCount := (C.int)(len(codepoints)) ret := C.LoadFontFromMemory(cfileType, cfileData, cdataSize, cfontSize, cfontChars, ccharsCount) v := newFontFromPointer(unsafe.Pointer(&ret)) return v