Merge pull request #334 from JupiterRider/master

Change signature of LoadFontFromMemory in raylib/rtext.go
This commit is contained in:
Milan Nikolic 2023-12-29 14:48:53 +01:00 committed by GitHub
commit 6f8b5ec246
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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"
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