v0.2.1 c0399be

pango-fontmap.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/gio"
12	"github.com/bnema/puregotk/v4/glib"
13	"github.com/bnema/puregotk/v4/gobject"
14	"github.com/bnema/puregotk/v4/gobject/types"
15)
16
17// The `PangoFontMapClass` structure holds the virtual functions for
18// a particular `PangoFontMap` implementation.
19type FontMapClass struct {
20	_ structs.HostLayout
21
22	ParentClass gobject.ObjectClass
23
24	xLoadFont uintptr
25
26	xListFamilies uintptr
27
28	xLoadFontset uintptr
29
30	ShapeEngineType uintptr
31
32	xGetSerial uintptr
33
34	xChanged uintptr
35
36	xGetFamily uintptr
37
38	xGetFace uintptr
39}
40
41func (x *FontMapClass) GoPointer() uintptr {
42	return uintptr(unsafe.Pointer(x))
43}
44
45// OverrideLoadFont sets the "load_font" callback function.
46// a function to load a font with a given description. See
47// pango_font_map_load_font().
48func (x *FontMapClass) OverrideLoadFont(cb func(*FontMap, *Context, *FontDescription) *Font) {
49	if cb == nil {
50		x.xLoadFont = 0
51	} else {
52		x.xLoadFont = purego.NewCallback(func(FontmapVarp uintptr, ContextVarp uintptr, DescVarp *FontDescription) uintptr {
53			ret := cb(FontMapNewFromInternalPtr(FontmapVarp), ContextNewFromInternalPtr(ContextVarp), DescVarp)
54			if ret == nil {
55				return 0
56			}
57			return ret.GoPointer()
58		})
59	}
60}
61
62// GetLoadFont gets the "load_font" callback function.
63// a function to load a font with a given description. See
64// pango_font_map_load_font().
65func (x *FontMapClass) GetLoadFont() func(*FontMap, *Context, *FontDescription) *Font {
66	if x.xLoadFont == 0 {
67		return nil
68	}
69	var rawCallback func(FontmapVarp uintptr, ContextVarp uintptr, DescVarp *FontDescription) uintptr
70	purego.RegisterFunc(&rawCallback, x.xLoadFont)
71	return func(FontmapVar *FontMap, ContextVar *Context, DescVar *FontDescription) *Font {
72		rawRet := rawCallback(FontmapVar.GoPointer(), ContextVar.GoPointer(), DescVar)
73		if rawRet == 0 {
74			return nil
75		}
76		ret := &Font{}
77		ret.Ptr = rawRet
78		return ret
79	}
80}
81
82// OverrideListFamilies sets the "list_families" callback function.
83// A function to list available font families. See
84// pango_font_map_list_families().
85func (x *FontMapClass) OverrideListFamilies(cb func(*FontMap, *uintptr, *int)) {
86	if cb == nil {
87		x.xListFamilies = 0
88	} else {
89		x.xListFamilies = purego.NewCallback(func(FontmapVarp uintptr, FamiliesVarp *uintptr, NFamiliesVarp *int) {
90			cb(FontMapNewFromInternalPtr(FontmapVarp), FamiliesVarp, NFamiliesVarp)
91		})
92	}
93}
94
95// GetListFamilies gets the "list_families" callback function.
96// A function to list available font families. See
97// pango_font_map_list_families().
98func (x *FontMapClass) GetListFamilies() func(*FontMap, *uintptr, *int) {
99	if x.xListFamilies == 0 {
100		return nil
101	}
102	var rawCallback func(FontmapVarp uintptr, FamiliesVarp *uintptr, NFamiliesVarp *int)
103	purego.RegisterFunc(&rawCallback, x.xListFamilies)
104	return func(FontmapVar *FontMap, FamiliesVar *uintptr, NFamiliesVar *int) {
105		rawCallback(FontmapVar.GoPointer(), FamiliesVar, NFamiliesVar)
106	}
107}
108
109// OverrideLoadFontset sets the "load_fontset" callback function.
110// a function to load a fontset with a given given description
111// suitable for a particular language. See pango_font_map_load_fontset().
112func (x *FontMapClass) OverrideLoadFontset(cb func(*FontMap, *Context, *FontDescription, *Language) *Fontset) {
113	if cb == nil {
114		x.xLoadFontset = 0
115	} else {
116		x.xLoadFontset = purego.NewCallback(func(FontmapVarp uintptr, ContextVarp uintptr, DescVarp *FontDescription, LanguageVarp *Language) uintptr {
117			ret := cb(FontMapNewFromInternalPtr(FontmapVarp), ContextNewFromInternalPtr(ContextVarp), DescVarp, LanguageVarp)
118			if ret == nil {
119				return 0
120			}
121			return ret.GoPointer()
122		})
123	}
124}
125
126// GetLoadFontset gets the "load_fontset" callback function.
127// a function to load a fontset with a given given description
128// suitable for a particular language. See pango_font_map_load_fontset().
129func (x *FontMapClass) GetLoadFontset() func(*FontMap, *Context, *FontDescription, *Language) *Fontset {
130	if x.xLoadFontset == 0 {
131		return nil
132	}
133	var rawCallback func(FontmapVarp uintptr, ContextVarp uintptr, DescVarp *FontDescription, LanguageVarp *Language) uintptr
134	purego.RegisterFunc(&rawCallback, x.xLoadFontset)
135	return func(FontmapVar *FontMap, ContextVar *Context, DescVar *FontDescription, LanguageVar *Language) *Fontset {
136		rawRet := rawCallback(FontmapVar.GoPointer(), ContextVar.GoPointer(), DescVar, LanguageVar)
137		if rawRet == 0 {
138			return nil
139		}
140		ret := &Fontset{}
141		ret.Ptr = rawRet
142		return ret
143	}
144}
145
146// OverrideGetSerial sets the "get_serial" callback function.
147// a function to get the serial number of the fontmap.
148// See pango_font_map_get_serial().
149func (x *FontMapClass) OverrideGetSerial(cb func(*FontMap) uint) {
150	if cb == nil {
151		x.xGetSerial = 0
152	} else {
153		x.xGetSerial = purego.NewCallback(func(FontmapVarp uintptr) uint {
154			return cb(FontMapNewFromInternalPtr(FontmapVarp))
155		})
156	}
157}
158
159// GetGetSerial gets the "get_serial" callback function.
160// a function to get the serial number of the fontmap.
161// See pango_font_map_get_serial().
162func (x *FontMapClass) GetGetSerial() func(*FontMap) uint {
163	if x.xGetSerial == 0 {
164		return nil
165	}
166	var rawCallback func(FontmapVarp uintptr) uint
167	purego.RegisterFunc(&rawCallback, x.xGetSerial)
168	return func(FontmapVar *FontMap) uint {
169		return rawCallback(FontmapVar.GoPointer())
170	}
171}
172
173// OverrideChanged sets the "changed" callback function.
174// See pango_font_map_changed()
175func (x *FontMapClass) OverrideChanged(cb func(*FontMap)) {
176	if cb == nil {
177		x.xChanged = 0
178	} else {
179		x.xChanged = purego.NewCallback(func(FontmapVarp uintptr) {
180			cb(FontMapNewFromInternalPtr(FontmapVarp))
181		})
182	}
183}
184
185// GetChanged gets the "changed" callback function.
186// See pango_font_map_changed()
187func (x *FontMapClass) GetChanged() func(*FontMap) {
188	if x.xChanged == 0 {
189		return nil
190	}
191	var rawCallback func(FontmapVarp uintptr)
192	purego.RegisterFunc(&rawCallback, x.xChanged)
193	return func(FontmapVar *FontMap) {
194		rawCallback(FontmapVar.GoPointer())
195	}
196}
197
198// OverrideGetFamily sets the "get_family" callback function.
199func (x *FontMapClass) OverrideGetFamily(cb func(*FontMap, string) *FontFamily) {
200	if cb == nil {
201		x.xGetFamily = 0
202	} else {
203		x.xGetFamily = purego.NewCallback(func(FontmapVarp uintptr, NameVarp string) uintptr {
204			ret := cb(FontMapNewFromInternalPtr(FontmapVarp), NameVarp)
205			if ret == nil {
206				return 0
207			}
208			return ret.GoPointer()
209		})
210	}
211}
212
213// GetGetFamily gets the "get_family" callback function.
214func (x *FontMapClass) GetGetFamily() func(*FontMap, string) *FontFamily {
215	if x.xGetFamily == 0 {
216		return nil
217	}
218	var rawCallback func(FontmapVarp uintptr, NameVarp string) uintptr
219	purego.RegisterFunc(&rawCallback, x.xGetFamily)
220	return func(FontmapVar *FontMap, NameVar string) *FontFamily {
221		rawRet := rawCallback(FontmapVar.GoPointer(), NameVar)
222		if rawRet == 0 {
223			return nil
224		}
225		ret := &FontFamily{}
226		ret.Ptr = rawRet
227		return ret
228	}
229}
230
231// OverrideGetFace sets the "get_face" callback function.
232func (x *FontMapClass) OverrideGetFace(cb func(*FontMap, *Font) *FontFace) {
233	if cb == nil {
234		x.xGetFace = 0
235	} else {
236		x.xGetFace = purego.NewCallback(func(FontmapVarp uintptr, FontVarp uintptr) uintptr {
237			ret := cb(FontMapNewFromInternalPtr(FontmapVarp), FontNewFromInternalPtr(FontVarp))
238			if ret == nil {
239				return 0
240			}
241			return ret.GoPointer()
242		})
243	}
244}
245
246// GetGetFace gets the "get_face" callback function.
247func (x *FontMapClass) GetGetFace() func(*FontMap, *Font) *FontFace {
248	if x.xGetFace == 0 {
249		return nil
250	}
251	var rawCallback func(FontmapVarp uintptr, FontVarp uintptr) uintptr
252	purego.RegisterFunc(&rawCallback, x.xGetFace)
253	return func(FontmapVar *FontMap, FontVar *Font) *FontFace {
254		rawRet := rawCallback(FontmapVar.GoPointer(), FontVar.GoPointer())
255		if rawRet == 0 {
256			return nil
257		}
258		ret := &FontFace{}
259		ret.Ptr = rawRet
260		return ret
261	}
262}
263
264// A `PangoFontMap` represents the set of fonts available for a
265// particular rendering system.
266//
267// This is a virtual object with implementations being specific to
268// particular rendering systems.
269type FontMap struct {
270	gobject.Object
271}
272
273var xFontMapGLibType func() types.GType
274
275func FontMapGLibType() types.GType {
276	return xFontMapGLibType()
277}
278
279func FontMapNewFromInternalPtr(ptr uintptr) *FontMap {
280	cls := &FontMap{}
281	cls.Ptr = ptr
282	return cls
283}
284
285var xFontMapAddFontFile func(uintptr, string, **glib.Error) bool
286
287// Loads a font file with one or more fonts into the `PangoFontMap`.
288//
289// The added fonts will take precedence over preexisting
290// fonts with the same name.
291func (x *FontMap) AddFontFile(FilenameVar string) (bool, error) {
292	var cerr *glib.Error
293
294	cret := xFontMapAddFontFile(x.GoPointer(), FilenameVar, &cerr)
295	if cerr == nil {
296		return cret, nil
297	}
298	return cret, cerr
299
300}
301
302var xFontMapChanged func(uintptr)
303
304// Forces a change in the fontmap, which will cause any `PangoContext`
305// using this fontmap to change.
306//
307// This function is only useful when implementing a new backend
308// for Pango, something applications won't do. Backends should
309// call this function if they have attached extra data to the
310// fontmap and such data is changed.
311func (x *FontMap) Changed() {
312
313	xFontMapChanged(x.GoPointer())
314
315}
316
317var xFontMapCreateContext func(uintptr) uintptr
318
319// Creates a `PangoContext` connected to @fontmap.
320//
321// This is equivalent to [ctor@Pango.Context.new] followed by
322// [method@Pango.Context.set_font_map].
323//
324// If you are using Pango as part of a higher-level system,
325// that system may have it's own way of create a `PangoContext`.
326// For instance, the GTK toolkit has, among others,
327// gtk_widget_get_pango_context(). Use those instead.
328func (x *FontMap) CreateContext() *Context {
329	var cls *Context
330
331	cret := xFontMapCreateContext(x.GoPointer())
332
333	if cret == 0 {
334		return nil
335	}
336	cls = &Context{}
337	cls.Ptr = cret
338	return cls
339}
340
341var xFontMapGetFamily func(uintptr, string) uintptr
342
343// Gets a font family by name.
344func (x *FontMap) GetFamily(NameVar string) *FontFamily {
345	var cls *FontFamily
346
347	cret := xFontMapGetFamily(x.GoPointer(), NameVar)
348
349	if cret == 0 {
350		return nil
351	}
352	gobject.IncreaseRef(cret)
353	cls = &FontFamily{}
354	cls.Ptr = cret
355	return cls
356}
357
358var xFontMapGetSerial func(uintptr) uint
359
360// Returns the current serial number of @fontmap.
361//
362// The serial number is initialized to an small number larger than zero
363// when a new fontmap is created and is increased whenever the fontmap
364// is changed. It may wrap, but will never have the value 0. Since it can
365// wrap, never compare it with "less than", always use "not equals".
366//
367// The fontmap can only be changed using backend-specific API, like changing
368// fontmap resolution.
369//
370// This can be used to automatically detect changes to a `PangoFontMap`,
371// like in `PangoContext`.
372func (x *FontMap) GetSerial() uint {
373
374	cret := xFontMapGetSerial(x.GoPointer())
375	return cret
376}
377
378var xFontMapListFamilies func(uintptr, *uintptr, *int)
379
380// List all families for a fontmap.
381//
382// Note that the returned families are not in any particular order.
383//
384// `PangoFontMap` also implemented the [iface@Gio.ListModel] interface
385// for enumerating families.
386func (x *FontMap) ListFamilies(FamiliesVar *uintptr, NFamiliesVar *int) {
387
388	xFontMapListFamilies(x.GoPointer(), FamiliesVar, NFamiliesVar)
389
390}
391
392var xFontMapLoadFont func(uintptr, uintptr, *FontDescription) uintptr
393
394// Load the font in the fontmap that is the closest match for @desc.
395func (x *FontMap) LoadFont(ContextVar *Context, DescVar *FontDescription) *Font {
396	var cls *Font
397
398	cret := xFontMapLoadFont(x.GoPointer(), ContextVar.GoPointer(), DescVar)
399
400	if cret == 0 {
401		return nil
402	}
403	cls = &Font{}
404	cls.Ptr = cret
405	return cls
406}
407
408var xFontMapLoadFontset func(uintptr, uintptr, *FontDescription, *Language) uintptr
409
410// Load a set of fonts in the fontmap that can be used to render
411// a font matching @desc.
412func (x *FontMap) LoadFontset(ContextVar *Context, DescVar *FontDescription, LanguageVar *Language) *Fontset {
413	var cls *Fontset
414
415	cret := xFontMapLoadFontset(x.GoPointer(), ContextVar.GoPointer(), DescVar, LanguageVar)
416
417	if cret == 0 {
418		return nil
419	}
420	cls = &Fontset{}
421	cls.Ptr = cret
422	return cls
423}
424
425var xFontMapReloadFont func(uintptr, uintptr, float64, uintptr, uintptr) uintptr
426
427// Returns a new font that is like @font, except that it is scaled
428// by @scale, its backend-dependent configuration (e.g. cairo font options)
429// is replaced by the one in @context, and its variations are replaced
430// by @variations.
431//
432// Note that the scaling here is meant to be linear, so this
433// scaling can be used to render a font on a hi-dpi display
434// without changing its optical size.
435func (x *FontMap) ReloadFont(FontVar *Font, ScaleVar float64, ContextVar *Context, VariationsVar *string) *Font {
436	var cls *Font
437
438	VariationsVarPtr := core.GStrdupNullable(VariationsVar)
439	defer core.GFreeNullable(VariationsVarPtr)
440
441	cret := xFontMapReloadFont(x.GoPointer(), FontVar.GoPointer(), ScaleVar, ContextVar.GoPointer(), VariationsVarPtr)
442
443	if cret == 0 {
444		return nil
445	}
446	cls = &Font{}
447	cls.Ptr = cret
448	return cls
449}
450
451func (c *FontMap) GoPointer() uintptr {
452	if c == nil {
453		return 0
454	}
455	return c.Ptr
456}
457
458func (c *FontMap) SetGoPointer(ptr uintptr) {
459	c.Ptr = ptr
460}
461
462// GetPropertyNItems gets the "n-items" property.
463// The number of items contained in this list.
464func (x *FontMap) GetPropertyNItems() uint {
465	var v gobject.Value
466	x.GetProperty("n-items", &v)
467	return v.GetUint()
468}
469
470// Get the item at @position.
471//
472// If @position is greater than the number of items in @list, %NULL is
473// returned.
474//
475// %NULL is never returned for an index that is smaller than the length
476// of the list.
477//
478// See also: g_list_model_get_n_items()
479func (x *FontMap) GetItem(PositionVar uint) uintptr {
480
481	cret := gio.XGListModelGetItem(x.GoPointer(), PositionVar)
482	return cret
483}
484
485// Gets the type of the items in @list.
486//
487// All items returned from g_list_model_get_item() are of the type
488// returned by this function, or a subtype, or if the type is an
489// interface, they are an implementation of that interface.
490//
491// The item type of a #GListModel can not change during the life of the
492// model.
493func (x *FontMap) GetItemType() types.GType {
494
495	cret := gio.XGListModelGetItemType(x.GoPointer())
496	return cret
497}
498
499// Gets the number of items in @list.
500//
501// Depending on the model implementation, calling this function may be
502// less efficient than iterating the list with increasing values for
503// @position until g_list_model_get_item() returns %NULL.
504func (x *FontMap) GetNItems() uint {
505
506	cret := gio.XGListModelGetNItems(x.GoPointer())
507	return cret
508}
509
510// Get the item at @position.
511//
512// If @position is greater than the number of items in @list, %NULL is
513// returned.
514//
515// %NULL is never returned for an index that is smaller than the length
516// of the list.
517//
518// This function is meant to be used by language bindings in place
519// of g_list_model_get_item().
520//
521// See also: g_list_model_get_n_items()
522func (x *FontMap) GetObject(PositionVar uint) *gobject.Object {
523	var cls *gobject.Object
524
525	cret := gio.XGListModelGetObject(x.GoPointer(), PositionVar)
526
527	if cret == 0 {
528		return nil
529	}
530	cls = &gobject.Object{}
531	cls.Ptr = cret
532	return cls
533}
534
535// Emits the #GListModel::items-changed signal on @list.
536//
537// This function should only be called by classes implementing
538// #GListModel. It has to be called after the internal representation
539// of @list has been updated, because handlers connected to this signal
540// might query the new state of the list.
541//
542// Implementations must only make changes to the model (as visible to
543// its consumer) in places that will not cause problems for that
544// consumer.  For models that are driven directly by a write API (such
545// as #GListStore), changes can be reported in response to uses of that
546// API.  For models that represent remote data, changes should only be
547// made from a fresh mainloop dispatch.  It is particularly not
548// permitted to make changes in response to a call to the #GListModel
549// consumer API.
550//
551// Stated another way: in general, it is assumed that code making a
552// series of accesses to the model via the API, without returning to the
553// mainloop, and without calling other code, will continue to view the
554// same contents of the model.
555func (x *FontMap) ItemsChanged(PositionVar uint, RemovedVar uint, AddedVar uint) {
556
557	gio.XGListModelItemsChanged(x.GoPointer(), PositionVar, RemovedVar, AddedVar)
558
559}
560
561func init() {
562	core.SetPackageName("PANGO", "pango")
563	core.SetSharedLibraries("PANGO", []string{"libpango-1.0.so.0"})
564	var libs []uintptr
565	for _, libPath := range core.GetPaths("PANGO") {
566		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
567		if err != nil {
568			panic(err)
569		}
570		libs = append(libs, lib)
571	}
572
573	core.PuregoSafeRegister(&xFontMapGLibType, libs, "pango_font_map_get_type")
574
575	core.PuregoSafeRegister(&xFontMapAddFontFile, libs, "pango_font_map_add_font_file")
576	core.PuregoSafeRegister(&xFontMapChanged, libs, "pango_font_map_changed")
577	core.PuregoSafeRegister(&xFontMapCreateContext, libs, "pango_font_map_create_context")
578	core.PuregoSafeRegister(&xFontMapGetFamily, libs, "pango_font_map_get_family")
579	core.PuregoSafeRegister(&xFontMapGetSerial, libs, "pango_font_map_get_serial")
580	core.PuregoSafeRegister(&xFontMapListFamilies, libs, "pango_font_map_list_families")
581	core.PuregoSafeRegister(&xFontMapLoadFont, libs, "pango_font_map_load_font")
582	core.PuregoSafeRegister(&xFontMapLoadFontset, libs, "pango_font_map_load_fontset")
583	core.PuregoSafeRegister(&xFontMapReloadFont, libs, "pango_font_map_reload_font")
584
585}

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