// 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/gio" "github.com/bnema/puregotk/v4/glib" "github.com/bnema/puregotk/v4/gobject" "github.com/bnema/puregotk/v4/gobject/types" ) type FontClass struct { _ structs.HostLayout ParentClass gobject.ObjectClass xDescribe uintptr xGetCoverage uintptr xGetGlyphExtents uintptr xGetMetrics uintptr xGetFontMap uintptr xDescribeAbsolute uintptr xGetFeatures uintptr xCreateHbFont uintptr } func (x *FontClass) GoPointer() uintptr { return uintptr(unsafe.Pointer(x)) } // OverrideDescribe sets the "describe" callback function. func (x *FontClass) OverrideDescribe(cb func(*Font) *FontDescription) { if cb == nil { x.xDescribe = 0 } else { x.xDescribe = purego.NewCallback(func(FontVarp uintptr) *FontDescription { return cb(FontNewFromInternalPtr(FontVarp)) }) } } // GetDescribe gets the "describe" callback function. func (x *FontClass) GetDescribe() func(*Font) *FontDescription { if x.xDescribe == 0 { return nil } var rawCallback func(FontVarp uintptr) *FontDescription purego.RegisterFunc(&rawCallback, x.xDescribe) return func(FontVar *Font) *FontDescription { return rawCallback(FontVar.GoPointer()) } } // OverrideGetCoverage sets the "get_coverage" callback function. func (x *FontClass) OverrideGetCoverage(cb func(*Font, *Language) *Coverage) { if cb == nil { x.xGetCoverage = 0 } else { x.xGetCoverage = purego.NewCallback(func(FontVarp uintptr, LanguageVarp *Language) uintptr { ret := cb(FontNewFromInternalPtr(FontVarp), LanguageVarp) if ret == nil { return 0 } return ret.GoPointer() }) } } // GetGetCoverage gets the "get_coverage" callback function. func (x *FontClass) GetGetCoverage() func(*Font, *Language) *Coverage { if x.xGetCoverage == 0 { return nil } var rawCallback func(FontVarp uintptr, LanguageVarp *Language) uintptr purego.RegisterFunc(&rawCallback, x.xGetCoverage) return func(FontVar *Font, LanguageVar *Language) *Coverage { rawRet := rawCallback(FontVar.GoPointer(), LanguageVar) if rawRet == 0 { return nil } ret := &Coverage{} ret.Ptr = rawRet return ret } } // OverrideGetGlyphExtents sets the "get_glyph_extents" callback function. func (x *FontClass) OverrideGetGlyphExtents(cb func(*Font, Glyph, *Rectangle, *Rectangle)) { if cb == nil { x.xGetGlyphExtents = 0 } else { x.xGetGlyphExtents = purego.NewCallback(func(FontVarp uintptr, GlyphVarp Glyph, InkRectVarp *Rectangle, LogicalRectVarp *Rectangle) { cb(FontNewFromInternalPtr(FontVarp), GlyphVarp, InkRectVarp, LogicalRectVarp) }) } } // GetGetGlyphExtents gets the "get_glyph_extents" callback function. func (x *FontClass) GetGetGlyphExtents() func(*Font, Glyph, *Rectangle, *Rectangle) { if x.xGetGlyphExtents == 0 { return nil } var rawCallback func(FontVarp uintptr, GlyphVarp Glyph, InkRectVarp *Rectangle, LogicalRectVarp *Rectangle) purego.RegisterFunc(&rawCallback, x.xGetGlyphExtents) return func(FontVar *Font, GlyphVar Glyph, InkRectVar *Rectangle, LogicalRectVar *Rectangle) { rawCallback(FontVar.GoPointer(), GlyphVar, InkRectVar, LogicalRectVar) } } // OverrideGetMetrics sets the "get_metrics" callback function. func (x *FontClass) OverrideGetMetrics(cb func(*Font, *Language) *FontMetrics) { if cb == nil { x.xGetMetrics = 0 } else { x.xGetMetrics = purego.NewCallback(func(FontVarp uintptr, LanguageVarp *Language) *FontMetrics { return cb(FontNewFromInternalPtr(FontVarp), LanguageVarp) }) } } // GetGetMetrics gets the "get_metrics" callback function. func (x *FontClass) GetGetMetrics() func(*Font, *Language) *FontMetrics { if x.xGetMetrics == 0 { return nil } var rawCallback func(FontVarp uintptr, LanguageVarp *Language) *FontMetrics purego.RegisterFunc(&rawCallback, x.xGetMetrics) return func(FontVar *Font, LanguageVar *Language) *FontMetrics { return rawCallback(FontVar.GoPointer(), LanguageVar) } } // OverrideGetFontMap sets the "get_font_map" callback function. func (x *FontClass) OverrideGetFontMap(cb func(*Font) *FontMap) { if cb == nil { x.xGetFontMap = 0 } else { x.xGetFontMap = purego.NewCallback(func(FontVarp uintptr) uintptr { ret := cb(FontNewFromInternalPtr(FontVarp)) if ret == nil { return 0 } return ret.GoPointer() }) } } // GetGetFontMap gets the "get_font_map" callback function. func (x *FontClass) GetGetFontMap() func(*Font) *FontMap { if x.xGetFontMap == 0 { return nil } var rawCallback func(FontVarp uintptr) uintptr purego.RegisterFunc(&rawCallback, x.xGetFontMap) return func(FontVar *Font) *FontMap { rawRet := rawCallback(FontVar.GoPointer()) if rawRet == 0 { return nil } ret := &FontMap{} ret.Ptr = rawRet return ret } } // OverrideDescribeAbsolute sets the "describe_absolute" callback function. func (x *FontClass) OverrideDescribeAbsolute(cb func(*Font) *FontDescription) { if cb == nil { x.xDescribeAbsolute = 0 } else { x.xDescribeAbsolute = purego.NewCallback(func(FontVarp uintptr) *FontDescription { return cb(FontNewFromInternalPtr(FontVarp)) }) } } // GetDescribeAbsolute gets the "describe_absolute" callback function. func (x *FontClass) GetDescribeAbsolute() func(*Font) *FontDescription { if x.xDescribeAbsolute == 0 { return nil } var rawCallback func(FontVarp uintptr) *FontDescription purego.RegisterFunc(&rawCallback, x.xDescribeAbsolute) return func(FontVar *Font) *FontDescription { return rawCallback(FontVar.GoPointer()) } } // OverrideGetFeatures sets the "get_features" callback function. func (x *FontClass) OverrideGetFeatures(cb func(*Font, *[]uintptr, uint, *uint)) { if cb == nil { x.xGetFeatures = 0 } else { x.xGetFeatures = purego.NewCallback(func(FontVarp uintptr, FeaturesVarp *[]uintptr, LenVarp uint, NumFeaturesVarp *uint) { cb(FontNewFromInternalPtr(FontVarp), FeaturesVarp, LenVarp, NumFeaturesVarp) }) } } // GetGetFeatures gets the "get_features" callback function. func (x *FontClass) GetGetFeatures() func(*Font, *[]uintptr, uint, *uint) { if x.xGetFeatures == 0 { return nil } var rawCallback func(FontVarp uintptr, FeaturesVarp *[]uintptr, LenVarp uint, NumFeaturesVarp *uint) purego.RegisterFunc(&rawCallback, x.xGetFeatures) return func(FontVar *Font, FeaturesVar *[]uintptr, LenVar uint, NumFeaturesVar *uint) { rawCallback(FontVar.GoPointer(), FeaturesVar, LenVar, NumFeaturesVar) } } // OverrideCreateHbFont sets the "create_hb_font" callback function. func (x *FontClass) OverrideCreateHbFont(cb func(*Font) uintptr) { if cb == nil { x.xCreateHbFont = 0 } else { x.xCreateHbFont = purego.NewCallback(func(FontVarp uintptr) uintptr { return cb(FontNewFromInternalPtr(FontVarp)) }) } } // GetCreateHbFont gets the "create_hb_font" callback function. func (x *FontClass) GetCreateHbFont() func(*Font) uintptr { if x.xCreateHbFont == 0 { return nil } var rawCallback func(FontVarp uintptr) uintptr purego.RegisterFunc(&rawCallback, x.xCreateHbFont) return func(FontVar *Font) uintptr { return rawCallback(FontVar.GoPointer()) } } // A `PangoFontDescription` describes a font in an implementation-independent // manner. // // `PangoFontDescription` structures are used both to list what fonts are // available on the system and also for specifying the characteristics of // a font to load. type FontDescription struct { _ structs.HostLayout } var xFontDescriptionGLibType func() types.GType func FontDescriptionGLibType() types.GType { return xFontDescriptionGLibType() } func (x *FontDescription) GoPointer() uintptr { return uintptr(unsafe.Pointer(x)) } var xNewFontDescription func() *FontDescription // Creates a new font description structure with all fields unset. func NewFontDescription() *FontDescription { cret := xNewFontDescription() return cret } var xFontDescriptionBetterMatch func(uintptr, *FontDescription, *FontDescription) bool // Determines if the style attributes of @new_match are a closer match // for @desc than those of @old_match are, or if @old_match is %NULL, // determines if @new_match is a match at all. // // Approximate matching is done for weight and style; other style attributes // must match exactly. Style attributes are all attributes other than family // and size-related attributes. Approximate matching for style considers // %PANGO_STYLE_OBLIQUE and %PANGO_STYLE_ITALIC as matches, but not as good // a match as when the styles are equal. // // Note that @old_match must match @desc. func (x *FontDescription) BetterMatch(OldMatchVar *FontDescription, NewMatchVar *FontDescription) bool { cret := xFontDescriptionBetterMatch(x.GoPointer(), OldMatchVar, NewMatchVar) return cret } var xFontDescriptionCopy func(uintptr) *FontDescription // Make a copy of a `PangoFontDescription`. func (x *FontDescription) Copy() *FontDescription { cret := xFontDescriptionCopy(x.GoPointer()) return cret } var xFontDescriptionCopyStatic func(uintptr) *FontDescription // Make a copy of a `PangoFontDescription`, but don't duplicate // allocated fields. // // This is like [method@Pango.FontDescription.copy], but only a shallow // copy is made of the family name and other allocated fields. The result // can only be used until @desc is modified or freed. This is meant // to be used when the copy is only needed temporarily. func (x *FontDescription) CopyStatic() *FontDescription { cret := xFontDescriptionCopyStatic(x.GoPointer()) return cret } var xFontDescriptionEqual func(uintptr, *FontDescription) bool // Compares two font descriptions for equality. // // Two font descriptions are considered equal if the fonts they describe // are provably identical. This means that their masks do not have to match, // as long as other fields are all the same. (Two font descriptions may // result in identical fonts being loaded, but still compare %FALSE.) func (x *FontDescription) Equal(Desc2Var *FontDescription) bool { cret := xFontDescriptionEqual(x.GoPointer(), Desc2Var) return cret } var xFontDescriptionFree func(uintptr) // Frees a font description. func (x *FontDescription) Free() { xFontDescriptionFree(x.GoPointer()) } var xFontDescriptionGetColor func(uintptr) FontColor // Returns the color field of the font description. // // This field determines whether the font description should // match fonts that have color glyphs, or fonts that don't. func (x *FontDescription) GetColor() FontColor { cret := xFontDescriptionGetColor(x.GoPointer()) return cret } var xFontDescriptionGetFamily func(uintptr) string // Gets the family name field of a font description. // // See [method@Pango.FontDescription.set_family]. func (x *FontDescription) GetFamily() string { cret := xFontDescriptionGetFamily(x.GoPointer()) return cret } var xFontDescriptionGetFeatures func(uintptr) string // Gets the features field of a font description. // // See [method@Pango.FontDescription.set_features]. func (x *FontDescription) GetFeatures() string { cret := xFontDescriptionGetFeatures(x.GoPointer()) return cret } var xFontDescriptionGetGravity func(uintptr) Gravity // Gets the gravity field of a font description. // // See [method@Pango.FontDescription.set_gravity]. func (x *FontDescription) GetGravity() Gravity { cret := xFontDescriptionGetGravity(x.GoPointer()) return cret } var xFontDescriptionGetSetFields func(uintptr) FontMask // Determines which fields in a font description have been set. func (x *FontDescription) GetSetFields() FontMask { cret := xFontDescriptionGetSetFields(x.GoPointer()) return cret } var xFontDescriptionGetSize func(uintptr) int // Gets the size field of a font description. // // See [method@Pango.FontDescription.set_size]. func (x *FontDescription) GetSize() int { cret := xFontDescriptionGetSize(x.GoPointer()) return cret } var xFontDescriptionGetSizeIsAbsolute func(uintptr) bool // Determines whether the size of the font is in points (not absolute) // or device units (absolute). // // See [method@Pango.FontDescription.set_size] // and [method@Pango.FontDescription.set_absolute_size]. func (x *FontDescription) GetSizeIsAbsolute() bool { cret := xFontDescriptionGetSizeIsAbsolute(x.GoPointer()) return cret } var xFontDescriptionGetStretch func(uintptr) Stretch // Gets the stretch field of a font description. // // See [method@Pango.FontDescription.set_stretch]. func (x *FontDescription) GetStretch() Stretch { cret := xFontDescriptionGetStretch(x.GoPointer()) return cret } var xFontDescriptionGetStyle func(uintptr) Style // Gets the style field of a `PangoFontDescription`. // // See [method@Pango.FontDescription.set_style]. func (x *FontDescription) GetStyle() Style { cret := xFontDescriptionGetStyle(x.GoPointer()) return cret } var xFontDescriptionGetVariant func(uintptr) Variant // Gets the variant field of a `PangoFontDescription`. // // See [method@Pango.FontDescription.set_variant]. func (x *FontDescription) GetVariant() Variant { cret := xFontDescriptionGetVariant(x.GoPointer()) return cret } var xFontDescriptionGetVariations func(uintptr) string // Gets the variations field of a font description. // // See [method@Pango.FontDescription.set_variations]. func (x *FontDescription) GetVariations() string { cret := xFontDescriptionGetVariations(x.GoPointer()) return cret } var xFontDescriptionGetWeight func(uintptr) Weight // Gets the weight field of a font description. // // See [method@Pango.FontDescription.set_weight]. func (x *FontDescription) GetWeight() Weight { cret := xFontDescriptionGetWeight(x.GoPointer()) return cret } var xFontDescriptionHash func(uintptr) uint // Computes a hash of a `PangoFontDescription` structure. // // This is suitable to be used, for example, as an argument // to g_hash_table_new(). The hash value is independent of @desc->mask. func (x *FontDescription) Hash() uint { cret := xFontDescriptionHash(x.GoPointer()) return cret } var xFontDescriptionMerge func(uintptr, *FontDescription, bool) // Merges the fields that are set in @desc_to_merge into the fields in // @desc. // // If @replace_existing is %FALSE, only fields in @desc that // are not already set are affected. If %TRUE, then fields that are // already set will be replaced as well. // // If @desc_to_merge is %NULL, this function performs nothing. func (x *FontDescription) Merge(DescToMergeVar *FontDescription, ReplaceExistingVar bool) { xFontDescriptionMerge(x.GoPointer(), DescToMergeVar, ReplaceExistingVar) } var xFontDescriptionMergeStatic func(uintptr, *FontDescription, bool) // Merges the fields that are set in @desc_to_merge into the fields in // @desc, without copying allocated fields. // // This is like [method@Pango.FontDescription.merge], but only a shallow copy // is made of the family name and other allocated fields. @desc can only // be used until @desc_to_merge is modified or freed. This is meant to // be used when the merged font description is only needed temporarily. func (x *FontDescription) MergeStatic(DescToMergeVar *FontDescription, ReplaceExistingVar bool) { xFontDescriptionMergeStatic(x.GoPointer(), DescToMergeVar, ReplaceExistingVar) } var xFontDescriptionSetAbsoluteSize func(uintptr, float64) // Sets the size field of a font description, in device units. // // This is mutually exclusive with [method@Pango.FontDescription.set_size] // which sets the font size in points. func (x *FontDescription) SetAbsoluteSize(SizeVar float64) { xFontDescriptionSetAbsoluteSize(x.GoPointer(), SizeVar) } var xFontDescriptionSetColor func(uintptr, FontColor) // Sets the color field of a font description. // // This field determines whether the font description should // match fonts that have color glyphs, or fonts that don't. func (x *FontDescription) SetColor(ColorVar FontColor) { xFontDescriptionSetColor(x.GoPointer(), ColorVar) } var xFontDescriptionSetFamily func(uintptr, string) // Sets the family name field of a font description. // // The family // name represents a family of related font styles, and will // resolve to a particular `PangoFontFamily`. In some uses of // `PangoFontDescription`, it is also possible to use a comma // separated list of family names for this field. func (x *FontDescription) SetFamily(FamilyVar string) { xFontDescriptionSetFamily(x.GoPointer(), FamilyVar) } var xFontDescriptionSetFamilyStatic func(uintptr, string) // Sets the family name field of a font description, without copying the string. // // This is like [method@Pango.FontDescription.set_family], except that no // copy of @family is made. The caller must make sure that the // string passed in stays around until @desc has been freed or the // name is set again. This function can be used if @family is a static // string such as a C string literal, or if @desc is only needed temporarily. func (x *FontDescription) SetFamilyStatic(FamilyVar string) { xFontDescriptionSetFamilyStatic(x.GoPointer(), FamilyVar) } var xFontDescriptionSetFeatures func(uintptr, uintptr) // Sets the features field of a font description. // // OpenType font features allow to enable or disable certain optional // features of a font, such as tabular numbers. // // The format of the features string is comma-separated list of // feature assignments, with each assignment being one of these forms: // // FEATURE=n // // where FEATURE must be a 4 character tag that identifies and OpenType // feature, and n an integer (depending on the feature, the allowed // values may be 0, 1 or bigger numbers). Unknown features are ignored. // // Note that font features set in this way are enabled for the entire text // that is using the font, which is not appropriate for all OpenType features. // The intended use case is to select character variations (features cv01 - c99), // style sets (ss01 - ss20) and the like. // // Pango does not currently have a way to find supported OpenType features // of a font. Both harfbuzz and freetype have API for this. See for example // [hb_ot_layout_table_get_feature_tags](https://harfbuzz.github.io/harfbuzz-hb-ot-layout.html#hb-ot-layout-table-get-feature-tags). // // Features that are not supported by the font are silently ignored. func (x *FontDescription) SetFeatures(FeaturesVar *string) { FeaturesVarPtr := core.GStrdupNullable(FeaturesVar) defer core.GFreeNullable(FeaturesVarPtr) xFontDescriptionSetFeatures(x.GoPointer(), FeaturesVarPtr) } var xFontDescriptionSetFeaturesStatic func(uintptr, string) // Sets the features field of a font description. // // This is like [method@Pango.FontDescription.set_features], except // that no copy of @featuresis made. The caller must make sure that // the string passed in stays around until @desc has been freed // or the name is set again. This function can be used if // @features is a static string such as a C string literal, // or if @desc is only needed temporarily. func (x *FontDescription) SetFeaturesStatic(FeaturesVar string) { xFontDescriptionSetFeaturesStatic(x.GoPointer(), FeaturesVar) } var xFontDescriptionSetGravity func(uintptr, Gravity) // Sets the gravity field of a font description. // // The gravity field // specifies how the glyphs should be rotated. If @gravity is // %PANGO_GRAVITY_AUTO, this actually unsets the gravity mask on // the font description. // // This function is seldom useful to the user. Gravity should normally // be set on a `PangoContext`. func (x *FontDescription) SetGravity(GravityVar Gravity) { xFontDescriptionSetGravity(x.GoPointer(), GravityVar) } var xFontDescriptionSetSize func(uintptr, int) // Sets the size field of a font description in fractional points. // // This is mutually exclusive with // [method@Pango.FontDescription.set_absolute_size]. func (x *FontDescription) SetSize(SizeVar int) { xFontDescriptionSetSize(x.GoPointer(), SizeVar) } var xFontDescriptionSetStretch func(uintptr, Stretch) // Sets the stretch field of a font description. // // The [enum@Pango.Stretch] field specifies how narrow or // wide the font should be. func (x *FontDescription) SetStretch(StretchVar Stretch) { xFontDescriptionSetStretch(x.GoPointer(), StretchVar) } var xFontDescriptionSetStyle func(uintptr, Style) // Sets the style field of a `PangoFontDescription`. // // The [enum@Pango.Style] enumeration describes whether the font is // slanted and the manner in which it is slanted; it can be either // %PANGO_STYLE_NORMAL, %PANGO_STYLE_ITALIC, or %PANGO_STYLE_OBLIQUE. // // Most fonts will either have a italic style or an oblique style, // but not both, and font matching in Pango will match italic // specifications with oblique fonts and vice-versa if an exact // match is not found. func (x *FontDescription) SetStyle(StyleVar Style) { xFontDescriptionSetStyle(x.GoPointer(), StyleVar) } var xFontDescriptionSetVariant func(uintptr, Variant) // Sets the variant field of a font description. // // The [enum@Pango.Variant] can either be %PANGO_VARIANT_NORMAL // or %PANGO_VARIANT_SMALL_CAPS. func (x *FontDescription) SetVariant(VariantVar Variant) { xFontDescriptionSetVariant(x.GoPointer(), VariantVar) } var xFontDescriptionSetVariations func(uintptr, uintptr) // Sets the variations field of a font description. // // OpenType font variations allow to select a font instance by // specifying values for a number of axes, such as width or weight. // // The format of the variations string is // // AXIS1=VALUE,AXIS2=VALUE... // // with each AXIS a 4 character tag that identifies a font axis, // and each VALUE a floating point number. Unknown axes are ignored, // and values are clamped to their allowed range. // // Pango does not currently have a way to find supported axes of // a font. Both harfbuzz and freetype have API for this. See // for example [hb_ot_var_get_axis_infos](https://harfbuzz.github.io/harfbuzz-hb-ot-var.html#hb-ot-var-get-axis-infos). func (x *FontDescription) SetVariations(VariationsVar *string) { VariationsVarPtr := core.GStrdupNullable(VariationsVar) defer core.GFreeNullable(VariationsVarPtr) xFontDescriptionSetVariations(x.GoPointer(), VariationsVarPtr) } var xFontDescriptionSetVariationsStatic func(uintptr, string) // Sets the variations field of a font description. // // This is like [method@Pango.FontDescription.set_variations], except // that no copy of @variations is made. The caller must make sure that // the string passed in stays around until @desc has been freed // or the name is set again. This function can be used if // @variations is a static string such as a C string literal, // or if @desc is only needed temporarily. func (x *FontDescription) SetVariationsStatic(VariationsVar string) { xFontDescriptionSetVariationsStatic(x.GoPointer(), VariationsVar) } var xFontDescriptionSetWeight func(uintptr, Weight) // Sets the weight field of a font description. // // The weight field // specifies how bold or light the font should be. In addition // to the values of the [enum@Pango.Weight] enumeration, other // intermediate numeric values are possible. func (x *FontDescription) SetWeight(WeightVar Weight) { xFontDescriptionSetWeight(x.GoPointer(), WeightVar) } var xFontDescriptionToFilename func(uintptr) string // Creates a filename representation of a font description. // // The filename is identical to the result from calling // [method@Pango.FontDescription.to_string], but with underscores // instead of characters that are untypical in filenames, and in // lower case only. func (x *FontDescription) ToFilename() string { cret := xFontDescriptionToFilename(x.GoPointer()) return cret } var xFontDescriptionToString func(uintptr) string // Creates a string representation of a font description. // // See [func@Pango.FontDescription.from_string] for a description // of the format of the string representation. The family list in // the string description will only have a terminating comma if // the last word of the list is a valid style option. func (x *FontDescription) ToString() string { cret := xFontDescriptionToString(x.GoPointer()) return cret } var xFontDescriptionUnsetFields func(uintptr, FontMask) // Unsets some of the fields in a `PangoFontDescription`. // // The unset fields will get back to their default values. func (x *FontDescription) UnsetFields(ToUnsetVar FontMask) { xFontDescriptionUnsetFields(x.GoPointer(), ToUnsetVar) } type FontFaceClass struct { _ structs.HostLayout ParentClass gobject.ObjectClass xGetFaceName uintptr xDescribe uintptr xListSizes uintptr xIsSynthesized uintptr xGetFamily uintptr xPangoReserved3 uintptr xPangoReserved4 uintptr } func (x *FontFaceClass) GoPointer() uintptr { return uintptr(unsafe.Pointer(x)) } // OverrideGetFaceName sets the "get_face_name" callback function. func (x *FontFaceClass) OverrideGetFaceName(cb func(*FontFace) string) { if cb == nil { x.xGetFaceName = 0 } else { x.xGetFaceName = purego.NewCallback(func(FaceVarp uintptr) string { return cb(FontFaceNewFromInternalPtr(FaceVarp)) }) } } // GetGetFaceName gets the "get_face_name" callback function. func (x *FontFaceClass) GetGetFaceName() func(*FontFace) string { if x.xGetFaceName == 0 { return nil } var rawCallback func(FaceVarp uintptr) string purego.RegisterFunc(&rawCallback, x.xGetFaceName) return func(FaceVar *FontFace) string { return rawCallback(FaceVar.GoPointer()) } } // OverrideDescribe sets the "describe" callback function. func (x *FontFaceClass) OverrideDescribe(cb func(*FontFace) *FontDescription) { if cb == nil { x.xDescribe = 0 } else { x.xDescribe = purego.NewCallback(func(FaceVarp uintptr) *FontDescription { return cb(FontFaceNewFromInternalPtr(FaceVarp)) }) } } // GetDescribe gets the "describe" callback function. func (x *FontFaceClass) GetDescribe() func(*FontFace) *FontDescription { if x.xDescribe == 0 { return nil } var rawCallback func(FaceVarp uintptr) *FontDescription purego.RegisterFunc(&rawCallback, x.xDescribe) return func(FaceVar *FontFace) *FontDescription { return rawCallback(FaceVar.GoPointer()) } } // OverrideListSizes sets the "list_sizes" callback function. func (x *FontFaceClass) OverrideListSizes(cb func(*FontFace, *[]int, *int)) { if cb == nil { x.xListSizes = 0 } else { x.xListSizes = purego.NewCallback(func(FaceVarp uintptr, SizesVarp *[]int, NSizesVarp *int) { cb(FontFaceNewFromInternalPtr(FaceVarp), SizesVarp, NSizesVarp) }) } } // GetListSizes gets the "list_sizes" callback function. func (x *FontFaceClass) GetListSizes() func(*FontFace, *[]int, *int) { if x.xListSizes == 0 { return nil } var rawCallback func(FaceVarp uintptr, SizesVarp *[]int, NSizesVarp *int) purego.RegisterFunc(&rawCallback, x.xListSizes) return func(FaceVar *FontFace, SizesVar *[]int, NSizesVar *int) { rawCallback(FaceVar.GoPointer(), SizesVar, NSizesVar) } } // OverrideIsSynthesized sets the "is_synthesized" callback function. func (x *FontFaceClass) OverrideIsSynthesized(cb func(*FontFace) bool) { if cb == nil { x.xIsSynthesized = 0 } else { x.xIsSynthesized = purego.NewCallback(func(FaceVarp uintptr) bool { return cb(FontFaceNewFromInternalPtr(FaceVarp)) }) } } // GetIsSynthesized gets the "is_synthesized" callback function. func (x *FontFaceClass) GetIsSynthesized() func(*FontFace) bool { if x.xIsSynthesized == 0 { return nil } var rawCallback func(FaceVarp uintptr) bool purego.RegisterFunc(&rawCallback, x.xIsSynthesized) return func(FaceVar *FontFace) bool { return rawCallback(FaceVar.GoPointer()) } } // OverrideGetFamily sets the "get_family" callback function. func (x *FontFaceClass) OverrideGetFamily(cb func(*FontFace) *FontFamily) { if cb == nil { x.xGetFamily = 0 } else { x.xGetFamily = purego.NewCallback(func(FaceVarp uintptr) uintptr { ret := cb(FontFaceNewFromInternalPtr(FaceVarp)) if ret == nil { return 0 } return ret.GoPointer() }) } } // GetGetFamily gets the "get_family" callback function. func (x *FontFaceClass) GetGetFamily() func(*FontFace) *FontFamily { if x.xGetFamily == 0 { return nil } var rawCallback func(FaceVarp uintptr) uintptr purego.RegisterFunc(&rawCallback, x.xGetFamily) return func(FaceVar *FontFace) *FontFamily { rawRet := rawCallback(FaceVar.GoPointer()) if rawRet == 0 { return nil } ret := &FontFamily{} ret.Ptr = rawRet return ret } } // OverridePangoReserved3 sets the "_pango_reserved3" callback function. func (x *FontFaceClass) 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 *FontFaceClass) 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 *FontFaceClass) 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 *FontFaceClass) GetPangoReserved4() func() { if x.xPangoReserved4 == 0 { return nil } var rawCallback func() purego.RegisterFunc(&rawCallback, x.xPangoReserved4) return func() { rawCallback() } } type FontFamilyClass struct { _ structs.HostLayout ParentClass gobject.ObjectClass xListFaces uintptr xGetName uintptr xIsMonospace uintptr xIsVariable uintptr xGetFace uintptr xPangoReserved2 uintptr } func (x *FontFamilyClass) GoPointer() uintptr { return uintptr(unsafe.Pointer(x)) } // OverrideListFaces sets the "list_faces" callback function. func (x *FontFamilyClass) OverrideListFaces(cb func(*FontFamily, *uintptr, *int)) { if cb == nil { x.xListFaces = 0 } else { x.xListFaces = purego.NewCallback(func(FamilyVarp uintptr, FacesVarp *uintptr, NFacesVarp *int) { cb(FontFamilyNewFromInternalPtr(FamilyVarp), FacesVarp, NFacesVarp) }) } } // GetListFaces gets the "list_faces" callback function. func (x *FontFamilyClass) GetListFaces() func(*FontFamily, *uintptr, *int) { if x.xListFaces == 0 { return nil } var rawCallback func(FamilyVarp uintptr, FacesVarp *uintptr, NFacesVarp *int) purego.RegisterFunc(&rawCallback, x.xListFaces) return func(FamilyVar *FontFamily, FacesVar *uintptr, NFacesVar *int) { rawCallback(FamilyVar.GoPointer(), FacesVar, NFacesVar) } } // OverrideGetName sets the "get_name" callback function. func (x *FontFamilyClass) OverrideGetName(cb func(*FontFamily) string) { if cb == nil { x.xGetName = 0 } else { x.xGetName = purego.NewCallback(func(FamilyVarp uintptr) string { return cb(FontFamilyNewFromInternalPtr(FamilyVarp)) }) } } // GetGetName gets the "get_name" callback function. func (x *FontFamilyClass) GetGetName() func(*FontFamily) string { if x.xGetName == 0 { return nil } var rawCallback func(FamilyVarp uintptr) string purego.RegisterFunc(&rawCallback, x.xGetName) return func(FamilyVar *FontFamily) string { return rawCallback(FamilyVar.GoPointer()) } } // OverrideIsMonospace sets the "is_monospace" callback function. func (x *FontFamilyClass) OverrideIsMonospace(cb func(*FontFamily) bool) { if cb == nil { x.xIsMonospace = 0 } else { x.xIsMonospace = purego.NewCallback(func(FamilyVarp uintptr) bool { return cb(FontFamilyNewFromInternalPtr(FamilyVarp)) }) } } // GetIsMonospace gets the "is_monospace" callback function. func (x *FontFamilyClass) GetIsMonospace() func(*FontFamily) bool { if x.xIsMonospace == 0 { return nil } var rawCallback func(FamilyVarp uintptr) bool purego.RegisterFunc(&rawCallback, x.xIsMonospace) return func(FamilyVar *FontFamily) bool { return rawCallback(FamilyVar.GoPointer()) } } // OverrideIsVariable sets the "is_variable" callback function. func (x *FontFamilyClass) OverrideIsVariable(cb func(*FontFamily) bool) { if cb == nil { x.xIsVariable = 0 } else { x.xIsVariable = purego.NewCallback(func(FamilyVarp uintptr) bool { return cb(FontFamilyNewFromInternalPtr(FamilyVarp)) }) } } // GetIsVariable gets the "is_variable" callback function. func (x *FontFamilyClass) GetIsVariable() func(*FontFamily) bool { if x.xIsVariable == 0 { return nil } var rawCallback func(FamilyVarp uintptr) bool purego.RegisterFunc(&rawCallback, x.xIsVariable) return func(FamilyVar *FontFamily) bool { return rawCallback(FamilyVar.GoPointer()) } } // OverrideGetFace sets the "get_face" callback function. func (x *FontFamilyClass) OverrideGetFace(cb func(*FontFamily, string) *FontFace) { if cb == nil { x.xGetFace = 0 } else { x.xGetFace = purego.NewCallback(func(FamilyVarp uintptr, NameVarp string) uintptr { ret := cb(FontFamilyNewFromInternalPtr(FamilyVarp), NameVarp) if ret == nil { return 0 } return ret.GoPointer() }) } } // GetGetFace gets the "get_face" callback function. func (x *FontFamilyClass) GetGetFace() func(*FontFamily, string) *FontFace { if x.xGetFace == 0 { return nil } var rawCallback func(FamilyVarp uintptr, NameVarp string) uintptr purego.RegisterFunc(&rawCallback, x.xGetFace) return func(FamilyVar *FontFamily, NameVar string) *FontFace { rawRet := rawCallback(FamilyVar.GoPointer(), NameVar) if rawRet == 0 { return nil } ret := &FontFace{} ret.Ptr = rawRet return ret } } // OverridePangoReserved2 sets the "_pango_reserved2" callback function. func (x *FontFamilyClass) 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 *FontFamilyClass) GetPangoReserved2() func() { if x.xPangoReserved2 == 0 { return nil } var rawCallback func() purego.RegisterFunc(&rawCallback, x.xPangoReserved2) return func() { rawCallback() } } // A `PangoFontMetrics` structure holds the overall metric information // for a font. // // The information in a `PangoFontMetrics` structure may be restricted // to a script. The fields of this structure are private to implementations // of a font backend. See the documentation of the corresponding getters // for documentation of their meaning. // // For an overview of the most important metrics, see: // // <picture> // // <source srcset="fontmetrics-dark.png" media="(prefers-color-scheme: dark)"> // <img alt="Font metrics" src="fontmetrics-light.png"> // // </picture> type FontMetrics struct { _ structs.HostLayout RefCount uint Ascent int Descent int Height int ApproximateCharWidth int ApproximateDigitWidth int UnderlinePosition int UnderlineThickness int StrikethroughPosition int StrikethroughThickness int } var xFontMetricsGLibType func() types.GType func FontMetricsGLibType() types.GType { return xFontMetricsGLibType() } func (x *FontMetrics) GoPointer() uintptr { return uintptr(unsafe.Pointer(x)) } var xFontMetricsGetApproximateCharWidth func(uintptr) int // Gets the approximate character width for a font metrics structure. // // This is merely a representative value useful, for example, for // determining the initial size for a window. Actual characters in // text will be wider and narrower than this. func (x *FontMetrics) GetApproximateCharWidth() int { cret := xFontMetricsGetApproximateCharWidth(x.GoPointer()) return cret } var xFontMetricsGetApproximateDigitWidth func(uintptr) int // Gets the approximate digit width for a font metrics structure. // // This is merely a representative value useful, for example, for // determining the initial size for a window. Actual digits in // text can be wider or narrower than this, though this value // is generally somewhat more accurate than the result of // pango_font_metrics_get_approximate_char_width() for digits. func (x *FontMetrics) GetApproximateDigitWidth() int { cret := xFontMetricsGetApproximateDigitWidth(x.GoPointer()) return cret } var xFontMetricsGetAscent func(uintptr) int // Gets the ascent from a font metrics structure. // // The ascent is the distance from the baseline to the logical top // of a line of text. (The logical top may be above or below the top // of the actual drawn ink. It is necessary to lay out the text to // figure where the ink will be.) func (x *FontMetrics) GetAscent() int { cret := xFontMetricsGetAscent(x.GoPointer()) return cret } var xFontMetricsGetDescent func(uintptr) int // Gets the descent from a font metrics structure. // // The descent is the distance from the baseline to the logical bottom // of a line of text. (The logical bottom may be above or below the // bottom of the actual drawn ink. It is necessary to lay out the text // to figure where the ink will be.) func (x *FontMetrics) GetDescent() int { cret := xFontMetricsGetDescent(x.GoPointer()) return cret } var xFontMetricsGetHeight func(uintptr) int // Gets the line height from a font metrics structure. // // The line height is the recommended distance between successive // baselines in wrapped text using this font. // // If the line height is not available, 0 is returned. func (x *FontMetrics) GetHeight() int { cret := xFontMetricsGetHeight(x.GoPointer()) return cret } var xFontMetricsGetStrikethroughPosition func(uintptr) int // Gets the suggested position to draw the strikethrough. // // The value returned is the distance *above* the // baseline of the top of the strikethrough. func (x *FontMetrics) GetStrikethroughPosition() int { cret := xFontMetricsGetStrikethroughPosition(x.GoPointer()) return cret } var xFontMetricsGetStrikethroughThickness func(uintptr) int // Gets the suggested thickness to draw for the strikethrough. func (x *FontMetrics) GetStrikethroughThickness() int { cret := xFontMetricsGetStrikethroughThickness(x.GoPointer()) return cret } var xFontMetricsGetUnderlinePosition func(uintptr) int // Gets the suggested position to draw the underline. // // The value returned is the distance *above* the baseline of the top // of the underline. Since most fonts have underline positions beneath // the baseline, this value is typically negative. func (x *FontMetrics) GetUnderlinePosition() int { cret := xFontMetricsGetUnderlinePosition(x.GoPointer()) return cret } var xFontMetricsGetUnderlineThickness func(uintptr) int // Gets the suggested thickness to draw for the underline. func (x *FontMetrics) GetUnderlineThickness() int { cret := xFontMetricsGetUnderlineThickness(x.GoPointer()) return cret } var xFontMetricsRef func(uintptr) *FontMetrics // Increase the reference count of a font metrics structure by one. func (x *FontMetrics) Ref() *FontMetrics { cret := xFontMetricsRef(x.GoPointer()) return cret } var xFontMetricsUnref func(uintptr) // Decrease the reference count of a font metrics structure by one. // // If the result is zero, frees the structure and any associated memory. func (x *FontMetrics) Unref() { xFontMetricsUnref(x.GoPointer()) } const ( // A `PangoGlyph` value that indicates a zero-width empty glpyh. // // This is useful for example in shaper modules, to use as the glyph for // various zero-width Unicode characters (those passing [func@is_zero_width]). GLYPH_EMPTY Glyph = 268435455 // A `PangoGlyph` value for invalid input. // // `PangoLayout` produces one such glyph per invalid input UTF-8 byte and such // a glyph is rendered as a crossed box. // // Note that this value is defined such that it has the %PANGO_GLYPH_UNKNOWN_FLAG // set. GLYPH_INVALID_INPUT Glyph = 4294967295 // Flag used in `PangoGlyph` to turn a `gunichar` value of a valid Unicode // character into an unknown-character glyph for that `gunichar`. // // Such unknown-character glyphs may be rendered as a 'hex box'. GLYPH_UNKNOWN_FLAG Glyph = 268435456 ) // The bits in a `PangoFontMask` correspond to the set fields in a // `PangoFontDescription`. type FontMask int var xFontMaskGLibType func() types.GType func FontMaskGLibType() types.GType { return xFontMaskGLibType() } const ( // the font family is specified. FontMaskFamilyValue FontMask = 1 // the font style is specified. FontMaskStyleValue FontMask = 2 // the font variant is specified. FontMaskVariantValue FontMask = 4 // the font weight is specified. FontMaskWeightValue FontMask = 8 // the font stretch is specified. FontMaskStretchValue FontMask = 16 // the font size is specified. FontMaskSizeValue FontMask = 32 // The font gravity is specified. FontMaskGravityValue FontMask = 64 // OpenType font variations are specified. FontMaskVariationsValue FontMask = 128 // OpenType font features are specified. FontMaskFeaturesValue FontMask = 256 // Font color is specified. FontMaskColorValue FontMask = 512 ) // Specifies whether a font should or should not have color glyphs. type FontColor int var xFontColorGLibType func() types.GType func FontColorGLibType() types.GType { return xFontColorGLibType() } const ( // The font should not have color glyphs FontColorForbiddenValue FontColor = 0 // The font should have color glyphs FontColorRequiredValue FontColor = 1 // The font may or may not use color FontColorDontCareValue FontColor = 2 ) // An enumeration specifying the width of the font relative to other designs // within a family. type Stretch int var xStretchGLibType func() types.GType func StretchGLibType() types.GType { return xStretchGLibType() } const ( // ultra condensed width StretchUltraCondensedValue Stretch = 0 // extra condensed width StretchExtraCondensedValue Stretch = 1 // condensed width StretchCondensedValue Stretch = 2 // semi condensed width StretchSemiCondensedValue Stretch = 3 // the normal width StretchNormalValue Stretch = 4 // semi expanded width StretchSemiExpandedValue Stretch = 5 // expanded width StretchExpandedValue Stretch = 6 // extra expanded width StretchExtraExpandedValue Stretch = 7 // ultra expanded width StretchUltraExpandedValue Stretch = 8 ) // An enumeration specifying the various slant styles possible for a font. type Style int var xStyleGLibType func() types.GType func StyleGLibType() types.GType { return xStyleGLibType() } const ( // the font is upright. StyleNormalValue Style = 0 // the font is slanted, but in a roman style. StyleObliqueValue Style = 1 // the font is slanted in an italic style. StyleItalicValue Style = 2 ) // An enumeration specifying capitalization variant of the font. type Variant int var xVariantGLibType func() types.GType func VariantGLibType() types.GType { return xVariantGLibType() } const ( // A normal font. VariantNormalValue Variant = 0 // A font with the lower case characters // replaced by smaller variants of the capital characters. VariantSmallCapsValue Variant = 1 // A font with all characters // replaced by smaller variants of the capital characters. Since: 1.50 VariantAllSmallCapsValue Variant = 2 // A font with the lower case characters // replaced by smaller variants of the capital characters. // Petite Caps can be even smaller than Small Caps. Since: 1.50 VariantPetiteCapsValue Variant = 3 // A font with all characters // replaced by smaller variants of the capital characters. // Petite Caps can be even smaller than Small Caps. Since: 1.50 VariantAllPetiteCapsValue Variant = 4 // A font with the upper case characters // replaced by smaller variants of the capital letters. Since: 1.50 VariantUnicaseValue Variant = 5 // A font with capital letters that // are more suitable for all-uppercase titles. Since: 1.50 VariantTitleCapsValue Variant = 6 ) // An enumeration specifying the weight (boldness) of a font. // // Weight is specified as a numeric value ranging from 100 to 1000. // This enumeration simply provides some common, predefined values. type Weight int var xWeightGLibType func() types.GType func WeightGLibType() types.GType { return xWeightGLibType() } const ( // the thin weight (= 100) Since: 1.24 WeightThinValue Weight = 100 // the ultralight weight (= 200) WeightUltralightValue Weight = 200 // the light weight (= 300) WeightLightValue Weight = 300 // the semilight weight (= 350) Since: 1.36.7 WeightSemilightValue Weight = 350 // the book weight (= 380) Since: 1.24) WeightBookValue Weight = 380 // the default weight (= 400) WeightNormalValue Weight = 400 // the medium weight (= 500) Since: 1.24 WeightMediumValue Weight = 500 // the semibold weight (= 600) WeightSemiboldValue Weight = 600 // the bold weight (= 700) WeightBoldValue Weight = 700 // the ultrabold weight (= 800) WeightUltraboldValue Weight = 800 // the heavy weight (= 900) WeightHeavyValue Weight = 900 // the ultraheavy weight (= 1000) Since: 1.24 WeightUltraheavyValue Weight = 1000 ) var xFontDescriptionFromString func(string) *FontDescription // Creates a new font description from a string representation. // // The string must have the form // // [FAMILY-LIST] [STYLE-OPTIONS] [SIZE] [VARIATIONS] [FEATURES] // // where FAMILY-LIST is a comma-separated list of families optionally // terminated by a comma, STYLE_OPTIONS is a whitespace-separated list // of words where each word describes one of style, variant, weight, // stretch, or gravity, and SIZE is a decimal number (size in points) // or optionally followed by the unit modifier "px" for absolute size. // // The following words are understood as styles: // "Normal", "Roman", "Oblique", "Italic". // // The following words are understood as variants: // "Small-Caps", "All-Small-Caps", "Petite-Caps", "All-Petite-Caps", // "Unicase", "Title-Caps". // // The following words are understood as weights: // "Thin", "Ultra-Light", "Extra-Light", "Light", "Semi-Light", // "Demi-Light", "Book", "Regular", "Medium", "Semi-Bold", "Demi-Bold", // "Bold", "Ultra-Bold", "Extra-Bold", "Heavy", "Black", "Ultra-Black", // "Extra-Black". // // The following words are understood as stretch values: // "Ultra-Condensed", "Extra-Condensed", "Condensed", "Semi-Condensed", // "Semi-Expanded", "Expanded", "Extra-Expanded", "Ultra-Expanded". // // The following words are understood as gravity values: // "Not-Rotated", "South", "Upside-Down", "North", "Rotated-Left", // "East", "Rotated-Right", "West". // // The following words are understood as color values: // "With-Color", "Without-Color". // // VARIATIONS is a comma-separated list of font variations // of the form @‍axis1=value,axis2=value,... // // FEATURES is a comma-separated list of font features of the form // \#‍feature1=value,feature2=value,... // The =value part can be ommitted if the value is 1. // // Any one of the options may be absent. If FAMILY-LIST is absent, then // the family_name field of the resulting font description will be // initialized to %NULL. If STYLE-OPTIONS is missing, then all style // options will be set to the default values. If SIZE is missing, the // size in the resulting font description will be set to 0. // // A typical example: // // Cantarell Italic Light 15 @‍wght=200 #‍tnum=1 func FontDescriptionFromString(StrVar string) *FontDescription { cret := xFontDescriptionFromString(StrVar) return cret } // A `PangoFont` is used to represent a font in a // rendering-system-independent manner. type Font struct { gobject.Object } var xFontGLibType func() types.GType func FontGLibType() types.GType { return xFontGLibType() } func FontNewFromInternalPtr(ptr uintptr) *Font { cls := &Font{} cls.Ptr = ptr return cls } var xFontDescribe func(uintptr) *FontDescription // Returns a description of the font, with font size set in points. // // Use [method@Pango.Font.describe_with_absolute_size] if you want // the font size in device units. func (x *Font) Describe() *FontDescription { cret := xFontDescribe(x.GoPointer()) return cret } var xFontDescribeWithAbsoluteSize func(uintptr) *FontDescription // Returns a description of the font, with absolute font size set // in device units. // // Use [method@Pango.Font.describe] if you want the font size in points. func (x *Font) DescribeWithAbsoluteSize() *FontDescription { cret := xFontDescribeWithAbsoluteSize(x.GoPointer()) return cret } var xFontGetCoverage func(uintptr, *Language) uintptr // Computes the coverage map for a given font and language tag. func (x *Font) GetCoverage(LanguageVar *Language) *Coverage { var cls *Coverage cret := xFontGetCoverage(x.GoPointer(), LanguageVar) if cret == 0 { return nil } cls = &Coverage{} cls.Ptr = cret return cls } var xFontGetFace func(uintptr) uintptr // Gets the `PangoFontFace` to which @font belongs. // // Note that this function can return `NULL` in cases // where the font outlives its font map. func (x *Font) GetFace() *FontFace { var cls *FontFace cret := xFontGetFace(x.GoPointer()) if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &FontFace{} cls.Ptr = cret return cls } var xFontGetFeatures func(uintptr, *[]uintptr, uint, *uint) // Obtain the OpenType features that are provided by the font. // // These are passed to the rendering system, together with features // that have been explicitly set via attributes. // // Note that this does not include OpenType features which the // rendering system enables by default. func (x *Font) GetFeatures(FeaturesVar *[]uintptr, LenVar uint, NumFeaturesVar *uint) { xFontGetFeatures(x.GoPointer(), FeaturesVar, LenVar, NumFeaturesVar) } var xFontGetFontMap func(uintptr) uintptr // Gets the font map for which the font was created. // // Note that the font maintains a *weak* reference to // the font map, so if all references to font map are // dropped, the font map will be finalized even if there // are fonts created with the font map that are still alive. // In that case this function will return %NULL. // // It is the responsibility of the user to ensure that the // font map is kept alive. In most uses this is not an issue // as a `PangoContext` holds a reference to the font map. func (x *Font) GetFontMap() *FontMap { var cls *FontMap cret := xFontGetFontMap(x.GoPointer()) if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &FontMap{} cls.Ptr = cret return cls } var xFontGetGlyphExtents func(uintptr, Glyph, *Rectangle, *Rectangle) // Gets the logical and ink extents of a glyph within a font. // // The coordinate system for each rectangle has its origin at the // base line and horizontal origin of the character with increasing // coordinates extending to the right and down. The macros PANGO_ASCENT(), // PANGO_DESCENT(), PANGO_LBEARING(), and PANGO_RBEARING() can be used to convert // from the extents rectangle to more traditional font metrics. The units // of the rectangles are in 1/PANGO_SCALE of a device unit. // // If @font is %NULL, this function gracefully sets some sane values in the // output variables and returns. func (x *Font) GetGlyphExtents(GlyphVar Glyph, InkRectVar *Rectangle, LogicalRectVar *Rectangle) { xFontGetGlyphExtents(x.GoPointer(), GlyphVar, InkRectVar, LogicalRectVar) } var xFontGetHbFont func(uintptr) uintptr // Get a `hb_font_t` object backing this font. // // Note that the objects returned by this function are cached // and immutable. If you need to make changes to the `hb_font_t`, // use [hb_font_create_sub_font()](https://harfbuzz.github.io/harfbuzz-hb-font.html#hb-font-create-sub-font). func (x *Font) GetHbFont() uintptr { cret := xFontGetHbFont(x.GoPointer()) return cret } var xFontGetLanguages func(uintptr) uintptr // Returns the languages that are supported by @font. // // If the font backend does not provide this information, // %NULL is returned. For the fontconfig backend, this // corresponds to the FC_LANG member of the FcPattern. // // The returned array is only valid as long as the font // and its fontmap are valid. func (x *Font) GetLanguages() uintptr { cret := xFontGetLanguages(x.GoPointer()) return cret } var xFontGetMetrics func(uintptr, *Language) *FontMetrics // Gets overall metric information for a font. // // 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. // // If @font is %NULL, this function gracefully sets some sane values in the // output variables and returns. func (x *Font) GetMetrics(LanguageVar *Language) *FontMetrics { cret := xFontGetMetrics(x.GoPointer(), LanguageVar) return cret } var xFontHasChar func(uintptr, uint32) bool // Returns whether the font provides a glyph for this character. func (x *Font) HasChar(WcVar uint32) bool { cret := xFontHasChar(x.GoPointer(), WcVar) return cret } var xFontSerialize func(uintptr) *glib.Bytes // Serializes the @font in a way that can be uniquely identified. // // There are no guarantees about the format of the output across different // versions of Pango. // // The intended use of this function is testing, benchmarking and debugging. // The format is not meant as a permanent storage format. // // To recreate a font from its serialized form, use [func@Pango.Font.deserialize]. func (x *Font) Serialize() *glib.Bytes { cret := xFontSerialize(x.GoPointer()) return cret } func (c *Font) GoPointer() uintptr { if c == nil { return 0 } return c.Ptr } func (c *Font) SetGoPointer(ptr uintptr) { c.Ptr = ptr } var xFontDescriptionsFree func(uintptr, int) // Frees an array of font descriptions. func FontDescriptionsFree(DescsVar uintptr, NDescsVar int) { xFontDescriptionsFree(DescsVar, NDescsVar) } var xFontDeserialize func(uintptr, *glib.Bytes, **glib.Error) uintptr // Loads data previously created via [method@Pango.Font.serialize]. // // For a discussion of the supported format, see that function. // // Note: to verify that the returned font is identical to // the one that was serialized, you can compare @bytes to the // result of serializing the font again. func FontDeserialize(ContextVar *Context, BytesVar *glib.Bytes) (*Font, error) { var cls *Font var cerr *glib.Error cret := xFontDeserialize(ContextVar.GoPointer(), BytesVar, &cerr) if cret == 0 { return nil, cerr } cls = &Font{} cls.Ptr = cret if cerr == nil { return cls, nil } return cls, cerr } // A `PangoFontFace` is used to represent a group of fonts with // the same family, slant, weight, and width, but varying sizes. type FontFace struct { gobject.Object } var xFontFaceGLibType func() types.GType func FontFaceGLibType() types.GType { return xFontFaceGLibType() } func FontFaceNewFromInternalPtr(ptr uintptr) *FontFace { cls := &FontFace{} cls.Ptr = ptr return cls } var xFontFaceDescribe func(uintptr) *FontDescription // Returns a font description that matches the face. // // The resulting font description will have the family, style, // variant, weight and stretch of the face, but its size field // will be unset. func (x *FontFace) Describe() *FontDescription { cret := xFontFaceDescribe(x.GoPointer()) return cret } var xFontFaceGetFaceName func(uintptr) string // Gets a name representing the style of this face. // // Note that a font family may contain multiple faces // with the same name (e.g. a variable and a non-variable // face for the same style). func (x *FontFace) GetFaceName() string { cret := xFontFaceGetFaceName(x.GoPointer()) return cret } var xFontFaceGetFamily func(uintptr) uintptr // Gets the `PangoFontFamily` that @face belongs to. func (x *FontFace) GetFamily() *FontFamily { var cls *FontFamily cret := xFontFaceGetFamily(x.GoPointer()) if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &FontFamily{} cls.Ptr = cret return cls } var xFontFaceIsSynthesized func(uintptr) bool // Returns whether a `PangoFontFace` is synthesized. // // This will be the case if the underlying font rendering engine // creates this face from another face, by shearing, emboldening, // lightening or modifying it in some other way. func (x *FontFace) IsSynthesized() bool { cret := xFontFaceIsSynthesized(x.GoPointer()) return cret } var xFontFaceListSizes func(uintptr, *[]int, *int) // List the available sizes for a font. // // This is only applicable to bitmap fonts. For scalable fonts, stores // %NULL at the location pointed to by @sizes and 0 at the location pointed // to by @n_sizes. The sizes returned are in Pango units and are sorted // in ascending order. func (x *FontFace) ListSizes(SizesVar *[]int, NSizesVar *int) { xFontFaceListSizes(x.GoPointer(), SizesVar, NSizesVar) } func (c *FontFace) GoPointer() uintptr { if c == nil { return 0 } return c.Ptr } func (c *FontFace) SetGoPointer(ptr uintptr) { c.Ptr = ptr } // A `PangoFontFamily` is used to represent a family of related // font faces. // // The font faces in a family share a common design, but differ in // slant, weight, width or other aspects. type FontFamily struct { gobject.Object } var xFontFamilyGLibType func() types.GType func FontFamilyGLibType() types.GType { return xFontFamilyGLibType() } func FontFamilyNewFromInternalPtr(ptr uintptr) *FontFamily { cls := &FontFamily{} cls.Ptr = ptr return cls } var xFontFamilyGetFace func(uintptr, uintptr) uintptr // Gets the `PangoFontFace` of @family with the given name. func (x *FontFamily) GetFace(NameVar *string) *FontFace { var cls *FontFace NameVarPtr := core.GStrdupNullable(NameVar) defer core.GFreeNullable(NameVarPtr) cret := xFontFamilyGetFace(x.GoPointer(), NameVarPtr) if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &FontFace{} cls.Ptr = cret return cls } var xFontFamilyGetName func(uintptr) string // Gets the name of the family. // // The name is unique among all fonts for the font backend and can // be used in a `PangoFontDescription` to specify that a face from // this family is desired. func (x *FontFamily) GetName() string { cret := xFontFamilyGetName(x.GoPointer()) return cret } var xFontFamilyIsMonospace func(uintptr) bool // A monospace font is a font designed for text display where the the // characters form a regular grid. // // For Western languages this would // mean that the advance width of all characters are the same, but // this categorization also includes Asian fonts which include // double-width characters: characters that occupy two grid cells. // g_unichar_iswide() returns a result that indicates whether a // character is typically double-width in a monospace font. // // The best way to find out the grid-cell size is to call // [method@Pango.FontMetrics.get_approximate_digit_width], since the // results of [method@Pango.FontMetrics.get_approximate_char_width] may // be affected by double-width characters. func (x *FontFamily) IsMonospace() bool { cret := xFontFamilyIsMonospace(x.GoPointer()) return cret } var xFontFamilyIsVariable func(uintptr) bool // A variable font is a font which has axes that can be modified to // produce different faces. // // Such axes are also known as _variations_; see // [method@Pango.FontDescription.set_variations] for more information. func (x *FontFamily) IsVariable() bool { cret := xFontFamilyIsVariable(x.GoPointer()) return cret } var xFontFamilyListFaces func(uintptr, *uintptr, *int) // Lists the different font faces that make up @family. // // The faces in a family share a common design, but differ in slant, weight, // width and other aspects. // // Note that the returned faces are not in any particular order, and // multiple faces may have the same name or characteristics. // // `PangoFontFamily` also implemented the [iface@Gio.ListModel] interface // for enumerating faces. func (x *FontFamily) ListFaces(FacesVar *uintptr, NFacesVar *int) { xFontFamilyListFaces(x.GoPointer(), FacesVar, NFacesVar) } func (c *FontFamily) GoPointer() uintptr { if c == nil { return 0 } return c.Ptr } func (c *FontFamily) SetGoPointer(ptr uintptr) { c.Ptr = ptr } // GetPropertyIsMonospace gets the "is-monospace" property. // Is this a monospace font func (x *FontFamily) GetPropertyIsMonospace() bool { var v gobject.Value x.GetProperty("is-monospace", &v) return v.GetBoolean() } // GetPropertyIsVariable gets the "is-variable" property. // Is this a variable font func (x *FontFamily) GetPropertyIsVariable() bool { var v gobject.Value x.GetProperty("is-variable", &v) return v.GetBoolean() } // GetPropertyNItems gets the "n-items" property. // The number of items contained in this list. func (x *FontFamily) GetPropertyNItems() uint { var v gobject.Value x.GetProperty("n-items", &v) return v.GetUint() } // GetPropertyName gets the "name" property. // The name of the family func (x *FontFamily) GetPropertyName() string { var v gobject.Value x.GetProperty("name", &v) return v.GetString() } // Get the item at @position. // // If @position is greater than the number of items in @list, %NULL is // returned. // // %NULL is never returned for an index that is smaller than the length // of the list. // // See also: g_list_model_get_n_items() func (x *FontFamily) GetItem(PositionVar uint) uintptr { cret := gio.XGListModelGetItem(x.GoPointer(), PositionVar) return cret } // Gets the type of the items in @list. // // All items returned from g_list_model_get_item() are of the type // returned by this function, or a subtype, or if the type is an // interface, they are an implementation of that interface. // // The item type of a #GListModel can not change during the life of the // model. func (x *FontFamily) GetItemType() types.GType { cret := gio.XGListModelGetItemType(x.GoPointer()) return cret } // Gets the number of items in @list. // // Depending on the model implementation, calling this function may be // less efficient than iterating the list with increasing values for // @position until g_list_model_get_item() returns %NULL. func (x *FontFamily) GetNItems() uint { cret := gio.XGListModelGetNItems(x.GoPointer()) return cret } // Get the item at @position. // // If @position is greater than the number of items in @list, %NULL is // returned. // // %NULL is never returned for an index that is smaller than the length // of the list. // // This function is meant to be used by language bindings in place // of g_list_model_get_item(). // // See also: g_list_model_get_n_items() func (x *FontFamily) GetObject(PositionVar uint) *gobject.Object { var cls *gobject.Object cret := gio.XGListModelGetObject(x.GoPointer(), PositionVar) if cret == 0 { return nil } cls = &gobject.Object{} cls.Ptr = cret return cls } // Emits the #GListModel::items-changed signal on @list. // // This function should only be called by classes implementing // #GListModel. It has to be called after the internal representation // of @list has been updated, because handlers connected to this signal // might query the new state of the list. // // Implementations must only make changes to the model (as visible to // its consumer) in places that will not cause problems for that // consumer. For models that are driven directly by a write API (such // as #GListStore), changes can be reported in response to uses of that // API. For models that represent remote data, changes should only be // made from a fresh mainloop dispatch. It is particularly not // permitted to make changes in response to a call to the #GListModel // consumer API. // // Stated another way: in general, it is assumed that code making a // series of accesses to the model via the API, without returning to the // mainloop, and without calling other code, will continue to view the // same contents of the model. func (x *FontFamily) ItemsChanged(PositionVar uint, RemovedVar uint, AddedVar uint) { gio.XGListModelItemsChanged(x.GoPointer(), PositionVar, RemovedVar, AddedVar) } 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(&xFontMaskGLibType, libs, "pango_font_mask_get_type") core.PuregoSafeRegister(&xFontColorGLibType, libs, "pango_font_color_get_type") core.PuregoSafeRegister(&xStretchGLibType, libs, "pango_stretch_get_type") core.PuregoSafeRegister(&xStyleGLibType, libs, "pango_style_get_type") core.PuregoSafeRegister(&xVariantGLibType, libs, "pango_variant_get_type") core.PuregoSafeRegister(&xWeightGLibType, libs, "pango_weight_get_type") core.PuregoSafeRegister(&xFontDescriptionFromString, libs, "pango_font_description_from_string") core.PuregoSafeRegister(&xFontDescriptionGLibType, libs, "pango_font_description_get_type") core.PuregoSafeRegister(&xNewFontDescription, libs, "pango_font_description_new") core.PuregoSafeRegister(&xFontDescriptionBetterMatch, libs, "pango_font_description_better_match") core.PuregoSafeRegister(&xFontDescriptionCopy, libs, "pango_font_description_copy") core.PuregoSafeRegister(&xFontDescriptionCopyStatic, libs, "pango_font_description_copy_static") core.PuregoSafeRegister(&xFontDescriptionEqual, libs, "pango_font_description_equal") core.PuregoSafeRegister(&xFontDescriptionFree, libs, "pango_font_description_free") core.PuregoSafeRegister(&xFontDescriptionGetColor, libs, "pango_font_description_get_color") core.PuregoSafeRegister(&xFontDescriptionGetFamily, libs, "pango_font_description_get_family") core.PuregoSafeRegister(&xFontDescriptionGetFeatures, libs, "pango_font_description_get_features") core.PuregoSafeRegister(&xFontDescriptionGetGravity, libs, "pango_font_description_get_gravity") core.PuregoSafeRegister(&xFontDescriptionGetSetFields, libs, "pango_font_description_get_set_fields") core.PuregoSafeRegister(&xFontDescriptionGetSize, libs, "pango_font_description_get_size") core.PuregoSafeRegister(&xFontDescriptionGetSizeIsAbsolute, libs, "pango_font_description_get_size_is_absolute") core.PuregoSafeRegister(&xFontDescriptionGetStretch, libs, "pango_font_description_get_stretch") core.PuregoSafeRegister(&xFontDescriptionGetStyle, libs, "pango_font_description_get_style") core.PuregoSafeRegister(&xFontDescriptionGetVariant, libs, "pango_font_description_get_variant") core.PuregoSafeRegister(&xFontDescriptionGetVariations, libs, "pango_font_description_get_variations") core.PuregoSafeRegister(&xFontDescriptionGetWeight, libs, "pango_font_description_get_weight") core.PuregoSafeRegister(&xFontDescriptionHash, libs, "pango_font_description_hash") core.PuregoSafeRegister(&xFontDescriptionMerge, libs, "pango_font_description_merge") core.PuregoSafeRegister(&xFontDescriptionMergeStatic, libs, "pango_font_description_merge_static") core.PuregoSafeRegister(&xFontDescriptionSetAbsoluteSize, libs, "pango_font_description_set_absolute_size") core.PuregoSafeRegister(&xFontDescriptionSetColor, libs, "pango_font_description_set_color") core.PuregoSafeRegister(&xFontDescriptionSetFamily, libs, "pango_font_description_set_family") core.PuregoSafeRegister(&xFontDescriptionSetFamilyStatic, libs, "pango_font_description_set_family_static") core.PuregoSafeRegister(&xFontDescriptionSetFeatures, libs, "pango_font_description_set_features") core.PuregoSafeRegister(&xFontDescriptionSetFeaturesStatic, libs, "pango_font_description_set_features_static") core.PuregoSafeRegister(&xFontDescriptionSetGravity, libs, "pango_font_description_set_gravity") core.PuregoSafeRegister(&xFontDescriptionSetSize, libs, "pango_font_description_set_size") core.PuregoSafeRegister(&xFontDescriptionSetStretch, libs, "pango_font_description_set_stretch") core.PuregoSafeRegister(&xFontDescriptionSetStyle, libs, "pango_font_description_set_style") core.PuregoSafeRegister(&xFontDescriptionSetVariant, libs, "pango_font_description_set_variant") core.PuregoSafeRegister(&xFontDescriptionSetVariations, libs, "pango_font_description_set_variations") core.PuregoSafeRegister(&xFontDescriptionSetVariationsStatic, libs, "pango_font_description_set_variations_static") core.PuregoSafeRegister(&xFontDescriptionSetWeight, libs, "pango_font_description_set_weight") core.PuregoSafeRegister(&xFontDescriptionToFilename, libs, "pango_font_description_to_filename") core.PuregoSafeRegister(&xFontDescriptionToString, libs, "pango_font_description_to_string") core.PuregoSafeRegister(&xFontDescriptionUnsetFields, libs, "pango_font_description_unset_fields") core.PuregoSafeRegister(&xFontMetricsGLibType, libs, "pango_font_metrics_get_type") core.PuregoSafeRegister(&xFontMetricsGetApproximateCharWidth, libs, "pango_font_metrics_get_approximate_char_width") core.PuregoSafeRegister(&xFontMetricsGetApproximateDigitWidth, libs, "pango_font_metrics_get_approximate_digit_width") core.PuregoSafeRegister(&xFontMetricsGetAscent, libs, "pango_font_metrics_get_ascent") core.PuregoSafeRegister(&xFontMetricsGetDescent, libs, "pango_font_metrics_get_descent") core.PuregoSafeRegister(&xFontMetricsGetHeight, libs, "pango_font_metrics_get_height") core.PuregoSafeRegister(&xFontMetricsGetStrikethroughPosition, libs, "pango_font_metrics_get_strikethrough_position") core.PuregoSafeRegister(&xFontMetricsGetStrikethroughThickness, libs, "pango_font_metrics_get_strikethrough_thickness") core.PuregoSafeRegister(&xFontMetricsGetUnderlinePosition, libs, "pango_font_metrics_get_underline_position") core.PuregoSafeRegister(&xFontMetricsGetUnderlineThickness, libs, "pango_font_metrics_get_underline_thickness") core.PuregoSafeRegister(&xFontMetricsRef, libs, "pango_font_metrics_ref") core.PuregoSafeRegister(&xFontMetricsUnref, libs, "pango_font_metrics_unref") core.PuregoSafeRegister(&xFontGLibType, libs, "pango_font_get_type") core.PuregoSafeRegister(&xFontDescribe, libs, "pango_font_describe") core.PuregoSafeRegister(&xFontDescribeWithAbsoluteSize, libs, "pango_font_describe_with_absolute_size") core.PuregoSafeRegister(&xFontGetCoverage, libs, "pango_font_get_coverage") core.PuregoSafeRegister(&xFontGetFace, libs, "pango_font_get_face") core.PuregoSafeRegister(&xFontGetFeatures, libs, "pango_font_get_features") core.PuregoSafeRegister(&xFontGetFontMap, libs, "pango_font_get_font_map") core.PuregoSafeRegister(&xFontGetGlyphExtents, libs, "pango_font_get_glyph_extents") core.PuregoSafeRegister(&xFontGetHbFont, libs, "pango_font_get_hb_font") core.PuregoSafeRegister(&xFontGetLanguages, libs, "pango_font_get_languages") core.PuregoSafeRegister(&xFontGetMetrics, libs, "pango_font_get_metrics") core.PuregoSafeRegister(&xFontHasChar, libs, "pango_font_has_char") core.PuregoSafeRegister(&xFontSerialize, libs, "pango_font_serialize") core.PuregoSafeRegister(&xFontDescriptionsFree, libs, "pango_font_descriptions_free") core.PuregoSafeRegister(&xFontDeserialize, libs, "pango_font_deserialize") core.PuregoSafeRegister(&xFontFaceGLibType, libs, "pango_font_face_get_type") core.PuregoSafeRegister(&xFontFaceDescribe, libs, "pango_font_face_describe") core.PuregoSafeRegister(&xFontFaceGetFaceName, libs, "pango_font_face_get_face_name") core.PuregoSafeRegister(&xFontFaceGetFamily, libs, "pango_font_face_get_family") core.PuregoSafeRegister(&xFontFaceIsSynthesized, libs, "pango_font_face_is_synthesized") core.PuregoSafeRegister(&xFontFaceListSizes, libs, "pango_font_face_list_sizes") core.PuregoSafeRegister(&xFontFamilyGLibType, libs, "pango_font_family_get_type") core.PuregoSafeRegister(&xFontFamilyGetFace, libs, "pango_font_family_get_face") core.PuregoSafeRegister(&xFontFamilyGetName, libs, "pango_font_family_get_name") core.PuregoSafeRegister(&xFontFamilyIsMonospace, libs, "pango_font_family_is_monospace") core.PuregoSafeRegister(&xFontFamilyIsVariable, libs, "pango_font_family_is_variable") core.PuregoSafeRegister(&xFontFamilyListFaces, libs, "pango_font_family_list_faces") }