v0.2.1 c0399be

pango-item.go RawHistoryFolder

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	"github.com/bnema/puregotk/v4/glib"
12	"github.com/bnema/puregotk/v4/gobject/types"
13)
14
15// The `PangoAnalysis` structure stores information about
16// the properties of a segment of text.
17type Analysis struct {
18	_ structs.HostLayout
19
20	ShapeEngine uintptr
21
22	LangEngine uintptr
23
24	Font *Font
25
26	Level byte
27
28	Gravity byte
29
30	Flags byte
31
32	Script byte
33
34	Language *Language
35
36	ExtraAttrs *glib.SList
37}
38
39func (x *Analysis) GoPointer() uintptr {
40	return uintptr(unsafe.Pointer(x))
41}
42
43// The `PangoItem` structure stores information about a segment of text.
44//
45// You typically obtain `PangoItems` by itemizing a piece of text
46// with [func@itemize].
47type Item struct {
48	_ structs.HostLayout
49
50	Offset int
51
52	Length int
53
54	NumChars int
55
56	Analysis uintptr
57}
58
59var xItemGLibType func() types.GType
60
61func ItemGLibType() types.GType {
62	return xItemGLibType()
63}
64
65func (x *Item) GoPointer() uintptr {
66	return uintptr(unsafe.Pointer(x))
67}
68
69var xNewItem func() *Item
70
71// Creates a new `PangoItem` structure initialized to default values.
72func NewItem() *Item {
73
74	cret := xNewItem()
75	return cret
76}
77
78var xItemApplyAttrs func(uintptr, *AttrIterator)
79
80// Add attributes to a `PangoItem`.
81//
82// The idea is that you have attributes that don't affect itemization,
83// such as font features, so you filter them out using
84// [method@Pango.AttrList.filter], itemize your text, then reapply the
85// attributes to the resulting items using this function.
86//
87// The @iter should be positioned before the range of the item,
88// and will be advanced past it. This function is meant to be called
89// in a loop over the items resulting from itemization, while passing
90// the iter to each call.
91func (x *Item) ApplyAttrs(IterVar *AttrIterator) {
92
93	xItemApplyAttrs(x.GoPointer(), IterVar)
94
95}
96
97var xItemCopy func(uintptr) *Item
98
99// Copy an existing `PangoItem` structure.
100func (x *Item) Copy() *Item {
101
102	cret := xItemCopy(x.GoPointer())
103	return cret
104}
105
106var xItemFree func(uintptr)
107
108// Free a `PangoItem` and all associated memory.
109func (x *Item) Free() {
110
111	xItemFree(x.GoPointer())
112
113}
114
115var xItemGetCharOffset func(uintptr) int
116
117// Returns the character offset of the item from the beginning
118// of the itemized text.
119//
120// If the item has not been obtained from Pango's itemization
121// machinery, then the character offset is not available. In
122// that case, this function returns -1.
123func (x *Item) GetCharOffset() int {
124
125	cret := xItemGetCharOffset(x.GoPointer())
126	return cret
127}
128
129var xItemSplit func(uintptr, int, int) *Item
130
131// Modifies @orig to cover only the text after @split_index, and
132// returns a new item that covers the text before @split_index that
133// used to be in @orig.
134//
135// You can think of @split_index as the length of the returned item.
136// @split_index may not be 0, and it may not be greater than or equal
137// to the length of @orig (that is, there must be at least one byte
138// assigned to each item, you can't create a zero-length item).
139// @split_offset is the length of the first item in chars, and must be
140// provided because the text used to generate the item isn't available,
141// so `pango_item_split()` can't count the char length of the split items
142// itself.
143func (x *Item) Split(SplitIndexVar int, SplitOffsetVar int) *Item {
144
145	cret := xItemSplit(x.GoPointer(), SplitIndexVar, SplitOffsetVar)
146	return cret
147}
148
149const (
150	// Whether the segment should be shifted to center around the baseline.
151	//
152	// This is mainly used in vertical writing directions.
153	ANALYSIS_FLAG_CENTERED_BASELINE int = 1
154	// Whether this run holds ellipsized text.
155	ANALYSIS_FLAG_IS_ELLIPSIS int = 2
156	// Whether to add a hyphen at the end of the run during shaping.
157	ANALYSIS_FLAG_NEED_HYPHEN int = 4
158)
159
160var xItemize func(uintptr, string, int, int, *AttrList, *AttrIterator) *glib.List
161
162// Breaks a piece of text into segments with consistent directional
163// level and font.
164//
165// Each byte of @text will be contained in exactly one of the items in the
166// returned list; the generated list of items will be in logical order (the
167// start offsets of the items are ascending).
168//
169// @cached_iter should be an iterator over @attrs currently positioned
170// at a range before or containing @start_index; @cached_iter will be
171// advanced to the range covering the position just after
172// @start_index + @length. (i.e. if itemizing in a loop, just keep passing
173// in the same @cached_iter).
174func Itemize(ContextVar *Context, TextVar string, StartIndexVar int, LengthVar int, AttrsVar *AttrList, CachedIterVar *AttrIterator) *glib.List {
175
176	cret := xItemize(ContextVar.GoPointer(), TextVar, StartIndexVar, LengthVar, AttrsVar, CachedIterVar)
177	return cret
178}
179
180var xItemizeWithBaseDir func(uintptr, Direction, string, int, int, *AttrList, *AttrIterator) *glib.List
181
182// Like `pango_itemize()`, but with an explicitly specified base direction.
183//
184// The base direction is used when computing bidirectional levels.
185// [func@itemize] gets the base direction from the `PangoContext`
186// (see [method@Pango.Context.set_base_dir]).
187func ItemizeWithBaseDir(ContextVar *Context, BaseDirVar Direction, TextVar string, StartIndexVar int, LengthVar int, AttrsVar *AttrList, CachedIterVar *AttrIterator) *glib.List {
188
189	cret := xItemizeWithBaseDir(ContextVar.GoPointer(), BaseDirVar, TextVar, StartIndexVar, LengthVar, AttrsVar, CachedIterVar)
190	return cret
191}
192
193var xReorderItems func(*glib.List) *glib.List
194
195// Reorder items from logical order to visual order.
196//
197// The visual order is determined from the associated directional
198// levels of the items. The original list is unmodified.
199//
200// (Please open a bug if you use this function.
201//
202//	It is not a particularly convenient interface, and the code
203//	is duplicated elsewhere in Pango for that reason.)
204func ReorderItems(ItemsVar *glib.List) *glib.List {
205
206	cret := xReorderItems(ItemsVar)
207	return cret
208}
209
210func init() {
211	core.SetPackageName("PANGO", "pango")
212	core.SetSharedLibraries("PANGO", []string{"libpango-1.0.so.0"})
213	var libs []uintptr
214	for _, libPath := range core.GetPaths("PANGO") {
215		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
216		if err != nil {
217			panic(err)
218		}
219		libs = append(libs, lib)
220	}
221
222	core.PuregoSafeRegister(&xItemize, libs, "pango_itemize")
223	core.PuregoSafeRegister(&xItemizeWithBaseDir, libs, "pango_itemize_with_base_dir")
224	core.PuregoSafeRegister(&xReorderItems, libs, "pango_reorder_items")
225
226	core.PuregoSafeRegister(&xItemGLibType, libs, "pango_item_get_type")
227
228	core.PuregoSafeRegister(&xNewItem, libs, "pango_item_new")
229
230	core.PuregoSafeRegister(&xItemApplyAttrs, libs, "pango_item_apply_attrs")
231	core.PuregoSafeRegister(&xItemCopy, libs, "pango_item_copy")
232	core.PuregoSafeRegister(&xItemFree, libs, "pango_item_free")
233	core.PuregoSafeRegister(&xItemGetCharOffset, libs, "pango_item_get_char_offset")
234	core.PuregoSafeRegister(&xItemSplit, libs, "pango_item_split")
235
236}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 102

↑↓ moveenter openesc close