@@ -86,16 +86,22 @@ func IsFontReady(font Font) bool {
86
86
}
87
87
88
88
// LoadFontData - Load font data for further use
89
- func LoadFontData (fileData []byte , dataSize int32 , fontSize int32 , fontChars * int32 , charsCount , typ int32 ) * GlyphInfo {
89
+ func LoadFontData (fileData []byte , fontSize int32 , codePoints [] int32 , typ int32 ) [] GlyphInfo {
90
90
cfileData := (* C .uchar )(unsafe .Pointer (& fileData [0 ]))
91
- cdataSize := (C .int )(dataSize )
91
+ cdataSize := (C .int )(len ( fileData ) )
92
92
cfontSize := (C .int )(fontSize )
93
- cfontChars := (* C .int )(unsafe .Pointer (fontChars ))
94
- ccharsCount := (C .int )(charsCount )
93
+ ccodePoints := (* C .int )(unsafe .Pointer (& codePoints [ 0 ] ))
94
+ ccodePointCount := (C .int )(len ( codePoints ) )
95
95
ctype := (C .int )(typ )
96
- ret := C .LoadFontData (cfileData , cdataSize , cfontSize , cfontChars , ccharsCount , ctype )
97
- v := newGlyphInfoFromPointer (unsafe .Pointer (& ret ))
98
- return & v
96
+ ret := C .LoadFontData (cfileData , cdataSize , cfontSize , ccodePoints , ccodePointCount , ctype )
97
+ v := unsafe .Slice ((* GlyphInfo )(unsafe .Pointer (ret )), ccodePointCount )
98
+ return v
99
+ }
100
+
101
+ // UnloadFontData - Unload font chars info data (RAM)
102
+ func UnloadFontData (glyphs []GlyphInfo ) {
103
+ cglyphs := (* C .GlyphInfo )(unsafe .Pointer (& glyphs [0 ]))
104
+ C .UnloadFontData (cglyphs , C .int (len (glyphs )))
99
105
}
100
106
101
107
// UnloadFont - Unload Font from GPU memory (VRAM)
0 commit comments