v0.2.1 c0399be

pango-fontset.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"
13	"github.com/bnema/puregotk/v4/gobject/types"
14)
15
16// Callback used when enumerating fonts in a fontset.
17//
18// See [method@Pango.Fontset.foreach].
19type FontsetForeachFunc func(uintptr, uintptr, uintptr) bool
20
21// The `PangoFontsetClass` structure holds the virtual functions for
22// a particular `PangoFontset` implementation.
23type FontsetClass struct {
24	_ structs.HostLayout
25
26	ParentClass gobject.ObjectClass
27
28	xGetFont uintptr
29
30	xGetMetrics uintptr
31
32	xGetLanguage uintptr
33
34	xForeach uintptr
35
36	xPangoReserved1 uintptr
37
38	xPangoReserved2 uintptr
39
40	xPangoReserved3 uintptr
41
42	xPangoReserved4 uintptr
43}
44
45func (x *FontsetClass) GoPointer() uintptr {
46	return uintptr(unsafe.Pointer(x))
47}
48
49// OverrideGetFont sets the "get_font" callback function.
50// a function to get the font in the fontset that contains the
51//
52//	best glyph for the given Unicode character; see [method@Pango.Fontset.get_font]
53func (x *FontsetClass) OverrideGetFont(cb func(*Fontset, uint) *Font) {
54	if cb == nil {
55		x.xGetFont = 0
56	} else {
57		x.xGetFont = purego.NewCallback(func(FontsetVarp uintptr, WcVarp uint) uintptr {
58			ret := cb(FontsetNewFromInternalPtr(FontsetVarp), WcVarp)
59			if ret == nil {
60				return 0
61			}
62			return ret.GoPointer()
63		})
64	}
65}
66
67// GetGetFont gets the "get_font" callback function.
68// a function to get the font in the fontset that contains the
69//
70//	best glyph for the given Unicode character; see [method@Pango.Fontset.get_font]
71func (x *FontsetClass) GetGetFont() func(*Fontset, uint) *Font {
72	if x.xGetFont == 0 {
73		return nil
74	}
75	var rawCallback func(FontsetVarp uintptr, WcVarp uint) uintptr
76	purego.RegisterFunc(&rawCallback, x.xGetFont)
77	return func(FontsetVar *Fontset, WcVar uint) *Font {
78		rawRet := rawCallback(FontsetVar.GoPointer(), WcVar)
79		if rawRet == 0 {
80			return nil
81		}
82		ret := &Font{}
83		ret.Ptr = rawRet
84		return ret
85	}
86}
87
88// OverrideGetMetrics sets the "get_metrics" callback function.
89// a function to get overall metric information for the fonts
90//
91//	in the fontset; see [method@Pango.Fontset.get_metrics]
92func (x *FontsetClass) OverrideGetMetrics(cb func(*Fontset) *FontMetrics) {
93	if cb == nil {
94		x.xGetMetrics = 0
95	} else {
96		x.xGetMetrics = purego.NewCallback(func(FontsetVarp uintptr) *FontMetrics {
97			return cb(FontsetNewFromInternalPtr(FontsetVarp))
98		})
99	}
100}
101
102// GetGetMetrics gets the "get_metrics" callback function.
103// a function to get overall metric information for the fonts
104//
105//	in the fontset; see [method@Pango.Fontset.get_metrics]
106func (x *FontsetClass) GetGetMetrics() func(*Fontset) *FontMetrics {
107	if x.xGetMetrics == 0 {
108		return nil
109	}
110	var rawCallback func(FontsetVarp uintptr) *FontMetrics
111	purego.RegisterFunc(&rawCallback, x.xGetMetrics)
112	return func(FontsetVar *Fontset) *FontMetrics {
113		return rawCallback(FontsetVar.GoPointer())
114	}
115}
116
117// OverrideGetLanguage sets the "get_language" callback function.
118// a function to get the language of the fontset.
119func (x *FontsetClass) OverrideGetLanguage(cb func(*Fontset) *Language) {
120	if cb == nil {
121		x.xGetLanguage = 0
122	} else {
123		x.xGetLanguage = purego.NewCallback(func(FontsetVarp uintptr) *Language {
124			return cb(FontsetNewFromInternalPtr(FontsetVarp))
125		})
126	}
127}
128
129// GetGetLanguage gets the "get_language" callback function.
130// a function to get the language of the fontset.
131func (x *FontsetClass) GetGetLanguage() func(*Fontset) *Language {
132	if x.xGetLanguage == 0 {
133		return nil
134	}
135	var rawCallback func(FontsetVarp uintptr) *Language
136	purego.RegisterFunc(&rawCallback, x.xGetLanguage)
137	return func(FontsetVar *Fontset) *Language {
138		return rawCallback(FontsetVar.GoPointer())
139	}
140}
141
142// OverrideForeach sets the "foreach" callback function.
143// Callback used when enumerating fonts in a fontset.
144//
145// See [method@Pango.Fontset.foreach].
146func (x *FontsetClass) OverrideForeach(cb func(*Fontset, *FontsetForeachFunc, uintptr)) {
147	if cb == nil {
148		x.xForeach = 0
149	} else {
150		x.xForeach = purego.NewCallback(func(FontsetVarp uintptr, FuncVarp uintptr, DataVarp uintptr) {
151			cb(FontsetNewFromInternalPtr(FontsetVarp), (*FontsetForeachFunc)(unsafe.Pointer(FuncVarp)), DataVarp)
152		})
153	}
154}
155
156// GetForeach gets the "foreach" callback function.
157// Callback used when enumerating fonts in a fontset.
158//
159// See [method@Pango.Fontset.foreach].
160func (x *FontsetClass) GetForeach() func(*Fontset, *FontsetForeachFunc, uintptr) {
161	if x.xForeach == 0 {
162		return nil
163	}
164	var rawCallback func(FontsetVarp uintptr, FuncVarp uintptr, DataVarp uintptr)
165	purego.RegisterFunc(&rawCallback, x.xForeach)
166	return func(FontsetVar *Fontset, FuncVar *FontsetForeachFunc, DataVar uintptr) {
167		rawCallback(FontsetVar.GoPointer(), glib.NewCallback(FuncVar), DataVar)
168	}
169}
170
171// OverridePangoReserved1 sets the "_pango_reserved1" callback function.
172func (x *FontsetClass) OverridePangoReserved1(cb func()) {
173	if cb == nil {
174		x.xPangoReserved1 = 0
175	} else {
176		x.xPangoReserved1 = purego.NewCallback(func() {
177			cb()
178		})
179	}
180}
181
182// GetPangoReserved1 gets the "_pango_reserved1" callback function.
183func (x *FontsetClass) GetPangoReserved1() func() {
184	if x.xPangoReserved1 == 0 {
185		return nil
186	}
187	var rawCallback func()
188	purego.RegisterFunc(&rawCallback, x.xPangoReserved1)
189	return func() {
190		rawCallback()
191	}
192}
193
194// OverridePangoReserved2 sets the "_pango_reserved2" callback function.
195func (x *FontsetClass) OverridePangoReserved2(cb func()) {
196	if cb == nil {
197		x.xPangoReserved2 = 0
198	} else {
199		x.xPangoReserved2 = purego.NewCallback(func() {
200			cb()
201		})
202	}
203}
204
205// GetPangoReserved2 gets the "_pango_reserved2" callback function.
206func (x *FontsetClass) GetPangoReserved2() func() {
207	if x.xPangoReserved2 == 0 {
208		return nil
209	}
210	var rawCallback func()
211	purego.RegisterFunc(&rawCallback, x.xPangoReserved2)
212	return func() {
213		rawCallback()
214	}
215}
216
217// OverridePangoReserved3 sets the "_pango_reserved3" callback function.
218func (x *FontsetClass) OverridePangoReserved3(cb func()) {
219	if cb == nil {
220		x.xPangoReserved3 = 0
221	} else {
222		x.xPangoReserved3 = purego.NewCallback(func() {
223			cb()
224		})
225	}
226}
227
228// GetPangoReserved3 gets the "_pango_reserved3" callback function.
229func (x *FontsetClass) GetPangoReserved3() func() {
230	if x.xPangoReserved3 == 0 {
231		return nil
232	}
233	var rawCallback func()
234	purego.RegisterFunc(&rawCallback, x.xPangoReserved3)
235	return func() {
236		rawCallback()
237	}
238}
239
240// OverridePangoReserved4 sets the "_pango_reserved4" callback function.
241func (x *FontsetClass) OverridePangoReserved4(cb func()) {
242	if cb == nil {
243		x.xPangoReserved4 = 0
244	} else {
245		x.xPangoReserved4 = purego.NewCallback(func() {
246			cb()
247		})
248	}
249}
250
251// GetPangoReserved4 gets the "_pango_reserved4" callback function.
252func (x *FontsetClass) GetPangoReserved4() func() {
253	if x.xPangoReserved4 == 0 {
254		return nil
255	}
256	var rawCallback func()
257	purego.RegisterFunc(&rawCallback, x.xPangoReserved4)
258	return func() {
259		rawCallback()
260	}
261}
262
263// A `PangoFontset` represents a set of `PangoFont` to use when rendering text.
264//
265// A `PangoFontset` is the result of resolving a `PangoFontDescription`
266// against a particular `PangoContext`. It has operations for finding the
267// component font for a particular Unicode character, and for finding a
268// composite set of metrics for the entire fontset.
269type Fontset struct {
270	gobject.Object
271}
272
273var xFontsetGLibType func() types.GType
274
275func FontsetGLibType() types.GType {
276	return xFontsetGLibType()
277}
278
279func FontsetNewFromInternalPtr(ptr uintptr) *Fontset {
280	cls := &Fontset{}
281	cls.Ptr = ptr
282	return cls
283}
284
285var xFontsetForeach func(uintptr, uintptr, uintptr)
286
287// Iterates through all the fonts in a fontset, calling @func for
288// each one.
289//
290// If @func returns %TRUE, that stops the iteration.
291func (x *Fontset) Foreach(FuncVar *FontsetForeachFunc, DataVar uintptr) {
292
293	var FuncVarRef uintptr
294	if FuncVar != nil {
295		FuncVarPtr := uintptr(unsafe.Pointer(FuncVar))
296		if cbRefPtr, ok := glib.GetCallback(FuncVarPtr); ok {
297			FuncVarRef = cbRefPtr
298		} else {
299			fcb := func(arg0 uintptr, arg1 uintptr, arg2 uintptr) bool {
300				cbFn := *FuncVar
301				return cbFn(arg0, arg1, arg2)
302			}
303			FuncVarRef = purego.NewCallback(fcb)
304			glib.SaveCallbackWithClosure(FuncVarPtr, FuncVarRef, FuncVar)
305		}
306	}
307
308	xFontsetForeach(x.GoPointer(), FuncVarRef, DataVar)
309
310}
311
312var xFontsetGetFont func(uintptr, uint) uintptr
313
314// Returns the font in the fontset that contains the best
315// glyph for a Unicode character.
316func (x *Fontset) GetFont(WcVar uint) *Font {
317	var cls *Font
318
319	cret := xFontsetGetFont(x.GoPointer(), WcVar)
320
321	if cret == 0 {
322		return nil
323	}
324	cls = &Font{}
325	cls.Ptr = cret
326	return cls
327}
328
329var xFontsetGetMetrics func(uintptr) *FontMetrics
330
331// Get overall metric information for the fonts in the fontset.
332func (x *Fontset) GetMetrics() *FontMetrics {
333
334	cret := xFontsetGetMetrics(x.GoPointer())
335	return cret
336}
337
338func (c *Fontset) GoPointer() uintptr {
339	if c == nil {
340		return 0
341	}
342	return c.Ptr
343}
344
345func (c *Fontset) SetGoPointer(ptr uintptr) {
346	c.Ptr = ptr
347}
348
349func init() {
350	core.SetPackageName("PANGO", "pango")
351	core.SetSharedLibraries("PANGO", []string{"libpango-1.0.so.0"})
352	var libs []uintptr
353	for _, libPath := range core.GetPaths("PANGO") {
354		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
355		if err != nil {
356			panic(err)
357		}
358		libs = append(libs, lib)
359	}
360
361	core.PuregoSafeRegister(&xFontsetGLibType, libs, "pango_fontset_get_type")
362
363	core.PuregoSafeRegister(&xFontsetForeach, libs, "pango_fontset_foreach")
364	core.PuregoSafeRegister(&xFontsetGetFont, libs, "pango_fontset_get_font")
365	core.PuregoSafeRegister(&xFontsetGetMetrics, libs, "pango_fontset_get_metrics")
366
367}

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