本文整理匯總了Golang中C.TTF_GetFontStyle函數的典型用法代碼示例。如果您正苦於以下問題:Golang TTF_GetFontStyle函數的具體用法?Golang TTF_GetFontStyle怎麽用?Golang TTF_GetFontStyle使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了TTF_GetFontStyle函數的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: GetStyle
// GetStyle (https://www.libsdl.org/projects/SDL_ttf/docs/SDL_ttf_21.html#SEC21)
func (f *Font) GetStyle() int {
return int(C.TTF_GetFontStyle(f.f))
}
示例2: GetStyle
// Returns the rendering style of the font.
func (f *Font) GetStyle() int {
f.mutex.RLock()
result := int(C.TTF_GetFontStyle(f.cfont))
f.mutex.RUnlock()
return result
}
示例3: TTFGetFontStyle
// Get the style of the font
func TTFGetFontStyle(font *C.TTF_Font) int {
return int(C.TTF_GetFontStyle(font))
}
示例4: ByteSwappedUnicode
package ttf
// #cgo CFLAGS: -Iinclude/
// #cgo darwin LDFLAGS: -lSDL_ttf
// #cgo windows LDFLAGS: -Llib/windows/amd64 -lSDL_ttf
// #include <SDL/SDL_ttf.h>
import "C"
import (
"unsafe"
"github.com/badgerodon/go/sdl"
)
type (
Font struct {
Ptr unsafe.Pointer
}
FontStyle int32
Hinting int32
)
const (
Normal FontStyle = C.TTF_STYLE_NORMAL
Bold FontStyle = C.TTF_STYLE_BOLD
Italic FontStyle = C.TTF_STYLE_ITALIC
Underline FontStyle = C.TTF_STYLE_UNDERLINE
StrikeThrough FontStyle = C.TTF_STYLE_STRIKETHROUGH
NormalHinting Hinting = C.TTF_HINTING_NORMAL
LightHinting Hinting = C.TTF_HINTING_LIGHT
MonoHinting Hinting = C.TTF_HINTING_MONO
NoHinting Hinting = C.TTF_HINTING_NONE
)
func ByteSwappedUnicode(isSwapped bool) {
c_swapped := C.int(0)
if isSwapped {
c_swapped = C.int(1)
}
C.TTF_ByteSwappedUNICODE(c_swapped)
}
func Init() error {
ret := C.TTF_Init()
if ret == 0 {
return nil
}
return sdl.GetError()
}
func WasInit() bool {
ret := C.TTF_WasInit()
if ret == 1 {
return true
}
return false
}
func Quit() {
C.TTF_Quit()
}
func OpenFont(file string, ptsize int) (Font, error) {
c_file := C.CString(file)
defer C.free(unsafe.Pointer(c_file))
c_ptsize := C.int(ptsize)
ret := C.TTF_OpenFont(c_file, c_ptsize)
if ret == nil {
return Font{}, sdl.GetError()
}
return Font{unsafe.Pointer(ret)}, nil
}
func OpenFontIndex(file string, ptsize int, index int64) (Font, error) {
c_file := C.CString(file)
defer C.free(unsafe.Pointer(c_file))
c_ptsize := C.int(ptsize)
c_index := C.long(index)
ret := C.TTF_OpenFontIndex(c_file, c_ptsize, c_index)
if ret == nil {
return Font{}, sdl.GetError()
}
return Font{unsafe.Pointer(ret)}, nil
} /*
func OpenFontRW(src sdl.RWops, freesrc int, ptsize int) Font {
}
func OpenFontIndexRW(src sdl.RWops, freesrc int, ptsize int, index int64) Font {
}
*/
func (this Font) GetStyle() FontStyle {
c_font := (*C.TTF_Font)(this.Ptr)
ret := C.TTF_GetFontStyle(c_font)
return FontStyle(ret)
}
示例5: GetStyle
// Returns the rendering style of the font.
func (f *Font) GetStyle() int {
result := int(C.TTF_GetFontStyle(f.cfont))
return result
}