// Package pango was automatically generated by github.com/bnema/puregotk DO NOT EDIT package pango import ( "github.com/ebitengine/purego" "github.com/bnema/puregotk/pkg/core" "github.com/bnema/puregotk/v4/gobject/types" ) // `PangoGravity` represents the orientation of glyphs in a segment // of text. // // This is useful when rendering vertical text layouts. In those situations, // the layout is rotated using a non-identity [struct@Pango.Matrix], and then // glyph orientation is controlled using `PangoGravity`. // // Not every value in this enumeration makes sense for every usage of // `PangoGravity`; for example, %PANGO_GRAVITY_AUTO only can be passed to // [method@Pango.Context.set_base_gravity] and can only be returned by // [method@Pango.Context.get_base_gravity]. // // See also: [enum@Pango.GravityHint] type Gravity int var xGravityGLibType func() types.GType func GravityGLibType() types.GType { return xGravityGLibType() } const ( // Glyphs stand upright (default) <img align="right" valign="center" src="m-south.png"> GravitySouthValue Gravity = 0 // Glyphs are rotated 90 degrees counter-clockwise. <img align="right" valign="center" src="m-east.png"> GravityEastValue Gravity = 1 // Glyphs are upside-down. <img align="right" valign="cener" src="m-north.png"> GravityNorthValue Gravity = 2 // Glyphs are rotated 90 degrees clockwise. <img align="right" valign="center" src="m-west.png"> GravityWestValue Gravity = 3 // Gravity is resolved from the context matrix GravityAutoValue Gravity = 4 ) // `PangoGravityHint` defines how horizontal scripts should behave in a // vertical context. // // That is, English excerpts in a vertical paragraph for example. // // See also [enum@Pango.Gravity] type GravityHint int var xGravityHintGLibType func() types.GType func GravityHintGLibType() types.GType { return xGravityHintGLibType() } const ( // scripts will take their natural gravity based // on the base gravity and the script. This is the default. GravityHintNaturalValue GravityHint = 0 // always use the base gravity set, regardless of // the script. GravityHintStrongValue GravityHint = 1 // for scripts not in their natural direction (eg. // Latin in East gravity), choose per-script gravity such that every script // respects the line progression. This means, Latin and Arabic will take // opposite gravities and both flow top-to-bottom for example. GravityHintLineValue GravityHint = 2 ) var xGravityGetForMatrix func(*Matrix) Gravity // Finds the gravity that best matches the rotation component // in a `PangoMatrix`. func GravityGetForMatrix(MatrixVar *Matrix) Gravity { cret := xGravityGetForMatrix(MatrixVar) return cret } var xGravityGetForScript func(Script, Gravity, GravityHint) Gravity // Returns the gravity to use in laying out a `PangoItem`. // // The gravity is determined based on the script, base gravity, and hint. // // If @base_gravity is %PANGO_GRAVITY_AUTO, it is first replaced with the // preferred gravity of @script. To get the preferred gravity of a script, // pass %PANGO_GRAVITY_AUTO and %PANGO_GRAVITY_HINT_STRONG in. func GravityGetForScript(ScriptVar Script, BaseGravityVar Gravity, HintVar GravityHint) Gravity { cret := xGravityGetForScript(ScriptVar, BaseGravityVar, HintVar) return cret } var xGravityGetForScriptAndWidth func(Script, bool, Gravity, GravityHint) Gravity // Returns the gravity to use in laying out a single character // or `PangoItem`. // // The gravity is determined based on the script, East Asian width, // base gravity, and hint, // // This function is similar to [func@Pango.Gravity.get_for_script] except // that this function makes a distinction between narrow/half-width and // wide/full-width characters also. Wide/full-width characters always // stand *upright*, that is, they always take the base gravity, // whereas narrow/full-width characters are always rotated in vertical // context. // // If @base_gravity is %PANGO_GRAVITY_AUTO, it is first replaced with the // preferred gravity of @script. func GravityGetForScriptAndWidth(ScriptVar Script, WideVar bool, BaseGravityVar Gravity, HintVar GravityHint) Gravity { cret := xGravityGetForScriptAndWidth(ScriptVar, WideVar, BaseGravityVar, HintVar) return cret } var xGravityToRotation func(Gravity) float64 // Converts a `PangoGravity` value to its natural rotation in radians. // // Note that [method@Pango.Matrix.rotate] takes angle in degrees, not radians. // So, to call [method@Pango.Matrix,rotate] with the output of this function // you should multiply it by (180. / G_PI). func GravityToRotation(GravityVar Gravity) float64 { cret := xGravityToRotation(GravityVar) return cret } 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(&xGravityGLibType, libs, "pango_gravity_get_type") core.PuregoSafeRegister(&xGravityHintGLibType, libs, "pango_gravity_hint_get_type") core.PuregoSafeRegister(&xGravityGetForMatrix, libs, "pango_gravity_get_for_matrix") core.PuregoSafeRegister(&xGravityGetForScript, libs, "pango_gravity_get_for_script") core.PuregoSafeRegister(&xGravityGetForScriptAndWidth, libs, "pango_gravity_get_for_script_and_width") core.PuregoSafeRegister(&xGravityToRotation, libs, "pango_gravity_to_rotation") }