Example #1
0
// OpenFontIndexRW (https://www.libsdl.org/projects/SDL_ttf/docs/SDL_ttf_17.html#SEC17)
func OpenFontIndexRW(src *sdl.RWops, freesrc, size, index int) (*Font, error) {
	_src := (*C.SDL_RWops)(unsafe.Pointer(src))
	_freesrc := (C.int)(freesrc)
	_size := (C.int)(size)
	_index := (C.long)(index)
	f := (*C.TTF_Font)(C.TTF_OpenFontIndexRW(_src, _freesrc, _size, _index))

	if f == nil {
		return nil, GetError()
	}
	return &Font{f}, nil
}
Example #2
0
// Loads a font from an RWops containing multiple font faces at the specified
// point size.
func OpenFontIndexRW(rw *sdl.RWops, ac bool, ptsize int, i int64) *Font {
	acArg := C.int(0)
	if ac {
		acArg = 1
	}

	cfont := C.TTF_OpenFontIndexRW((*C.SDL_RWops)(unsafe.Pointer(rw)), acArg, C.int(ptsize), C.long(i))
	if cfont == nil {
		return nil
	}

	return &Font{cfont}
}