// 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/gobject" "github.com/bnema/puregotk/v4/gobject/types" ) type ContextClass struct { _ structs.HostLayout } func (x *ContextClass) GoPointer() uintptr { return uintptr(unsafe.Pointer(x)) } // A `PangoContext` stores global information used to control the // itemization process. // // The information stored by `PangoContext` includes the fontmap used // to look up fonts, and default values such as the default language, // default gravity, or default font. // // To obtain a `PangoContext`, use [method@Pango.FontMap.create_context]. type Context struct { gobject.Object } var xContextGLibType func() types.GType func ContextGLibType() types.GType { return xContextGLibType() } func ContextNewFromInternalPtr(ptr uintptr) *Context { cls := &Context{} cls.Ptr = ptr return cls } var xNewContext func() uintptr // Creates a new `PangoContext` initialized to default values. // // This function is not particularly useful as it should always // be followed by a [method@Pango.Context.set_font_map] call, and the // function [method@Pango.FontMap.create_context] does these two steps // together and hence users are recommended to use that. // // If you are using Pango as part of a higher-level system, // that system may have it's own way of create a `PangoContext`. // For instance, the GTK toolkit has, among others, // `gtk_widget_get_pango_context()`. Use those instead. func NewContext() *Context { var cls *Context cret := xNewContext() if cret == 0 { return nil } cls = &Context{} cls.Ptr = cret return cls } var xContextChanged func(uintptr) // Forces a change in the context, which will cause any `PangoLayout` // using this context to re-layout. // // This function is only useful when implementing a new backend // for Pango, something applications won't do. Backends should // call this function if they have attached extra data to the context // and such data is changed. func (x *Context) Changed() { xContextChanged(x.GoPointer()) } var xContextGetBaseDir func(uintptr) Direction // Retrieves the base direction for the context. // // See [method@Pango.Context.set_base_dir]. func (x *Context) GetBaseDir() Direction { cret := xContextGetBaseDir(x.GoPointer()) return cret } var xContextGetBaseGravity func(uintptr) Gravity // Retrieves the base gravity for the context. // // See [method@Pango.Context.set_base_gravity]. func (x *Context) GetBaseGravity() Gravity { cret := xContextGetBaseGravity(x.GoPointer()) return cret } var xContextGetFontDescription func(uintptr) *FontDescription // Retrieve the default font description for the context. func (x *Context) GetFontDescription() *FontDescription { cret := xContextGetFontDescription(x.GoPointer()) return cret } var xContextGetFontMap func(uintptr) uintptr // Gets the `PangoFontMap` used to look up fonts for this context. func (x *Context) GetFontMap() *FontMap { var cls *FontMap cret := xContextGetFontMap(x.GoPointer()) if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &FontMap{} cls.Ptr = cret return cls } var xContextGetGravity func(uintptr) Gravity // Retrieves the gravity for the context. // // This is similar to [method@Pango.Context.get_base_gravity], // except for when the base gravity is %PANGO_GRAVITY_AUTO for // which [func@Pango.Gravity.get_for_matrix] is used to return the // gravity from the current context matrix. func (x *Context) GetGravity() Gravity { cret := xContextGetGravity(x.GoPointer()) return cret } var xContextGetGravityHint func(uintptr) GravityHint // Retrieves the gravity hint for the context. // // See [method@Pango.Context.set_gravity_hint] for details. func (x *Context) GetGravityHint() GravityHint { cret := xContextGetGravityHint(x.GoPointer()) return cret } var xContextGetLanguage func(uintptr) *Language // Retrieves the global language tag for the context. func (x *Context) GetLanguage() *Language { cret := xContextGetLanguage(x.GoPointer()) return cret } var xContextGetMatrix func(uintptr) *Matrix // Gets the transformation matrix that will be applied when // rendering with this context. // // See [method@Pango.Context.set_matrix]. func (x *Context) GetMatrix() *Matrix { cret := xContextGetMatrix(x.GoPointer()) return cret } var xContextGetMetrics func(uintptr, *FontDescription, *Language) *FontMetrics // Get overall metric information for a particular font description. // // Since the metrics may be substantially different for different scripts, // a language tag can be provided to indicate that the metrics should be // retrieved that correspond to the script(s) used by that language. // // The `PangoFontDescription` is interpreted in the same way as by [func@itemize], // and the family name may be a comma separated list of names. If characters // from multiple of these families would be used to render the string, then // the returned fonts would be a composite of the metrics for the fonts loaded // for the individual families. func (x *Context) GetMetrics(DescVar *FontDescription, LanguageVar *Language) *FontMetrics { cret := xContextGetMetrics(x.GoPointer(), DescVar, LanguageVar) return cret } var xContextGetRoundGlyphPositions func(uintptr) bool // Returns whether font rendering with this context should // round glyph positions and widths. func (x *Context) GetRoundGlyphPositions() bool { cret := xContextGetRoundGlyphPositions(x.GoPointer()) return cret } var xContextGetSerial func(uintptr) uint // Returns the current serial number of @context. // // The serial number is initialized to an small number larger than zero // when a new context is created and is increased whenever the context // is changed using any of the setter functions, or the `PangoFontMap` it // uses to find fonts has changed. The serial may wrap, but will never // have the value 0. Since it can wrap, never compare it with "less than", // always use "not equals". // // This can be used to automatically detect changes to a `PangoContext`, // and is only useful when implementing objects that need update when their // `PangoContext` changes, like `PangoLayout`. func (x *Context) GetSerial() uint { cret := xContextGetSerial(x.GoPointer()) return cret } var xContextListFamilies func(uintptr, *uintptr, *int) // List all families for a context. func (x *Context) ListFamilies(FamiliesVar *uintptr, NFamiliesVar *int) { xContextListFamilies(x.GoPointer(), FamiliesVar, NFamiliesVar) } var xContextLoadFont func(uintptr, *FontDescription) uintptr // Loads the font in one of the fontmaps in the context // that is the closest match for @desc. func (x *Context) LoadFont(DescVar *FontDescription) *Font { var cls *Font cret := xContextLoadFont(x.GoPointer(), DescVar) if cret == 0 { return nil } cls = &Font{} cls.Ptr = cret return cls } var xContextLoadFontset func(uintptr, *FontDescription, *Language) uintptr // Load a set of fonts in the context that can be used to render // a font matching @desc. func (x *Context) LoadFontset(DescVar *FontDescription, LanguageVar *Language) *Fontset { var cls *Fontset cret := xContextLoadFontset(x.GoPointer(), DescVar, LanguageVar) if cret == 0 { return nil } cls = &Fontset{} cls.Ptr = cret return cls } var xContextSetBaseDir func(uintptr, Direction) // Sets the base direction for the context. // // The base direction is used in applying the Unicode bidirectional // algorithm; if the @direction is %PANGO_DIRECTION_LTR or // %PANGO_DIRECTION_RTL, then the value will be used as the paragraph // direction in the Unicode bidirectional algorithm. A value of // %PANGO_DIRECTION_WEAK_LTR or %PANGO_DIRECTION_WEAK_RTL is used only // for paragraphs that do not contain any strong characters themselves. func (x *Context) SetBaseDir(DirectionVar Direction) { xContextSetBaseDir(x.GoPointer(), DirectionVar) } var xContextSetBaseGravity func(uintptr, Gravity) // Sets the base gravity for the context. // // The base gravity is used in laying vertical text out. func (x *Context) SetBaseGravity(GravityVar Gravity) { xContextSetBaseGravity(x.GoPointer(), GravityVar) } var xContextSetFontDescription func(uintptr, *FontDescription) // Set the default font description for the context func (x *Context) SetFontDescription(DescVar *FontDescription) { xContextSetFontDescription(x.GoPointer(), DescVar) } var xContextSetFontMap func(uintptr, uintptr) // Sets the font map to be searched when fonts are looked-up // in this context. // // This is only for internal use by Pango backends, a `PangoContext` // obtained via one of the recommended methods should already have a // suitable font map. func (x *Context) SetFontMap(FontMapVar *FontMap) { xContextSetFontMap(x.GoPointer(), FontMapVar.GoPointer()) } var xContextSetGravityHint func(uintptr, GravityHint) // Sets the gravity hint for the context. // // The gravity hint is used in laying vertical text out, and // is only relevant if gravity of the context as returned by // [method@Pango.Context.get_gravity] is set to %PANGO_GRAVITY_EAST // or %PANGO_GRAVITY_WEST. func (x *Context) SetGravityHint(HintVar GravityHint) { xContextSetGravityHint(x.GoPointer(), HintVar) } var xContextSetLanguage func(uintptr, *Language) // Sets the global language tag for the context. // // The default language for the locale of the running process // can be found using [func@Pango.Language.get_default]. func (x *Context) SetLanguage(LanguageVar *Language) { xContextSetLanguage(x.GoPointer(), LanguageVar) } var xContextSetMatrix func(uintptr, *Matrix) // Sets the transformation matrix that will be applied when rendering // with this context. // // Note that reported metrics are in the user space coordinates before // the application of the matrix, not device-space coordinates after the // application of the matrix. So, they don't scale with the matrix, though // they may change slightly for different matrices, depending on how the // text is fit to the pixel grid. func (x *Context) SetMatrix(MatrixVar *Matrix) { xContextSetMatrix(x.GoPointer(), MatrixVar) } var xContextSetRoundGlyphPositions func(uintptr, bool) // Sets whether font rendering with this context should // round glyph positions and widths to integral positions, // in device units. // // This is useful when the renderer can't handle subpixel // positioning of glyphs. // // The default value is to round glyph positions, to remain // compatible with previous Pango behavior. func (x *Context) SetRoundGlyphPositions(RoundPositionsVar bool) { xContextSetRoundGlyphPositions(x.GoPointer(), RoundPositionsVar) } func (c *Context) GoPointer() uintptr { if c == nil { return 0 } return c.Ptr } func (c *Context) 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(&xContextGLibType, libs, "pango_context_get_type") core.PuregoSafeRegister(&xNewContext, libs, "pango_context_new") core.PuregoSafeRegister(&xContextChanged, libs, "pango_context_changed") core.PuregoSafeRegister(&xContextGetBaseDir, libs, "pango_context_get_base_dir") core.PuregoSafeRegister(&xContextGetBaseGravity, libs, "pango_context_get_base_gravity") core.PuregoSafeRegister(&xContextGetFontDescription, libs, "pango_context_get_font_description") core.PuregoSafeRegister(&xContextGetFontMap, libs, "pango_context_get_font_map") core.PuregoSafeRegister(&xContextGetGravity, libs, "pango_context_get_gravity") core.PuregoSafeRegister(&xContextGetGravityHint, libs, "pango_context_get_gravity_hint") core.PuregoSafeRegister(&xContextGetLanguage, libs, "pango_context_get_language") core.PuregoSafeRegister(&xContextGetMatrix, libs, "pango_context_get_matrix") core.PuregoSafeRegister(&xContextGetMetrics, libs, "pango_context_get_metrics") core.PuregoSafeRegister(&xContextGetRoundGlyphPositions, libs, "pango_context_get_round_glyph_positions") core.PuregoSafeRegister(&xContextGetSerial, libs, "pango_context_get_serial") core.PuregoSafeRegister(&xContextListFamilies, libs, "pango_context_list_families") core.PuregoSafeRegister(&xContextLoadFont, libs, "pango_context_load_font") core.PuregoSafeRegister(&xContextLoadFontset, libs, "pango_context_load_fontset") core.PuregoSafeRegister(&xContextSetBaseDir, libs, "pango_context_set_base_dir") core.PuregoSafeRegister(&xContextSetBaseGravity, libs, "pango_context_set_base_gravity") core.PuregoSafeRegister(&xContextSetFontDescription, libs, "pango_context_set_font_description") core.PuregoSafeRegister(&xContextSetFontMap, libs, "pango_context_set_font_map") core.PuregoSafeRegister(&xContextSetGravityHint, libs, "pango_context_set_gravity_hint") core.PuregoSafeRegister(&xContextSetLanguage, libs, "pango_context_set_language") core.PuregoSafeRegister(&xContextSetMatrix, libs, "pango_context_set_matrix") core.PuregoSafeRegister(&xContextSetRoundGlyphPositions, libs, "pango_context_set_round_glyph_positions") }