24 lines
692 B
Go
24 lines
692 B
Go
package assets
|
|
|
|
import (
|
|
_ "embed"
|
|
"runtime"
|
|
"unsafe"
|
|
)
|
|
|
|
// uiFont contains the player UI font so the executable does not depend on a
|
|
// machine-specific font installation.
|
|
//
|
|
//go:embed fonts/JetBrainsMonoNLNerdFontMono-Regular.ttf
|
|
var uiFont []byte
|
|
|
|
// PinUIFont returns the embedded font data and a release function. ImGui keeps
|
|
// the supplied pointer until its font atlas is destroyed, so callers must keep
|
|
// the data pinned and invoke release only after destroying the ImGui context.
|
|
func PinUIFont() (data uintptr, size int32, release func()) {
|
|
pinner := new(runtime.Pinner)
|
|
pinner.Pin(&uiFont[0])
|
|
|
|
return uintptr(unsafe.Pointer(&uiFont[0])), int32(len(uiFont)), pinner.Unpin
|
|
}
|