1// Package pango was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package pango
3
4import (
5 "structs"
6 "unsafe"
7
8 "github.com/ebitengine/purego"
9
10 "github.com/bnema/puregotk/pkg/core"
11)
12
13// The `PangoLogAttr` structure stores information about the attributes of a
14// single character.
15type LogAttr struct {
16 _ structs.HostLayout
17
18 IsLineBreak uint
19
20 IsMandatoryBreak uint
21
22 IsCharBreak uint
23
24 IsWhite uint
25
26 IsCursorPosition uint
27
28 IsWordStart uint
29
30 IsWordEnd uint
31
32 IsSentenceBoundary uint
33
34 IsSentenceStart uint
35
36 IsSentenceEnd uint
37
38 BackspaceDeletesCharacter uint
39
40 IsExpandableSpace uint
41
42 IsWordBoundary uint
43
44 BreakInsertsHyphen uint
45
46 BreakRemovesPreceding uint
47
48 Reserved uint
49}
50
51func (x *LogAttr) GoPointer() uintptr {
52 return uintptr(unsafe.Pointer(x))
53}
54
55var xAttrBreak func(string, int, *AttrList, int, *[]LogAttr, int)
56
57// Apply customization from attributes to the breaks in @attrs.
58//
59// The line breaks are assumed to have been produced
60// by [func@Pango.default_break] and [func@Pango.tailor_break].
61func AttrBreak(TextVar string, LengthVar int, AttrListVar *AttrList, OffsetVar int, AttrsVar *[]LogAttr, AttrsLenVar int) {
62
63 xAttrBreak(TextVar, LengthVar, AttrListVar, OffsetVar, AttrsVar, AttrsLenVar)
64
65}
66
67var xBreak func(string, int, *Analysis, *[]LogAttr, int)
68
69// Determines possible line, word, and character breaks
70// for a string of Unicode text with a single analysis.
71//
72// For most purposes you may want to use [func@Pango.get_log_attrs].
73func Break(TextVar string, LengthVar int, AnalysisVar *Analysis, AttrsVar *[]LogAttr, AttrsLenVar int) {
74
75 xBreak(TextVar, LengthVar, AnalysisVar, AttrsVar, AttrsLenVar)
76
77}
78
79var xDefaultBreak func(string, int, *Analysis, *[]LogAttr, int)
80
81// This is the default break algorithm.
82//
83// It applies rules from the [Unicode Line Breaking Algorithm](http://www.unicode.org/unicode/reports/tr14/)
84// without language-specific tailoring, therefore the @analyis argument is unused
85// and can be %NULL.
86//
87// See [func@Pango.tailor_break] for language-specific breaks.
88//
89// See [func@Pango.attr_break] for attribute-based customization.
90func DefaultBreak(TextVar string, LengthVar int, AnalysisVar *Analysis, AttrsVar *[]LogAttr, AttrsLenVar int) {
91
92 xDefaultBreak(TextVar, LengthVar, AnalysisVar, AttrsVar, AttrsLenVar)
93
94}
95
96var xGetLogAttrs func(string, int, int, *Language, *[]LogAttr, int)
97
98// Computes a `PangoLogAttr` for each character in @text.
99//
100// The @attrs array must have one `PangoLogAttr` for
101// each position in @text; if @text contains N characters,
102// it has N+1 positions, including the last position at the
103// end of the text. @text should be an entire paragraph;
104// logical attributes can't be computed without context
105// (for example you need to see spaces on either side of
106// a word to know the word is a word).
107func GetLogAttrs(TextVar string, LengthVar int, LevelVar int, LanguageVar *Language, AttrsVar *[]LogAttr, AttrsLenVar int) {
108
109 xGetLogAttrs(TextVar, LengthVar, LevelVar, LanguageVar, AttrsVar, AttrsLenVar)
110
111}
112
113var xTailorBreak func(string, int, *Analysis, int, *[]LogAttr, int)
114
115// Apply language-specific tailoring to the breaks in @attrs.
116//
117// The line breaks are assumed to have been produced by [func@Pango.default_break].
118//
119// If @offset is not -1, it is used to apply attributes from @analysis that are
120// relevant to line breaking.
121//
122// Note that it is better to pass -1 for @offset and use [func@Pango.attr_break]
123// to apply attributes to the whole paragraph.
124func TailorBreak(TextVar string, LengthVar int, AnalysisVar *Analysis, OffsetVar int, AttrsVar *[]LogAttr, AttrsLenVar int) {
125
126 xTailorBreak(TextVar, LengthVar, AnalysisVar, OffsetVar, AttrsVar, AttrsLenVar)
127
128}
129
130func init() {
131 core.SetPackageName("PANGO", "pango")
132 core.SetSharedLibraries("PANGO", []string{"libpango-1.0.so.0"})
133 var libs []uintptr
134 for _, libPath := range core.GetPaths("PANGO") {
135 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
136 if err != nil {
137 panic(err)
138 }
139 libs = append(libs, lib)
140 }
141
142 core.PuregoSafeRegister(&xAttrBreak, libs, "pango_attr_break")
143 core.PuregoSafeRegister(&xBreak, libs, "pango_break")
144 core.PuregoSafeRegister(&xDefaultBreak, libs, "pango_default_break")
145 core.PuregoSafeRegister(&xGetLogAttrs, libs, "pango_get_log_attrs")
146 core.PuregoSafeRegister(&xTailorBreak, libs, "pango_tailor_break")
147
148}