Change signature of LoadFontFromMemory in raylib/rtext.go to match with purego version

This commit is contained in:
JupiterRider 2023-12-28 16:06:40 +01:00
parent 6c3c38896e
commit 6656db4829

View file

@ -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" // 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) cfileType := C.CString(fileType)
defer C.free(unsafe.Pointer(cfileType)) defer C.free(unsafe.Pointer(cfileType))
cfileData := (*C.uchar)(unsafe.Pointer(&fileData[0])) cfileData := (*C.uchar)(unsafe.Pointer(&fileData[0]))
cdataSize := (C.int)(dataSize) cdataSize := (C.int)(len(fileData))
cfontSize := (C.int)(fontSize) cfontSize := (C.int)(fontSize)
cfontChars := (*C.int)(unsafe.Pointer(fontChars)) cfontChars := (*C.int)(unsafe.SliceData(codepoints))
ccharsCount := (C.int)(charsCount) ccharsCount := (C.int)(len(codepoints))
ret := C.LoadFontFromMemory(cfileType, cfileData, cdataSize, cfontSize, cfontChars, ccharsCount) ret := C.LoadFontFromMemory(cfileType, cfileData, cdataSize, cfontSize, cfontChars, ccharsCount)
v := newFontFromPointer(unsafe.Pointer(&ret)) v := newFontFromPointer(unsafe.Pointer(&ret))
return v return v