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/types"
12)
13
14// A `PangoScriptIter` is used to iterate through a string
15// and identify ranges in different scripts.
16type ScriptIter struct {
17 _ structs.HostLayout
18}
19
20var xScriptIterGLibType func() types.GType
21
22func ScriptIterGLibType() types.GType {
23 return xScriptIterGLibType()
24}
25
26func (x *ScriptIter) GoPointer() uintptr {
27 return uintptr(unsafe.Pointer(x))
28}
29
30var xNewScriptIter func(string, int) *ScriptIter
31
32// Create a new `PangoScriptIter`, used to break a string of
33// Unicode text into runs by Unicode script.
34//
35// No copy is made of @text, so the caller needs to make
36// sure it remains valid until the iterator is freed with
37// [method@Pango.ScriptIter.free].
38func NewScriptIter(TextVar string, LengthVar int) *ScriptIter {
39
40 cret := xNewScriptIter(TextVar, LengthVar)
41 return cret
42}
43
44var xScriptIterFree func(uintptr)
45
46// Frees a `PangoScriptIter`.
47func (x *ScriptIter) Free() {
48
49 xScriptIterFree(x.GoPointer())
50
51}
52
53var xScriptIterGetRange func(uintptr, *string, *string, *Script)
54
55// Gets information about the range to which @iter currently points.
56//
57// The range is the set of locations p where *start <= p < *end.
58// (That is, it doesn't include the character stored at *end)
59//
60// Note that while the type of the @script argument is declared
61// as `PangoScript`, as of Pango 1.18, this function simply returns
62// `GUnicodeScript` values. Callers must be prepared to handle unknown
63// values.
64func (x *ScriptIter) GetRange(StartVar *string, EndVar *string, ScriptVar *Script) {
65
66 xScriptIterGetRange(x.GoPointer(), StartVar, EndVar, ScriptVar)
67
68}
69
70var xScriptIterNext func(uintptr) bool
71
72// Advances a `PangoScriptIter` to the next range.
73//
74// If @iter is already at the end, it is left unchanged
75// and %FALSE is returned.
76func (x *ScriptIter) Next() bool {
77
78 cret := xScriptIterNext(x.GoPointer())
79 return cret
80}
81
82// The `PangoScript` enumeration identifies different writing
83// systems.
84//
85// The values correspond to the names as defined in the Unicode standard. See
86// [Unicode Standard Annex 24: Script names](http://www.unicode.org/reports/tr24/)
87//
88// Note that this enumeration is deprecated and will not be updated to include values
89// in newer versions of the Unicode standard. Applications should use the
90// [enum@GLib.UnicodeScript] enumeration instead,
91// whose values are interchangeable with `PangoScript`.
92type Script int
93
94var xScriptGLibType func() types.GType
95
96func ScriptGLibType() types.GType {
97 return xScriptGLibType()
98}
99
100const (
101
102 // a value never returned from pango_script_for_unichar()
103 ScriptInvalidCodeValue Script = -1
104 // a character used by multiple different scripts
105 ScriptCommonValue Script = 0
106 // a mark glyph that takes its script from the
107 // base glyph to which it is attached
108 ScriptInheritedValue Script = 1
109 // Arabic
110 ScriptArabicValue Script = 2
111 // Armenian
112 ScriptArmenianValue Script = 3
113 // Bengali
114 ScriptBengaliValue Script = 4
115 // Bopomofo
116 ScriptBopomofoValue Script = 5
117 // Cherokee
118 ScriptCherokeeValue Script = 6
119 // Coptic
120 ScriptCopticValue Script = 7
121 // Cyrillic
122 ScriptCyrillicValue Script = 8
123 // Deseret
124 ScriptDeseretValue Script = 9
125 // Devanagari
126 ScriptDevanagariValue Script = 10
127 // Ethiopic
128 ScriptEthiopicValue Script = 11
129 // Georgian
130 ScriptGeorgianValue Script = 12
131 // Gothic
132 ScriptGothicValue Script = 13
133 // Greek
134 ScriptGreekValue Script = 14
135 // Gujarati
136 ScriptGujaratiValue Script = 15
137 // Gurmukhi
138 ScriptGurmukhiValue Script = 16
139 // Han
140 ScriptHanValue Script = 17
141 // Hangul
142 ScriptHangulValue Script = 18
143 // Hebrew
144 ScriptHebrewValue Script = 19
145 // Hiragana
146 ScriptHiraganaValue Script = 20
147 // Kannada
148 ScriptKannadaValue Script = 21
149 // Katakana
150 ScriptKatakanaValue Script = 22
151 // Khmer
152 ScriptKhmerValue Script = 23
153 // Lao
154 ScriptLaoValue Script = 24
155 // Latin
156 ScriptLatinValue Script = 25
157 // Malayalam
158 ScriptMalayalamValue Script = 26
159 // Mongolian
160 ScriptMongolianValue Script = 27
161 // Myanmar
162 ScriptMyanmarValue Script = 28
163 // Ogham
164 ScriptOghamValue Script = 29
165 // Old Italic
166 ScriptOldItalicValue Script = 30
167 // Oriya
168 ScriptOriyaValue Script = 31
169 // Runic
170 ScriptRunicValue Script = 32
171 // Sinhala
172 ScriptSinhalaValue Script = 33
173 // Syriac
174 ScriptSyriacValue Script = 34
175 // Tamil
176 ScriptTamilValue Script = 35
177 // Telugu
178 ScriptTeluguValue Script = 36
179 // Thaana
180 ScriptThaanaValue Script = 37
181 // Thai
182 ScriptThaiValue Script = 38
183 // Tibetan
184 ScriptTibetanValue Script = 39
185 // Canadian Aboriginal
186 ScriptCanadianAboriginalValue Script = 40
187 // Yi
188 ScriptYiValue Script = 41
189 // Tagalog
190 ScriptTagalogValue Script = 42
191 // Hanunoo
192 ScriptHanunooValue Script = 43
193 // Buhid
194 ScriptBuhidValue Script = 44
195 // Tagbanwa
196 ScriptTagbanwaValue Script = 45
197 // Braille
198 ScriptBrailleValue Script = 46
199 // Cypriot
200 ScriptCypriotValue Script = 47
201 // Limbu
202 ScriptLimbuValue Script = 48
203 // Osmanya
204 ScriptOsmanyaValue Script = 49
205 // Shavian
206 ScriptShavianValue Script = 50
207 // Linear B
208 ScriptLinearBValue Script = 51
209 // Tai Le
210 ScriptTaiLeValue Script = 52
211 // Ugaritic
212 ScriptUgariticValue Script = 53
213 // New Tai Lue. Since 1.10
214 ScriptNewTaiLueValue Script = 54
215 // Buginese. Since 1.10
216 ScriptBugineseValue Script = 55
217 // Glagolitic. Since 1.10
218 ScriptGlagoliticValue Script = 56
219 // Tifinagh. Since 1.10
220 ScriptTifinaghValue Script = 57
221 // Syloti Nagri. Since 1.10
222 ScriptSylotiNagriValue Script = 58
223 // Old Persian. Since 1.10
224 ScriptOldPersianValue Script = 59
225 // Kharoshthi. Since 1.10
226 ScriptKharoshthiValue Script = 60
227 // an unassigned code point. Since 1.14
228 ScriptUnknownValue Script = 61
229 // Balinese. Since 1.14
230 ScriptBalineseValue Script = 62
231 // Cuneiform. Since 1.14
232 ScriptCuneiformValue Script = 63
233 // Phoenician. Since 1.14
234 ScriptPhoenicianValue Script = 64
235 // Phags-pa. Since 1.14
236 ScriptPhagsPaValue Script = 65
237 // N'Ko. Since 1.14
238 ScriptNkoValue Script = 66
239 // Kayah Li. Since 1.20.1
240 ScriptKayahLiValue Script = 67
241 // Lepcha. Since 1.20.1
242 ScriptLepchaValue Script = 68
243 // Rejang. Since 1.20.1
244 ScriptRejangValue Script = 69
245 // Sundanese. Since 1.20.1
246 ScriptSundaneseValue Script = 70
247 // Saurashtra. Since 1.20.1
248 ScriptSaurashtraValue Script = 71
249 // Cham. Since 1.20.1
250 ScriptChamValue Script = 72
251 // Ol Chiki. Since 1.20.1
252 ScriptOlChikiValue Script = 73
253 // Vai. Since 1.20.1
254 ScriptVaiValue Script = 74
255 // Carian. Since 1.20.1
256 ScriptCarianValue Script = 75
257 // Lycian. Since 1.20.1
258 ScriptLycianValue Script = 76
259 // Lydian. Since 1.20.1
260 ScriptLydianValue Script = 77
261 // Batak. Since 1.32
262 ScriptBatakValue Script = 78
263 // Brahmi. Since 1.32
264 ScriptBrahmiValue Script = 79
265 // Mandaic. Since 1.32
266 ScriptMandaicValue Script = 80
267 // Chakma. Since: 1.32
268 ScriptChakmaValue Script = 81
269 // Meroitic Cursive. Since: 1.32
270 ScriptMeroiticCursiveValue Script = 82
271 // Meroitic Hieroglyphs. Since: 1.32
272 ScriptMeroiticHieroglyphsValue Script = 83
273 // Miao. Since: 1.32
274 ScriptMiaoValue Script = 84
275 // Sharada. Since: 1.32
276 ScriptSharadaValue Script = 85
277 // Sora Sompeng. Since: 1.32
278 ScriptSoraSompengValue Script = 86
279 // Takri. Since: 1.32
280 ScriptTakriValue Script = 87
281 // Bassa. Since: 1.40
282 ScriptBassaVahValue Script = 88
283 // Caucasian Albanian. Since: 1.40
284 ScriptCaucasianAlbanianValue Script = 89
285 // Duployan. Since: 1.40
286 ScriptDuployanValue Script = 90
287 // Elbasan. Since: 1.40
288 ScriptElbasanValue Script = 91
289 // Grantha. Since: 1.40
290 ScriptGranthaValue Script = 92
291 // Kjohki. Since: 1.40
292 ScriptKhojkiValue Script = 93
293 // Khudawadi, Sindhi. Since: 1.40
294 ScriptKhudawadiValue Script = 94
295 // Linear A. Since: 1.40
296 ScriptLinearAValue Script = 95
297 // Mahajani. Since: 1.40
298 ScriptMahajaniValue Script = 96
299 // Manichaean. Since: 1.40
300 ScriptManichaeanValue Script = 97
301 // Mende Kikakui. Since: 1.40
302 ScriptMendeKikakuiValue Script = 98
303 // Modi. Since: 1.40
304 ScriptModiValue Script = 99
305 // Mro. Since: 1.40
306 ScriptMroValue Script = 100
307 // Nabataean. Since: 1.40
308 ScriptNabataeanValue Script = 101
309 // Old North Arabian. Since: 1.40
310 ScriptOldNorthArabianValue Script = 102
311 // Old Permic. Since: 1.40
312 ScriptOldPermicValue Script = 103
313 // Pahawh Hmong. Since: 1.40
314 ScriptPahawhHmongValue Script = 104
315 // Palmyrene. Since: 1.40
316 ScriptPalmyreneValue Script = 105
317 // Pau Cin Hau. Since: 1.40
318 ScriptPauCinHauValue Script = 106
319 // Psalter Pahlavi. Since: 1.40
320 ScriptPsalterPahlaviValue Script = 107
321 // Siddham. Since: 1.40
322 ScriptSiddhamValue Script = 108
323 // Tirhuta. Since: 1.40
324 ScriptTirhutaValue Script = 109
325 // Warang Citi. Since: 1.40
326 ScriptWarangCitiValue Script = 110
327 // Ahom. Since: 1.40
328 ScriptAhomValue Script = 111
329 // Anatolian Hieroglyphs. Since: 1.40
330 ScriptAnatolianHieroglyphsValue Script = 112
331 // Hatran. Since: 1.40
332 ScriptHatranValue Script = 113
333 // Multani. Since: 1.40
334 ScriptMultaniValue Script = 114
335 // Old Hungarian. Since: 1.40
336 ScriptOldHungarianValue Script = 115
337 // Signwriting. Since: 1.40
338 ScriptSignwritingValue Script = 116
339)
340
341var xScriptForUnichar func(uint32) Script
342
343// Looks up the script for a particular character.
344//
345// The script of a character is defined by
346// [Unicode Standard Annex 24: Script names](http://www.unicode.org/reports/tr24/).
347//
348// No check is made for @ch being a valid Unicode character; if you pass
349// in invalid character, the result is undefined.
350//
351// Note that while the return type of this function is declared
352// as `PangoScript`, as of Pango 1.18, this function simply returns
353// the return value of [func@GLib.unichar_get_script]. Callers must be
354// prepared to handle unknown values.
355func ScriptForUnichar(ChVar uint32) Script {
356
357 cret := xScriptForUnichar(ChVar)
358 return cret
359}
360
361var xScriptGetSampleLanguage func(Script) *Language
362
363// Finds a language tag that is reasonably representative of @script.
364//
365// The language will usually be the most widely spoken or used language
366// written in that script: for instance, the sample language for
367// %PANGO_SCRIPT_CYRILLIC is ru (Russian), the sample language for
368// %PANGO_SCRIPT_ARABIC is ar.
369//
370// For some scripts, no sample language will be returned because
371// there is no language that is sufficiently representative. The
372// best example of this is %PANGO_SCRIPT_HAN, where various different
373// variants of written Chinese, Japanese, and Korean all use
374// significantly different sets of Han characters and forms
375// of shared characters. No sample language can be provided
376// for many historical scripts as well.
377//
378// As of 1.18, this function checks the environment variables
379// `PANGO_LANGUAGE` and `LANGUAGE` (checked in that order) first.
380// If one of them is set, it is parsed as a list of language tags
381// separated by colons or other separators. This function
382// will return the first language in the parsed list that Pango
383// believes may use @script for writing. This last predicate
384// is tested using [method@Pango.Language.includes_script]. This can
385// be used to control Pango's font selection for non-primary
386// languages. For example, a `PANGO_LANGUAGE` enviroment variable
387// set to "en:fa" makes Pango choose fonts suitable for Persian (fa)
388// instead of Arabic (ar) when a segment of Arabic text is found
389// in an otherwise non-Arabic text. The same trick can be used to
390// choose a default language for %PANGO_SCRIPT_HAN when setting
391// context language is not feasible.
392func ScriptGetSampleLanguage(ScriptVar Script) *Language {
393
394 cret := xScriptGetSampleLanguage(ScriptVar)
395 return cret
396}
397
398func init() {
399 core.SetPackageName("PANGO", "pango")
400 core.SetSharedLibraries("PANGO", []string{"libpango-1.0.so.0"})
401 var libs []uintptr
402 for _, libPath := range core.GetPaths("PANGO") {
403 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
404 if err != nil {
405 panic(err)
406 }
407 libs = append(libs, lib)
408 }
409
410 core.PuregoSafeRegister(&xScriptGLibType, libs, "pango_script_get_type")
411
412 core.PuregoSafeRegister(&xScriptForUnichar, libs, "pango_script_for_unichar")
413 core.PuregoSafeRegister(&xScriptGetSampleLanguage, libs, "pango_script_get_sample_language")
414
415 core.PuregoSafeRegister(&xScriptIterGLibType, libs, "pango_script_iter_get_type")
416
417 core.PuregoSafeRegister(&xNewScriptIter, libs, "pango_script_iter_new")
418
419 core.PuregoSafeRegister(&xScriptIterFree, libs, "pango_script_iter_free")
420 core.PuregoSafeRegister(&xScriptIterGetRange, libs, "pango_script_iter_get_range")
421 core.PuregoSafeRegister(&xScriptIterNext, libs, "pango_script_iter_next")
422
423}