v0.2.2 9100209

pango-context.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/gobject"
12	"github.com/bnema/puregotk/v4/gobject/types"
13)
14
15type ContextClass struct {
16	_ structs.HostLayout
17}
18
19func (x *ContextClass) GoPointer() uintptr {
20	return uintptr(unsafe.Pointer(x))
21}
22
23// A `PangoContext` stores global information used to control the
24// itemization process.
25//
26// The information stored by `PangoContext` includes the fontmap used
27// to look up fonts, and default values such as the default language,
28// default gravity, or default font.
29//
30// To obtain a `PangoContext`, use [method@Pango.FontMap.create_context].
31type Context struct {
32	gobject.Object
33}
34
35var xContextGLibType func() types.GType
36
37func ContextGLibType() types.GType {
38	return xContextGLibType()
39}
40
41func ContextNewFromInternalPtr(ptr uintptr) *Context {
42	cls := &Context{}
43	cls.Ptr = ptr
44	return cls
45}
46
47var xNewContext func() uintptr
48
49// Creates a new `PangoContext` initialized to default values.
50//
51// This function is not particularly useful as it should always
52// be followed by a [method@Pango.Context.set_font_map] call, and the
53// function [method@Pango.FontMap.create_context] does these two steps
54// together and hence users are recommended to use that.
55//
56// If you are using Pango as part of a higher-level system,
57// that system may have it's own way of create a `PangoContext`.
58// For instance, the GTK toolkit has, among others,
59// `gtk_widget_get_pango_context()`. Use those instead.
60func NewContext() *Context {
61	var cls *Context
62
63	cret := xNewContext()
64
65	if cret == 0 {
66		return nil
67	}
68	cls = &Context{}
69	cls.Ptr = cret
70	return cls
71}
72
73var xContextChanged func(uintptr)
74
75// Forces a change in the context, which will cause any `PangoLayout`
76// using this context to re-layout.
77//
78// This function is only useful when implementing a new backend
79// for Pango, something applications won't do. Backends should
80// call this function if they have attached extra data to the context
81// and such data is changed.
82func (x *Context) Changed() {
83
84	xContextChanged(x.GoPointer())
85
86}
87
88var xContextGetBaseDir func(uintptr) Direction
89
90// Retrieves the base direction for the context.
91//
92// See [method@Pango.Context.set_base_dir].
93func (x *Context) GetBaseDir() Direction {
94
95	cret := xContextGetBaseDir(x.GoPointer())
96	return cret
97}
98
99var xContextGetBaseGravity func(uintptr) Gravity
100
101// Retrieves the base gravity for the context.
102//
103// See [method@Pango.Context.set_base_gravity].
104func (x *Context) GetBaseGravity() Gravity {
105
106	cret := xContextGetBaseGravity(x.GoPointer())
107	return cret
108}
109
110var xContextGetFontDescription func(uintptr) *FontDescription
111
112// Retrieve the default font description for the context.
113func (x *Context) GetFontDescription() *FontDescription {
114
115	cret := xContextGetFontDescription(x.GoPointer())
116	return cret
117}
118
119var xContextGetFontMap func(uintptr) uintptr
120
121// Gets the `PangoFontMap` used to look up fonts for this context.
122func (x *Context) GetFontMap() *FontMap {
123	var cls *FontMap
124
125	cret := xContextGetFontMap(x.GoPointer())
126
127	if cret == 0 {
128		return nil
129	}
130	gobject.IncreaseRef(cret)
131	cls = &FontMap{}
132	cls.Ptr = cret
133	return cls
134}
135
136var xContextGetGravity func(uintptr) Gravity
137
138// Retrieves the gravity for the context.
139//
140// This is similar to [method@Pango.Context.get_base_gravity],
141// except for when the base gravity is %PANGO_GRAVITY_AUTO for
142// which [func@Pango.Gravity.get_for_matrix] is used to return the
143// gravity from the current context matrix.
144func (x *Context) GetGravity() Gravity {
145
146	cret := xContextGetGravity(x.GoPointer())
147	return cret
148}
149
150var xContextGetGravityHint func(uintptr) GravityHint
151
152// Retrieves the gravity hint for the context.
153//
154// See [method@Pango.Context.set_gravity_hint] for details.
155func (x *Context) GetGravityHint() GravityHint {
156
157	cret := xContextGetGravityHint(x.GoPointer())
158	return cret
159}
160
161var xContextGetLanguage func(uintptr) *Language
162
163// Retrieves the global language tag for the context.
164func (x *Context) GetLanguage() *Language {
165
166	cret := xContextGetLanguage(x.GoPointer())
167	return cret
168}
169
170var xContextGetMatrix func(uintptr) *Matrix
171
172// Gets the transformation matrix that will be applied when
173// rendering with this context.
174//
175// See [method@Pango.Context.set_matrix].
176func (x *Context) GetMatrix() *Matrix {
177
178	cret := xContextGetMatrix(x.GoPointer())
179	return cret
180}
181
182var xContextGetMetrics func(uintptr, *FontDescription, *Language) *FontMetrics
183
184// Get overall metric information for a particular font description.
185//
186// Since the metrics may be substantially different for different scripts,
187// a language tag can be provided to indicate that the metrics should be
188// retrieved that correspond to the script(s) used by that language.
189//
190// The `PangoFontDescription` is interpreted in the same way as by [func@itemize],
191// and the family name may be a comma separated list of names. If characters
192// from multiple of these families would be used to render the string, then
193// the returned fonts would be a composite of the metrics for the fonts loaded
194// for the individual families.
195func (x *Context) GetMetrics(DescVar *FontDescription, LanguageVar *Language) *FontMetrics {
196
197	cret := xContextGetMetrics(x.GoPointer(), DescVar, LanguageVar)
198	return cret
199}
200
201var xContextGetRoundGlyphPositions func(uintptr) bool
202
203// Returns whether font rendering with this context should
204// round glyph positions and widths.
205func (x *Context) GetRoundGlyphPositions() bool {
206
207	cret := xContextGetRoundGlyphPositions(x.GoPointer())
208	return cret
209}
210
211var xContextGetSerial func(uintptr) uint
212
213// Returns the current serial number of @context.
214//
215// The serial number is initialized to an small number larger than zero
216// when a new context is created and is increased whenever the context
217// is changed using any of the setter functions, or the `PangoFontMap` it
218// uses to find fonts has changed. The serial may wrap, but will never
219// have the value 0. Since it can wrap, never compare it with "less than",
220// always use "not equals".
221//
222// This can be used to automatically detect changes to a `PangoContext`,
223// and is only useful when implementing objects that need update when their
224// `PangoContext` changes, like `PangoLayout`.
225func (x *Context) GetSerial() uint {
226
227	cret := xContextGetSerial(x.GoPointer())
228	return cret
229}
230
231var xContextListFamilies func(uintptr, *uintptr, *int)
232
233// List all families for a context.
234func (x *Context) ListFamilies(FamiliesVar *uintptr, NFamiliesVar *int) {
235
236	xContextListFamilies(x.GoPointer(), FamiliesVar, NFamiliesVar)
237
238}
239
240var xContextLoadFont func(uintptr, *FontDescription) uintptr
241
242// Loads the font in one of the fontmaps in the context
243// that is the closest match for @desc.
244func (x *Context) LoadFont(DescVar *FontDescription) *Font {
245	var cls *Font
246
247	cret := xContextLoadFont(x.GoPointer(), DescVar)
248
249	if cret == 0 {
250		return nil
251	}
252	cls = &Font{}
253	cls.Ptr = cret
254	return cls
255}
256
257var xContextLoadFontset func(uintptr, *FontDescription, *Language) uintptr
258
259// Load a set of fonts in the context that can be used to render
260// a font matching @desc.
261func (x *Context) LoadFontset(DescVar *FontDescription, LanguageVar *Language) *Fontset {
262	var cls *Fontset
263
264	cret := xContextLoadFontset(x.GoPointer(), DescVar, LanguageVar)
265
266	if cret == 0 {
267		return nil
268	}
269	cls = &Fontset{}
270	cls.Ptr = cret
271	return cls
272}
273
274var xContextSetBaseDir func(uintptr, Direction)
275
276// Sets the base direction for the context.
277//
278// The base direction is used in applying the Unicode bidirectional
279// algorithm; if the @direction is %PANGO_DIRECTION_LTR or
280// %PANGO_DIRECTION_RTL, then the value will be used as the paragraph
281// direction in the Unicode bidirectional algorithm. A value of
282// %PANGO_DIRECTION_WEAK_LTR or %PANGO_DIRECTION_WEAK_RTL is used only
283// for paragraphs that do not contain any strong characters themselves.
284func (x *Context) SetBaseDir(DirectionVar Direction) {
285
286	xContextSetBaseDir(x.GoPointer(), DirectionVar)
287
288}
289
290var xContextSetBaseGravity func(uintptr, Gravity)
291
292// Sets the base gravity for the context.
293//
294// The base gravity is used in laying vertical text out.
295func (x *Context) SetBaseGravity(GravityVar Gravity) {
296
297	xContextSetBaseGravity(x.GoPointer(), GravityVar)
298
299}
300
301var xContextSetFontDescription func(uintptr, *FontDescription)
302
303// Set the default font description for the context
304func (x *Context) SetFontDescription(DescVar *FontDescription) {
305
306	xContextSetFontDescription(x.GoPointer(), DescVar)
307
308}
309
310var xContextSetFontMap func(uintptr, uintptr)
311
312// Sets the font map to be searched when fonts are looked-up
313// in this context.
314//
315// This is only for internal use by Pango backends, a `PangoContext`
316// obtained via one of the recommended methods should already have a
317// suitable font map.
318func (x *Context) SetFontMap(FontMapVar *FontMap) {
319
320	xContextSetFontMap(x.GoPointer(), FontMapVar.GoPointer())
321
322}
323
324var xContextSetGravityHint func(uintptr, GravityHint)
325
326// Sets the gravity hint for the context.
327//
328// The gravity hint is used in laying vertical text out, and
329// is only relevant if gravity of the context as returned by
330// [method@Pango.Context.get_gravity] is set to %PANGO_GRAVITY_EAST
331// or %PANGO_GRAVITY_WEST.
332func (x *Context) SetGravityHint(HintVar GravityHint) {
333
334	xContextSetGravityHint(x.GoPointer(), HintVar)
335
336}
337
338var xContextSetLanguage func(uintptr, *Language)
339
340// Sets the global language tag for the context.
341//
342// The default language for the locale of the running process
343// can be found using [func@Pango.Language.get_default].
344func (x *Context) SetLanguage(LanguageVar *Language) {
345
346	xContextSetLanguage(x.GoPointer(), LanguageVar)
347
348}
349
350var xContextSetMatrix func(uintptr, *Matrix)
351
352// Sets the transformation matrix that will be applied when rendering
353// with this context.
354//
355// Note that reported metrics are in the user space coordinates before
356// the application of the matrix, not device-space coordinates after the
357// application of the matrix. So, they don't scale with the matrix, though
358// they may change slightly for different matrices, depending on how the
359// text is fit to the pixel grid.
360func (x *Context) SetMatrix(MatrixVar *Matrix) {
361
362	xContextSetMatrix(x.GoPointer(), MatrixVar)
363
364}
365
366var xContextSetRoundGlyphPositions func(uintptr, bool)
367
368// Sets whether font rendering with this context should
369// round glyph positions and widths to integral positions,
370// in device units.
371//
372// This is useful when the renderer can't handle subpixel
373// positioning of glyphs.
374//
375// The default value is to round glyph positions, to remain
376// compatible with previous Pango behavior.
377func (x *Context) SetRoundGlyphPositions(RoundPositionsVar bool) {
378
379	xContextSetRoundGlyphPositions(x.GoPointer(), RoundPositionsVar)
380
381}
382
383func (c *Context) GoPointer() uintptr {
384	if c == nil {
385		return 0
386	}
387	return c.Ptr
388}
389
390func (c *Context) SetGoPointer(ptr uintptr) {
391	c.Ptr = ptr
392}
393
394func init() {
395	core.SetPackageName("PANGO", "pango")
396	core.SetSharedLibraries("PANGO", []string{"libpango-1.0.so.0"})
397	var libs []uintptr
398	for _, libPath := range core.GetPaths("PANGO") {
399		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
400		if err != nil {
401			panic(err)
402		}
403		libs = append(libs, lib)
404	}
405
406	core.PuregoSafeRegister(&xContextGLibType, libs, "pango_context_get_type")
407
408	core.PuregoSafeRegister(&xNewContext, libs, "pango_context_new")
409
410	core.PuregoSafeRegister(&xContextChanged, libs, "pango_context_changed")
411	core.PuregoSafeRegister(&xContextGetBaseDir, libs, "pango_context_get_base_dir")
412	core.PuregoSafeRegister(&xContextGetBaseGravity, libs, "pango_context_get_base_gravity")
413	core.PuregoSafeRegister(&xContextGetFontDescription, libs, "pango_context_get_font_description")
414	core.PuregoSafeRegister(&xContextGetFontMap, libs, "pango_context_get_font_map")
415	core.PuregoSafeRegister(&xContextGetGravity, libs, "pango_context_get_gravity")
416	core.PuregoSafeRegister(&xContextGetGravityHint, libs, "pango_context_get_gravity_hint")
417	core.PuregoSafeRegister(&xContextGetLanguage, libs, "pango_context_get_language")
418	core.PuregoSafeRegister(&xContextGetMatrix, libs, "pango_context_get_matrix")
419	core.PuregoSafeRegister(&xContextGetMetrics, libs, "pango_context_get_metrics")
420	core.PuregoSafeRegister(&xContextGetRoundGlyphPositions, libs, "pango_context_get_round_glyph_positions")
421	core.PuregoSafeRegister(&xContextGetSerial, libs, "pango_context_get_serial")
422	core.PuregoSafeRegister(&xContextListFamilies, libs, "pango_context_list_families")
423	core.PuregoSafeRegister(&xContextLoadFont, libs, "pango_context_load_font")
424	core.PuregoSafeRegister(&xContextLoadFontset, libs, "pango_context_load_fontset")
425	core.PuregoSafeRegister(&xContextSetBaseDir, libs, "pango_context_set_base_dir")
426	core.PuregoSafeRegister(&xContextSetBaseGravity, libs, "pango_context_set_base_gravity")
427	core.PuregoSafeRegister(&xContextSetFontDescription, libs, "pango_context_set_font_description")
428	core.PuregoSafeRegister(&xContextSetFontMap, libs, "pango_context_set_font_map")
429	core.PuregoSafeRegister(&xContextSetGravityHint, libs, "pango_context_set_gravity_hint")
430	core.PuregoSafeRegister(&xContextSetLanguage, libs, "pango_context_set_language")
431	core.PuregoSafeRegister(&xContextSetMatrix, libs, "pango_context_set_matrix")
432	core.PuregoSafeRegister(&xContextSetRoundGlyphPositions, libs, "pango_context_set_round_glyph_positions")
433
434}

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