// Package pango was automatically generated by github.com/bnema/puregotk DO NOT EDIT package pango import ( "structs" "unsafe" "github.com/ebitengine/purego" "github.com/bnema/puregotk/pkg/core" "github.com/bnema/puregotk/v4/glib" "github.com/bnema/puregotk/v4/gobject" "github.com/bnema/puregotk/v4/gobject/types" ) // Callback used when enumerating fonts in a fontset. // // See [method@Pango.Fontset.foreach]. type FontsetForeachFunc func(uintptr, uintptr, uintptr) bool // The `PangoFontsetClass` structure holds the virtual functions for // a particular `PangoFontset` implementation. type FontsetClass struct { _ structs.HostLayout ParentClass gobject.ObjectClass xGetFont uintptr xGetMetrics uintptr xGetLanguage uintptr xForeach uintptr xPangoReserved1 uintptr xPangoReserved2 uintptr xPangoReserved3 uintptr xPangoReserved4 uintptr } func (x *FontsetClass) GoPointer() uintptr { return uintptr(unsafe.Pointer(x)) } // OverrideGetFont sets the "get_font" callback function. // a function to get the font in the fontset that contains the // // best glyph for the given Unicode character; see [method@Pango.Fontset.get_font] func (x *FontsetClass) OverrideGetFont(cb func(*Fontset, uint) *Font) { if cb == nil { x.xGetFont = 0 } else { x.xGetFont = purego.NewCallback(func(FontsetVarp uintptr, WcVarp uint) uintptr { ret := cb(FontsetNewFromInternalPtr(FontsetVarp), WcVarp) if ret == nil { return 0 } return ret.GoPointer() }) } } // GetGetFont gets the "get_font" callback function. // a function to get the font in the fontset that contains the // // best glyph for the given Unicode character; see [method@Pango.Fontset.get_font] func (x *FontsetClass) GetGetFont() func(*Fontset, uint) *Font { if x.xGetFont == 0 { return nil } var rawCallback func(FontsetVarp uintptr, WcVarp uint) uintptr purego.RegisterFunc(&rawCallback, x.xGetFont) return func(FontsetVar *Fontset, WcVar uint) *Font { rawRet := rawCallback(FontsetVar.GoPointer(), WcVar) if rawRet == 0 { return nil } ret := &Font{} ret.Ptr = rawRet return ret } } // OverrideGetMetrics sets the "get_metrics" callback function. // a function to get overall metric information for the fonts // // in the fontset; see [method@Pango.Fontset.get_metrics] func (x *FontsetClass) OverrideGetMetrics(cb func(*Fontset) *FontMetrics) { if cb == nil { x.xGetMetrics = 0 } else { x.xGetMetrics = purego.NewCallback(func(FontsetVarp uintptr) *FontMetrics { return cb(FontsetNewFromInternalPtr(FontsetVarp)) }) } } // GetGetMetrics gets the "get_metrics" callback function. // a function to get overall metric information for the fonts // // in the fontset; see [method@Pango.Fontset.get_metrics] func (x *FontsetClass) GetGetMetrics() func(*Fontset) *FontMetrics { if x.xGetMetrics == 0 { return nil } var rawCallback func(FontsetVarp uintptr) *FontMetrics purego.RegisterFunc(&rawCallback, x.xGetMetrics) return func(FontsetVar *Fontset) *FontMetrics { return rawCallback(FontsetVar.GoPointer()) } } // OverrideGetLanguage sets the "get_language" callback function. // a function to get the language of the fontset. func (x *FontsetClass) OverrideGetLanguage(cb func(*Fontset) *Language) { if cb == nil { x.xGetLanguage = 0 } else { x.xGetLanguage = purego.NewCallback(func(FontsetVarp uintptr) *Language { return cb(FontsetNewFromInternalPtr(FontsetVarp)) }) } } // GetGetLanguage gets the "get_language" callback function. // a function to get the language of the fontset. func (x *FontsetClass) GetGetLanguage() func(*Fontset) *Language { if x.xGetLanguage == 0 { return nil } var rawCallback func(FontsetVarp uintptr) *Language purego.RegisterFunc(&rawCallback, x.xGetLanguage) return func(FontsetVar *Fontset) *Language { return rawCallback(FontsetVar.GoPointer()) } } // OverrideForeach sets the "foreach" callback function. // Callback used when enumerating fonts in a fontset. // // See [method@Pango.Fontset.foreach]. func (x *FontsetClass) OverrideForeach(cb func(*Fontset, *FontsetForeachFunc, uintptr)) { if cb == nil { x.xForeach = 0 } else { x.xForeach = purego.NewCallback(func(FontsetVarp uintptr, FuncVarp uintptr, DataVarp uintptr) { cb(FontsetNewFromInternalPtr(FontsetVarp), (*FontsetForeachFunc)(unsafe.Pointer(FuncVarp)), DataVarp) }) } } // GetForeach gets the "foreach" callback function. // Callback used when enumerating fonts in a fontset. // // See [method@Pango.Fontset.foreach]. func (x *FontsetClass) GetForeach() func(*Fontset, *FontsetForeachFunc, uintptr) { if x.xForeach == 0 { return nil } var rawCallback func(FontsetVarp uintptr, FuncVarp uintptr, DataVarp uintptr) purego.RegisterFunc(&rawCallback, x.xForeach) return func(FontsetVar *Fontset, FuncVar *FontsetForeachFunc, DataVar uintptr) { rawCallback(FontsetVar.GoPointer(), glib.NewCallback(FuncVar), DataVar) } } // OverridePangoReserved1 sets the "_pango_reserved1" callback function. func (x *FontsetClass) OverridePangoReserved1(cb func()) { if cb == nil { x.xPangoReserved1 = 0 } else { x.xPangoReserved1 = purego.NewCallback(func() { cb() }) } } // GetPangoReserved1 gets the "_pango_reserved1" callback function. func (x *FontsetClass) GetPangoReserved1() func() { if x.xPangoReserved1 == 0 { return nil } var rawCallback func() purego.RegisterFunc(&rawCallback, x.xPangoReserved1) return func() { rawCallback() } } // OverridePangoReserved2 sets the "_pango_reserved2" callback function. func (x *FontsetClass) OverridePangoReserved2(cb func()) { if cb == nil { x.xPangoReserved2 = 0 } else { x.xPangoReserved2 = purego.NewCallback(func() { cb() }) } } // GetPangoReserved2 gets the "_pango_reserved2" callback function. func (x *FontsetClass) GetPangoReserved2() func() { if x.xPangoReserved2 == 0 { return nil } var rawCallback func() purego.RegisterFunc(&rawCallback, x.xPangoReserved2) return func() { rawCallback() } } // OverridePangoReserved3 sets the "_pango_reserved3" callback function. func (x *FontsetClass) OverridePangoReserved3(cb func()) { if cb == nil { x.xPangoReserved3 = 0 } else { x.xPangoReserved3 = purego.NewCallback(func() { cb() }) } } // GetPangoReserved3 gets the "_pango_reserved3" callback function. func (x *FontsetClass) GetPangoReserved3() func() { if x.xPangoReserved3 == 0 { return nil } var rawCallback func() purego.RegisterFunc(&rawCallback, x.xPangoReserved3) return func() { rawCallback() } } // OverridePangoReserved4 sets the "_pango_reserved4" callback function. func (x *FontsetClass) OverridePangoReserved4(cb func()) { if cb == nil { x.xPangoReserved4 = 0 } else { x.xPangoReserved4 = purego.NewCallback(func() { cb() }) } } // GetPangoReserved4 gets the "_pango_reserved4" callback function. func (x *FontsetClass) GetPangoReserved4() func() { if x.xPangoReserved4 == 0 { return nil } var rawCallback func() purego.RegisterFunc(&rawCallback, x.xPangoReserved4) return func() { rawCallback() } } // A `PangoFontset` represents a set of `PangoFont` to use when rendering text. // // A `PangoFontset` is the result of resolving a `PangoFontDescription` // against a particular `PangoContext`. It has operations for finding the // component font for a particular Unicode character, and for finding a // composite set of metrics for the entire fontset. type Fontset struct { gobject.Object } var xFontsetGLibType func() types.GType func FontsetGLibType() types.GType { return xFontsetGLibType() } func FontsetNewFromInternalPtr(ptr uintptr) *Fontset { cls := &Fontset{} cls.Ptr = ptr return cls } var xFontsetForeach func(uintptr, uintptr, uintptr) // Iterates through all the fonts in a fontset, calling @func for // each one. // // If @func returns %TRUE, that stops the iteration. func (x *Fontset) Foreach(FuncVar *FontsetForeachFunc, DataVar uintptr) { var FuncVarRef uintptr if FuncVar != nil { FuncVarPtr := uintptr(unsafe.Pointer(FuncVar)) if cbRefPtr, ok := glib.GetCallback(FuncVarPtr); ok { FuncVarRef = cbRefPtr } else { fcb := func(arg0 uintptr, arg1 uintptr, arg2 uintptr) bool { cbFn := *FuncVar return cbFn(arg0, arg1, arg2) } FuncVarRef = purego.NewCallback(fcb) glib.SaveCallbackWithClosure(FuncVarPtr, FuncVarRef, FuncVar) } } xFontsetForeach(x.GoPointer(), FuncVarRef, DataVar) } var xFontsetGetFont func(uintptr, uint) uintptr // Returns the font in the fontset that contains the best // glyph for a Unicode character. func (x *Fontset) GetFont(WcVar uint) *Font { var cls *Font cret := xFontsetGetFont(x.GoPointer(), WcVar) if cret == 0 { return nil } cls = &Font{} cls.Ptr = cret return cls } var xFontsetGetMetrics func(uintptr) *FontMetrics // Get overall metric information for the fonts in the fontset. func (x *Fontset) GetMetrics() *FontMetrics { cret := xFontsetGetMetrics(x.GoPointer()) return cret } func (c *Fontset) GoPointer() uintptr { if c == nil { return 0 } return c.Ptr } func (c *Fontset) SetGoPointer(ptr uintptr) { c.Ptr = ptr } func init() { core.SetPackageName("PANGO", "pango") core.SetSharedLibraries("PANGO", []string{"libpango-1.0.so.0"}) var libs []uintptr for _, libPath := range core.GetPaths("PANGO") { lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL) if err != nil { panic(err) } libs = append(libs, lib) } core.PuregoSafeRegister(&xFontsetGLibType, libs, "pango_fontset_get_type") core.PuregoSafeRegister(&xFontsetForeach, libs, "pango_fontset_foreach") core.PuregoSafeRegister(&xFontsetGetFont, libs, "pango_fontset_get_font") core.PuregoSafeRegister(&xFontsetGetMetrics, libs, "pango_fontset_get_metrics") }