@girs/pangocairo-1.0 1.0.0-3.0.0-beta.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -0
- package/package.json +58 -0
- package/pangocairo-1.0.cjs +9 -0
- package/pangocairo-1.0.d.cts +484 -0
- package/pangocairo-1.0.d.ts +489 -0
- package/pangocairo-1.0.js +8 -0
- package/tsconfig.doc.json +19 -0
package/README.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
|
|
2
|
+
# PangoCairo-1.0
|
|
3
|
+
|
|
4
|
+
GJS TypeScript type definitions for PangoCairo-1.0, generated from library version 1.0.0 using [ts-for-gir](https://github.com/gjsify/ts-for-gjs) v3.0.0-beta.12.
|
|
5
|
+
|
|
6
|
+
Rendering with the Cairo backend.
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
To use this type definitions, install them with NPM like this:
|
|
11
|
+
```bash
|
|
12
|
+
npm install @girs/pangocairo-1.0
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
You can import this package into your project like this:
|
|
18
|
+
```ts
|
|
19
|
+
import PangoCairo from '@girs/pangocairo-1.0';
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Or if you prefer CommonJS, you can also use this:
|
|
23
|
+
```ts
|
|
24
|
+
const PangoCairo = require('@girs/pangocairo-1.0');
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
If you use [ambient modules](https://github.com/gjsify/ts-for-gir/tree/main/packages/cli#ambient-modules), you can also import this module like you would do this in JavaScript:
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
import PangoCairo from 'gi://PangoCairo?version=1.0';
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Depending on your project configuration, it is recommended to use a bundler like [esbuild](https://esbuild.github.io/). You can find examples using different bundlers [here](https://github.com/gjsify/ts-for-gir/tree/main/examples).
|
package/package.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@girs/pangocairo-1.0",
|
|
3
|
+
"version": "1.0.0-3.0.0-beta.12",
|
|
4
|
+
"description": "GJS TypeScript type definitions for PangoCairo-1.0, generated from library version 1.0.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"module": "pangocairo-1.0.js",
|
|
7
|
+
"main": "pangocairo-1.0.js",
|
|
8
|
+
"typedoc": {
|
|
9
|
+
"entryPoint": "./pangocairo-1.0.d.ts",
|
|
10
|
+
"readmeFile": "./README.md",
|
|
11
|
+
"displayName": "PangoCairo-1.0",
|
|
12
|
+
"tsconfig": "./tsconfig.doc.json"
|
|
13
|
+
},
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"import": {
|
|
17
|
+
"types": "./pangocairo-1.0.d.ts",
|
|
18
|
+
"default": "./pangocairo-1.0.js"
|
|
19
|
+
},
|
|
20
|
+
"require": {
|
|
21
|
+
"types": "./pangocairo-1.0.d.cts",
|
|
22
|
+
"default": "./pangocairo-1.0.cjs"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"test": "yarn test:esm && yarn test:cjs",
|
|
28
|
+
"test:esm": "tsc --noEmit pangocairo-1.0.d.ts",
|
|
29
|
+
"test:cjs": "tsc --noEmit pangocairo-1.0.d.cts"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@girs/cairo-1.0": "^1.0.0-3.0.0-beta.12",
|
|
33
|
+
"@girs/freetype2-2.0": "^2.0.0-3.0.0-beta.12",
|
|
34
|
+
"@girs/gio-2.0": "^2.75.1-3.0.0-beta.12",
|
|
35
|
+
"@girs/glib-2.0": "^2.75.1-3.0.0-beta.12",
|
|
36
|
+
"@girs/gobject-2.0": "^2.75.1-3.0.0-beta.12",
|
|
37
|
+
"@girs/harfbuzz-0.0": "^6.0.0-3.0.0-beta.12",
|
|
38
|
+
"@girs/pango-1.0": "^1.50.13-3.0.0-beta.12"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"typescript": "^*"
|
|
42
|
+
},
|
|
43
|
+
"keywords": [
|
|
44
|
+
"Gir",
|
|
45
|
+
"TypeScript",
|
|
46
|
+
"PangoCairo-1.0"
|
|
47
|
+
],
|
|
48
|
+
"author": "ts-for-gir",
|
|
49
|
+
"license": "Apache-2.0",
|
|
50
|
+
"repository": {
|
|
51
|
+
"type": "git",
|
|
52
|
+
"url": "git+https://github.com/gjsify/ts-for-gir.git"
|
|
53
|
+
},
|
|
54
|
+
"bugs": {
|
|
55
|
+
"url": "https://github.com/gjsify/ts-for-gir/issues"
|
|
56
|
+
},
|
|
57
|
+
"homepage": "https://github.com/gjsify/ts-for-gir#readme"
|
|
58
|
+
}
|
|
@@ -0,0 +1,484 @@
|
|
|
1
|
+
|
|
2
|
+
/*
|
|
3
|
+
* Type Definitions for Gjs (https://gjs.guide/)
|
|
4
|
+
*
|
|
5
|
+
* These type definitions are automatically generated, do not edit them by hand.
|
|
6
|
+
* If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gjs
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* PangoCairo-1.0
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import type cairo from '@girs/cairo-1.0';
|
|
13
|
+
import type Pango from '@girs/pango-1.0';
|
|
14
|
+
import type HarfBuzz from '@girs/harfbuzz-0.0';
|
|
15
|
+
import type freetype2 from '@girs/freetype2-2.0';
|
|
16
|
+
import type GObject from '@girs/gobject-2.0';
|
|
17
|
+
import type GLib from '@girs/glib-2.0';
|
|
18
|
+
import type Gio from '@girs/gio-2.0';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Retrieves any font rendering options previously set with
|
|
22
|
+
* [func`PangoCairo`.context_set_font_options].
|
|
23
|
+
*
|
|
24
|
+
* This function does not report options that are derived from
|
|
25
|
+
* the target surface by [func`update_context]`.
|
|
26
|
+
* @param context a `PangoContext`, from a pangocairo font map
|
|
27
|
+
* @returns the font options previously set on the context, or %NULL if no options have been set. This value is owned by the context and must not be modified or freed.
|
|
28
|
+
*/
|
|
29
|
+
export function context_get_font_options(context: Pango.Context): cairo.FontOptions | null
|
|
30
|
+
/**
|
|
31
|
+
* Gets the resolution for the context.
|
|
32
|
+
*
|
|
33
|
+
* See [func`PangoCairo`.context_set_resolution]
|
|
34
|
+
* @param context a `PangoContext`, from a pangocairo font map
|
|
35
|
+
* @returns the resolution in "dots per inch". A negative value will be returned if no resolution has previously been set.
|
|
36
|
+
*/
|
|
37
|
+
export function context_get_resolution(context: Pango.Context): number
|
|
38
|
+
/**
|
|
39
|
+
* Sets the font options used when rendering text with this context.
|
|
40
|
+
*
|
|
41
|
+
* These options override any options that [func`update_context]`
|
|
42
|
+
* derives from the target surface.
|
|
43
|
+
* @param context a `PangoContext`, from a pangocairo font map
|
|
44
|
+
* @param options a `cairo_font_options_t`, or %NULL to unset any previously set options. A copy is made.
|
|
45
|
+
*/
|
|
46
|
+
export function context_set_font_options(context: Pango.Context, options: cairo.FontOptions | null): void
|
|
47
|
+
/**
|
|
48
|
+
* Sets the resolution for the context.
|
|
49
|
+
*
|
|
50
|
+
* This is a scale factor between points specified in a `PangoFontDescription`
|
|
51
|
+
* and Cairo units. The default value is 96, meaning that a 10 point font will
|
|
52
|
+
* be 13 units high. (10 * 96. / 72. = 13.3).
|
|
53
|
+
* @param context a `PangoContext`, from a pangocairo font map
|
|
54
|
+
* @param dpi the resolution in "dots per inch". (Physical inches aren't actually involved; the terminology is conventional.) A 0 or negative value means to use the resolution from the font map.
|
|
55
|
+
*/
|
|
56
|
+
export function context_set_resolution(context: Pango.Context, dpi: number): void
|
|
57
|
+
/**
|
|
58
|
+
* Sets callback function for context to use for rendering attributes
|
|
59
|
+
* of type %PANGO_ATTR_SHAPE.
|
|
60
|
+
*
|
|
61
|
+
* See `PangoCairoShapeRendererFunc` for details.
|
|
62
|
+
* @param context a `PangoContext`, from a pangocairo font map
|
|
63
|
+
* @param func Callback function for rendering attributes of type %PANGO_ATTR_SHAPE, or %NULL to disable shape rendering.
|
|
64
|
+
*/
|
|
65
|
+
export function context_set_shape_renderer(context: Pango.Context, func: ShapeRendererFunc | null): void
|
|
66
|
+
/**
|
|
67
|
+
* Creates a context object set up to match the current transformation
|
|
68
|
+
* and target surface of the Cairo context.
|
|
69
|
+
*
|
|
70
|
+
* This context can then be
|
|
71
|
+
* used to create a layout using [ctor`Pango`.Layout.new].
|
|
72
|
+
*
|
|
73
|
+
* This function is a convenience function that creates a context using
|
|
74
|
+
* the default font map, then updates it to `cr`. If you just need to
|
|
75
|
+
* create a layout for use with `cr` and do not need to access `PangoContext`
|
|
76
|
+
* directly, you can use [func`create_layout]` instead.
|
|
77
|
+
* @param cr a Cairo context
|
|
78
|
+
* @returns the newly created `PangoContext`
|
|
79
|
+
*/
|
|
80
|
+
export function create_context(cr: cairo.Context): Pango.Context
|
|
81
|
+
/**
|
|
82
|
+
* Creates a layout object set up to match the current transformation
|
|
83
|
+
* and target surface of the Cairo context.
|
|
84
|
+
*
|
|
85
|
+
* This layout can then be used for text measurement with functions
|
|
86
|
+
* like [method`Pango`.Layout.get_size] or drawing with functions like
|
|
87
|
+
* [func`show_layout]`. If you change the transformation or target
|
|
88
|
+
* surface for `cr,` you need to call [func`update_layout]`.
|
|
89
|
+
*
|
|
90
|
+
* This function is the most convenient way to use Cairo with Pango,
|
|
91
|
+
* however it is slightly inefficient since it creates a separate
|
|
92
|
+
* `PangoContext` object for each layout. This might matter in an
|
|
93
|
+
* application that was laying out large amounts of text.
|
|
94
|
+
* @param cr a Cairo context
|
|
95
|
+
* @returns the newly created `PangoLayout`
|
|
96
|
+
*/
|
|
97
|
+
export function create_layout(cr: cairo.Context): Pango.Layout
|
|
98
|
+
/**
|
|
99
|
+
* Add a squiggly line to the current path in the specified cairo context that
|
|
100
|
+
* approximately covers the given rectangle in the style of an underline used
|
|
101
|
+
* to indicate a spelling error.
|
|
102
|
+
*
|
|
103
|
+
* The width of the underline is rounded to an integer number of up/down
|
|
104
|
+
* segments and the resulting rectangle is centered in the original rectangle.
|
|
105
|
+
* @param cr a Cairo context
|
|
106
|
+
* @param x The X coordinate of one corner of the rectangle
|
|
107
|
+
* @param y The Y coordinate of one corner of the rectangle
|
|
108
|
+
* @param width Non-negative width of the rectangle
|
|
109
|
+
* @param height Non-negative height of the rectangle
|
|
110
|
+
*/
|
|
111
|
+
export function error_underline_path(cr: cairo.Context, x: number, y: number, width: number, height: number): void
|
|
112
|
+
/**
|
|
113
|
+
* Gets a default `PangoCairoFontMap` to use with Cairo.
|
|
114
|
+
*
|
|
115
|
+
* Note that the type of the returned object will depend on the
|
|
116
|
+
* particular font backend Cairo was compiled to use; you generally
|
|
117
|
+
* should only use the `PangoFontMap` and `PangoCairoFontMap`
|
|
118
|
+
* interfaces on the returned object.
|
|
119
|
+
*
|
|
120
|
+
* The default Cairo fontmap can be changed by using
|
|
121
|
+
* [method`PangoCairo`.FontMap.set_default]. This can be used to
|
|
122
|
+
* change the Cairo font backend that the default fontmap uses
|
|
123
|
+
* for example.
|
|
124
|
+
*
|
|
125
|
+
* Note that since Pango 1.32.6, the default fontmap is per-thread.
|
|
126
|
+
* Each thread gets its own default fontmap. In this way, PangoCairo
|
|
127
|
+
* can be used safely from multiple threads.
|
|
128
|
+
* @returns the default PangoCairo fontmap for the current thread. This object is owned by Pango and must not be freed.
|
|
129
|
+
*/
|
|
130
|
+
export function font_map_get_default(): Pango.FontMap
|
|
131
|
+
/**
|
|
132
|
+
* Creates a new `PangoCairoFontMap` object.
|
|
133
|
+
*
|
|
134
|
+
* A fontmap is used to cache information about available fonts,
|
|
135
|
+
* and holds certain global parameters such as the resolution.
|
|
136
|
+
* In most cases, you can use `func`PangoCairo`.font_map_get_default]
|
|
137
|
+
* instead.
|
|
138
|
+
*
|
|
139
|
+
* Note that the type of the returned object will depend
|
|
140
|
+
* on the particular font backend Cairo was compiled to use;
|
|
141
|
+
* You generally should only use the `PangoFontMap` and
|
|
142
|
+
* `PangoCairoFontMap` interfaces on the returned object.
|
|
143
|
+
*
|
|
144
|
+
* You can override the type of backend returned by using an
|
|
145
|
+
* environment variable %PANGOCAIRO_BACKEND. Supported types,
|
|
146
|
+
* based on your build, are fc (fontconfig), win32, and coretext.
|
|
147
|
+
* If requested type is not available, NULL is returned. Ie.
|
|
148
|
+
* this is only useful for testing, when at least two backends
|
|
149
|
+
* are compiled in.
|
|
150
|
+
* @returns the newly allocated `PangoFontMap`, which should be freed with g_object_unref().
|
|
151
|
+
*/
|
|
152
|
+
export function font_map_new(): Pango.FontMap
|
|
153
|
+
/**
|
|
154
|
+
* Creates a new `PangoCairoFontMap` object of the type suitable
|
|
155
|
+
* to be used with cairo font backend of type `fonttype`.
|
|
156
|
+
*
|
|
157
|
+
* In most cases one should simply use [func`PangoCairo`.FontMap.new], or
|
|
158
|
+
* in fact in most of those cases, just use [func`PangoCairo`.FontMap.get_default].
|
|
159
|
+
* @param fonttype desired #cairo_font_type_t
|
|
160
|
+
* @returns the newly allocated `PangoFontMap` of suitable type which should be freed with g_object_unref(), or %NULL if the requested cairo font backend is not supported / compiled in.
|
|
161
|
+
*/
|
|
162
|
+
export function font_map_new_for_font_type(fonttype: cairo.FontType): Pango.FontMap | null
|
|
163
|
+
/**
|
|
164
|
+
* Adds the glyphs in `glyphs` to the current path in the specified
|
|
165
|
+
* cairo context.
|
|
166
|
+
*
|
|
167
|
+
* The origin of the glyphs (the left edge of the baseline)
|
|
168
|
+
* will be at the current point of the cairo context.
|
|
169
|
+
* @param cr a Cairo context
|
|
170
|
+
* @param font a `PangoFont` from a `PangoCairoFontMap`
|
|
171
|
+
* @param glyphs a `PangoGlyphString`
|
|
172
|
+
*/
|
|
173
|
+
export function glyph_string_path(cr: cairo.Context, font: Pango.Font, glyphs: Pango.GlyphString): void
|
|
174
|
+
/**
|
|
175
|
+
* Adds the text in `PangoLayoutLine` to the current path in the
|
|
176
|
+
* specified cairo context.
|
|
177
|
+
*
|
|
178
|
+
* The origin of the glyphs (the left edge of the line) will be
|
|
179
|
+
* at the current point of the cairo context.
|
|
180
|
+
* @param cr a Cairo context
|
|
181
|
+
* @param line a `PangoLayoutLine`
|
|
182
|
+
*/
|
|
183
|
+
export function layout_line_path(cr: cairo.Context, line: Pango.LayoutLine): void
|
|
184
|
+
/**
|
|
185
|
+
* Adds the text in a `PangoLayout` to the current path in the
|
|
186
|
+
* specified cairo context.
|
|
187
|
+
*
|
|
188
|
+
* The top-left corner of the `PangoLayout` will be at the
|
|
189
|
+
* current point of the cairo context.
|
|
190
|
+
* @param cr a Cairo context
|
|
191
|
+
* @param layout a Pango layout
|
|
192
|
+
*/
|
|
193
|
+
export function layout_path(cr: cairo.Context, layout: Pango.Layout): void
|
|
194
|
+
/**
|
|
195
|
+
* Draw a squiggly line in the specified cairo context that approximately
|
|
196
|
+
* covers the given rectangle in the style of an underline used to indicate a
|
|
197
|
+
* spelling error.
|
|
198
|
+
*
|
|
199
|
+
* The width of the underline is rounded to an integer
|
|
200
|
+
* number of up/down segments and the resulting rectangle is centered in the
|
|
201
|
+
* original rectangle.
|
|
202
|
+
* @param cr a Cairo context
|
|
203
|
+
* @param x The X coordinate of one corner of the rectangle
|
|
204
|
+
* @param y The Y coordinate of one corner of the rectangle
|
|
205
|
+
* @param width Non-negative width of the rectangle
|
|
206
|
+
* @param height Non-negative height of the rectangle
|
|
207
|
+
*/
|
|
208
|
+
export function show_error_underline(cr: cairo.Context, x: number, y: number, width: number, height: number): void
|
|
209
|
+
/**
|
|
210
|
+
* Draws the glyphs in `glyph_item` in the specified cairo context,
|
|
211
|
+
*
|
|
212
|
+
* embedding the text associated with the glyphs in the output if the
|
|
213
|
+
* output format supports it (PDF for example), otherwise it acts
|
|
214
|
+
* similar to [func`show_glyph_string]`.
|
|
215
|
+
*
|
|
216
|
+
* The origin of the glyphs (the left edge of the baseline) will
|
|
217
|
+
* be drawn at the current point of the cairo context.
|
|
218
|
+
*
|
|
219
|
+
* Note that `text` is the start of the text for layout, which is then
|
|
220
|
+
* indexed by `glyph_item->item->offset`.
|
|
221
|
+
* @param cr a Cairo context
|
|
222
|
+
* @param text the UTF-8 text that `glyph_item` refers to
|
|
223
|
+
* @param glyph_item a `PangoGlyphItem`
|
|
224
|
+
*/
|
|
225
|
+
export function show_glyph_item(cr: cairo.Context, text: string | null, glyph_item: Pango.GlyphItem): void
|
|
226
|
+
/**
|
|
227
|
+
* Draws the glyphs in `glyphs` in the specified cairo context.
|
|
228
|
+
*
|
|
229
|
+
* The origin of the glyphs (the left edge of the baseline) will
|
|
230
|
+
* be drawn at the current point of the cairo context.
|
|
231
|
+
* @param cr a Cairo context
|
|
232
|
+
* @param font a `PangoFont` from a `PangoCairoFontMap`
|
|
233
|
+
* @param glyphs a `PangoGlyphString`
|
|
234
|
+
*/
|
|
235
|
+
export function show_glyph_string(cr: cairo.Context, font: Pango.Font, glyphs: Pango.GlyphString): void
|
|
236
|
+
/**
|
|
237
|
+
* Draws a `PangoLayout` in the specified cairo context.
|
|
238
|
+
*
|
|
239
|
+
* The top-left corner of the `PangoLayout` will be drawn
|
|
240
|
+
* at the current point of the cairo context.
|
|
241
|
+
* @param cr a Cairo context
|
|
242
|
+
* @param layout a Pango layout
|
|
243
|
+
*/
|
|
244
|
+
export function show_layout(cr: cairo.Context, layout: Pango.Layout): void
|
|
245
|
+
/**
|
|
246
|
+
* Draws a `PangoLayoutLine` in the specified cairo context.
|
|
247
|
+
*
|
|
248
|
+
* The origin of the glyphs (the left edge of the line) will
|
|
249
|
+
* be drawn at the current point of the cairo context.
|
|
250
|
+
* @param cr a Cairo context
|
|
251
|
+
* @param line a `PangoLayoutLine`
|
|
252
|
+
*/
|
|
253
|
+
export function show_layout_line(cr: cairo.Context, line: Pango.LayoutLine): void
|
|
254
|
+
/**
|
|
255
|
+
* Updates a `PangoContext` previously created for use with Cairo to
|
|
256
|
+
* match the current transformation and target surface of a Cairo
|
|
257
|
+
* context.
|
|
258
|
+
*
|
|
259
|
+
* If any layouts have been created for the context, it's necessary
|
|
260
|
+
* to call [method`Pango`.Layout.context_changed] on those layouts.
|
|
261
|
+
* @param cr a Cairo context
|
|
262
|
+
* @param context a `PangoContext`, from a pangocairo font map
|
|
263
|
+
*/
|
|
264
|
+
export function update_context(cr: cairo.Context, context: Pango.Context): void
|
|
265
|
+
/**
|
|
266
|
+
* Updates the private `PangoContext` of a `PangoLayout` created with
|
|
267
|
+
* [func`create_layout]` to match the current transformation and target
|
|
268
|
+
* surface of a Cairo context.
|
|
269
|
+
* @param cr a Cairo context
|
|
270
|
+
* @param layout a `PangoLayout`, from [func`create_layout]`
|
|
271
|
+
*/
|
|
272
|
+
export function update_layout(cr: cairo.Context, layout: Pango.Layout): void
|
|
273
|
+
/**
|
|
274
|
+
* Function type for rendering attributes of type %PANGO_ATTR_SHAPE
|
|
275
|
+
* with Pango's Cairo renderer.
|
|
276
|
+
* @callback
|
|
277
|
+
* @param cr a Cairo context with current point set to where the shape should be rendered
|
|
278
|
+
* @param attr the %PANGO_ATTR_SHAPE to render
|
|
279
|
+
* @param do_path whether only the shape path should be appended to current path of `cr` and no filling/stroking done. This will be set to %TRUE when called from pango_cairo_layout_path() and pango_cairo_layout_line_path() rendering functions.
|
|
280
|
+
*/
|
|
281
|
+
export interface ShapeRendererFunc {
|
|
282
|
+
(cr: cairo.Context, attr: Pango.AttrShape, do_path: boolean): void
|
|
283
|
+
}
|
|
284
|
+
export module Font {
|
|
285
|
+
|
|
286
|
+
// Constructor properties interface
|
|
287
|
+
|
|
288
|
+
export interface ConstructorProperties extends Pango.Font.ConstructorProperties, GObject.Object.ConstructorProperties {
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
export interface Font extends Pango.Font {
|
|
294
|
+
|
|
295
|
+
// Owm methods of PangoCairo-1.0.PangoCairo.Font
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Gets the `cairo_scaled_font_t` used by `font`.
|
|
299
|
+
* The scaled font can be referenced and kept using
|
|
300
|
+
* cairo_scaled_font_reference().
|
|
301
|
+
* @returns the `cairo_scaled_font_t` used by @font
|
|
302
|
+
*/
|
|
303
|
+
get_scaled_font(): cairo.ScaledFont | null
|
|
304
|
+
|
|
305
|
+
// Class property signals of PangoCairo-1.0.PangoCairo.Font
|
|
306
|
+
|
|
307
|
+
connect(sigName: string, callback: (...args: any[]) => void): number
|
|
308
|
+
connect_after(sigName: string, callback: (...args: any[]) => void): number
|
|
309
|
+
emit(sigName: string, ...args: any[]): void
|
|
310
|
+
disconnect(id: number): void
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* `PangoCairoFont` is an interface exported by fonts for
|
|
315
|
+
* use with Cairo.
|
|
316
|
+
*
|
|
317
|
+
* The actual type of the font will depend on the particular
|
|
318
|
+
* font technology Cairo was compiled to use.
|
|
319
|
+
* @interface
|
|
320
|
+
*/
|
|
321
|
+
export class Font extends GObject.Object {
|
|
322
|
+
|
|
323
|
+
// Own properties of PangoCairo-1.0.PangoCairo.Font
|
|
324
|
+
|
|
325
|
+
static name: string
|
|
326
|
+
static $gtype: GObject.GType<Font>
|
|
327
|
+
|
|
328
|
+
// Constructors of PangoCairo-1.0.PangoCairo.Font
|
|
329
|
+
|
|
330
|
+
constructor(config?: Font.ConstructorProperties)
|
|
331
|
+
_init(config?: Font.ConstructorProperties): void
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
export module FontMap {
|
|
335
|
+
|
|
336
|
+
// Constructor properties interface
|
|
337
|
+
|
|
338
|
+
export interface ConstructorProperties extends Pango.FontMap.ConstructorProperties, GObject.Object.ConstructorProperties {
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
export interface FontMap extends Pango.FontMap {
|
|
344
|
+
|
|
345
|
+
// Owm methods of PangoCairo-1.0.PangoCairo.FontMap
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* Gets the type of Cairo font backend that `fontmap` uses.
|
|
349
|
+
* @returns the `cairo_font_type_t` cairo font backend type
|
|
350
|
+
*/
|
|
351
|
+
get_font_type(): cairo.FontType
|
|
352
|
+
/**
|
|
353
|
+
* Gets the resolution for the fontmap.
|
|
354
|
+
*
|
|
355
|
+
* See [method`PangoCairo`.FontMap.set_resolution].
|
|
356
|
+
* @returns the resolution in "dots per inch"
|
|
357
|
+
*/
|
|
358
|
+
get_resolution(): number
|
|
359
|
+
/**
|
|
360
|
+
* Sets a default `PangoCairoFontMap` to use with Cairo.
|
|
361
|
+
*
|
|
362
|
+
* This can be used to change the Cairo font backend that the
|
|
363
|
+
* default fontmap uses for example. The old default font map
|
|
364
|
+
* is unreffed and the new font map referenced.
|
|
365
|
+
*
|
|
366
|
+
* Note that since Pango 1.32.6, the default fontmap is per-thread.
|
|
367
|
+
* This function only changes the default fontmap for
|
|
368
|
+
* the current thread. Default fontmaps of existing threads
|
|
369
|
+
* are not changed. Default fontmaps of any new threads will
|
|
370
|
+
* still be created using [func`PangoCairo`.FontMap.new].
|
|
371
|
+
*
|
|
372
|
+
* A value of %NULL for `fontmap` will cause the current default
|
|
373
|
+
* font map to be released and a new default font map to be created
|
|
374
|
+
* on demand, using [func`PangoCairo`.FontMap.new].
|
|
375
|
+
*/
|
|
376
|
+
set_default(): void
|
|
377
|
+
/**
|
|
378
|
+
* Sets the resolution for the fontmap.
|
|
379
|
+
*
|
|
380
|
+
* This is a scale factor between
|
|
381
|
+
* points specified in a `PangoFontDescription` and Cairo units. The
|
|
382
|
+
* default value is 96, meaning that a 10 point font will be 13
|
|
383
|
+
* units high. (10 * 96. / 72. = 13.3).
|
|
384
|
+
* @param dpi the resolution in "dots per inch". (Physical inches aren't actually involved; the terminology is conventional.)
|
|
385
|
+
*/
|
|
386
|
+
set_resolution(dpi: number): void
|
|
387
|
+
|
|
388
|
+
// Class property signals of PangoCairo-1.0.PangoCairo.FontMap
|
|
389
|
+
|
|
390
|
+
connect(sigName: "notify::item-type", callback: (($obj: FontMap, pspec: GObject.ParamSpec) => void)): number
|
|
391
|
+
connect_after(sigName: "notify::item-type", callback: (($obj: FontMap, pspec: GObject.ParamSpec) => void)): number
|
|
392
|
+
emit(sigName: "notify::item-type", ...args: any[]): void
|
|
393
|
+
connect(sigName: "notify::n-items", callback: (($obj: FontMap, pspec: GObject.ParamSpec) => void)): number
|
|
394
|
+
connect_after(sigName: "notify::n-items", callback: (($obj: FontMap, pspec: GObject.ParamSpec) => void)): number
|
|
395
|
+
emit(sigName: "notify::n-items", ...args: any[]): void
|
|
396
|
+
connect(sigName: string, callback: (...args: any[]) => void): number
|
|
397
|
+
connect_after(sigName: string, callback: (...args: any[]) => void): number
|
|
398
|
+
emit(sigName: string, ...args: any[]): void
|
|
399
|
+
disconnect(id: number): void
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* `PangoCairoFontMap` is an interface exported by font maps for
|
|
404
|
+
* use with Cairo.
|
|
405
|
+
*
|
|
406
|
+
* The actual type of the font map will depend on the particular
|
|
407
|
+
* font technology Cairo was compiled to use.
|
|
408
|
+
* @interface
|
|
409
|
+
*/
|
|
410
|
+
export class FontMap extends GObject.Object {
|
|
411
|
+
|
|
412
|
+
// Own properties of PangoCairo-1.0.PangoCairo.FontMap
|
|
413
|
+
|
|
414
|
+
static name: string
|
|
415
|
+
static $gtype: GObject.GType<FontMap>
|
|
416
|
+
|
|
417
|
+
// Constructors of PangoCairo-1.0.PangoCairo.FontMap
|
|
418
|
+
|
|
419
|
+
constructor(config?: FontMap.ConstructorProperties)
|
|
420
|
+
_init(config?: FontMap.ConstructorProperties): void
|
|
421
|
+
/**
|
|
422
|
+
* Creates a new `PangoCairoFontMap` object.
|
|
423
|
+
*
|
|
424
|
+
* A fontmap is used to cache information about available fonts,
|
|
425
|
+
* and holds certain global parameters such as the resolution.
|
|
426
|
+
* In most cases, you can use `func`PangoCairo`.font_map_get_default]
|
|
427
|
+
* instead.
|
|
428
|
+
*
|
|
429
|
+
* Note that the type of the returned object will depend
|
|
430
|
+
* on the particular font backend Cairo was compiled to use;
|
|
431
|
+
* You generally should only use the `PangoFontMap` and
|
|
432
|
+
* `PangoCairoFontMap` interfaces on the returned object.
|
|
433
|
+
*
|
|
434
|
+
* You can override the type of backend returned by using an
|
|
435
|
+
* environment variable %PANGOCAIRO_BACKEND. Supported types,
|
|
436
|
+
* based on your build, are fc (fontconfig), win32, and coretext.
|
|
437
|
+
* If requested type is not available, NULL is returned. Ie.
|
|
438
|
+
* this is only useful for testing, when at least two backends
|
|
439
|
+
* are compiled in.
|
|
440
|
+
* @returns the newly allocated `PangoFontMap`, which should be freed with g_object_unref().
|
|
441
|
+
*/
|
|
442
|
+
static new(): Pango.FontMap
|
|
443
|
+
/**
|
|
444
|
+
* Creates a new `PangoCairoFontMap` object of the type suitable
|
|
445
|
+
* to be used with cairo font backend of type `fonttype`.
|
|
446
|
+
*
|
|
447
|
+
* In most cases one should simply use [func`PangoCairo`.FontMap.new], or
|
|
448
|
+
* in fact in most of those cases, just use [func`PangoCairo`.FontMap.get_default].
|
|
449
|
+
* @param fonttype desired #cairo_font_type_t
|
|
450
|
+
* @returns the newly allocated `PangoFontMap` of suitable type which should be freed with g_object_unref(), or %NULL if the requested cairo font backend is not supported / compiled in.
|
|
451
|
+
*/
|
|
452
|
+
static new_for_font_type(fonttype: cairo.FontType): Pango.FontMap | null
|
|
453
|
+
/**
|
|
454
|
+
* Gets a default `PangoCairoFontMap` to use with Cairo.
|
|
455
|
+
*
|
|
456
|
+
* Note that the type of the returned object will depend on the
|
|
457
|
+
* particular font backend Cairo was compiled to use; you generally
|
|
458
|
+
* should only use the `PangoFontMap` and `PangoCairoFontMap`
|
|
459
|
+
* interfaces on the returned object.
|
|
460
|
+
*
|
|
461
|
+
* The default Cairo fontmap can be changed by using
|
|
462
|
+
* [method`PangoCairo`.FontMap.set_default]. This can be used to
|
|
463
|
+
* change the Cairo font backend that the default fontmap uses
|
|
464
|
+
* for example.
|
|
465
|
+
*
|
|
466
|
+
* Note that since Pango 1.32.6, the default fontmap is per-thread.
|
|
467
|
+
* Each thread gets its own default fontmap. In this way, PangoCairo
|
|
468
|
+
* can be used safely from multiple threads.
|
|
469
|
+
* @returns the default PangoCairo fontmap for the current thread. This object is owned by Pango and must not be freed.
|
|
470
|
+
*/
|
|
471
|
+
static get_default(): Pango.FontMap
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
/**
|
|
475
|
+
* Name of the imported GIR library
|
|
476
|
+
* @see https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L188
|
|
477
|
+
*/
|
|
478
|
+
export const __name__: string
|
|
479
|
+
/**
|
|
480
|
+
* Version of the imported GIR library
|
|
481
|
+
* @see https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L189
|
|
482
|
+
*/
|
|
483
|
+
export const __version__: string
|
|
484
|
+
// END
|
|
@@ -0,0 +1,489 @@
|
|
|
1
|
+
|
|
2
|
+
/*
|
|
3
|
+
* Type Definitions for Gjs (https://gjs.guide/)
|
|
4
|
+
*
|
|
5
|
+
* These type definitions are automatically generated, do not edit them by hand.
|
|
6
|
+
* If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gjs
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* PangoCairo-1.0
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import type cairo from '@girs/cairo-1.0';
|
|
13
|
+
import type Pango from '@girs/pango-1.0';
|
|
14
|
+
import type HarfBuzz from '@girs/harfbuzz-0.0';
|
|
15
|
+
import type freetype2 from '@girs/freetype2-2.0';
|
|
16
|
+
import type GObject from '@girs/gobject-2.0';
|
|
17
|
+
import type GLib from '@girs/glib-2.0';
|
|
18
|
+
import type Gio from '@girs/gio-2.0';
|
|
19
|
+
|
|
20
|
+
export namespace PangoCairo {
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Retrieves any font rendering options previously set with
|
|
24
|
+
* [func`PangoCairo`.context_set_font_options].
|
|
25
|
+
*
|
|
26
|
+
* This function does not report options that are derived from
|
|
27
|
+
* the target surface by [func`update_context]`.
|
|
28
|
+
* @param context a `PangoContext`, from a pangocairo font map
|
|
29
|
+
* @returns the font options previously set on the context, or %NULL if no options have been set. This value is owned by the context and must not be modified or freed.
|
|
30
|
+
*/
|
|
31
|
+
function context_get_font_options(context: Pango.Context): cairo.FontOptions | null
|
|
32
|
+
/**
|
|
33
|
+
* Gets the resolution for the context.
|
|
34
|
+
*
|
|
35
|
+
* See [func`PangoCairo`.context_set_resolution]
|
|
36
|
+
* @param context a `PangoContext`, from a pangocairo font map
|
|
37
|
+
* @returns the resolution in "dots per inch". A negative value will be returned if no resolution has previously been set.
|
|
38
|
+
*/
|
|
39
|
+
function context_get_resolution(context: Pango.Context): number
|
|
40
|
+
/**
|
|
41
|
+
* Sets the font options used when rendering text with this context.
|
|
42
|
+
*
|
|
43
|
+
* These options override any options that [func`update_context]`
|
|
44
|
+
* derives from the target surface.
|
|
45
|
+
* @param context a `PangoContext`, from a pangocairo font map
|
|
46
|
+
* @param options a `cairo_font_options_t`, or %NULL to unset any previously set options. A copy is made.
|
|
47
|
+
*/
|
|
48
|
+
function context_set_font_options(context: Pango.Context, options: cairo.FontOptions | null): void
|
|
49
|
+
/**
|
|
50
|
+
* Sets the resolution for the context.
|
|
51
|
+
*
|
|
52
|
+
* This is a scale factor between points specified in a `PangoFontDescription`
|
|
53
|
+
* and Cairo units. The default value is 96, meaning that a 10 point font will
|
|
54
|
+
* be 13 units high. (10 * 96. / 72. = 13.3).
|
|
55
|
+
* @param context a `PangoContext`, from a pangocairo font map
|
|
56
|
+
* @param dpi the resolution in "dots per inch". (Physical inches aren't actually involved; the terminology is conventional.) A 0 or negative value means to use the resolution from the font map.
|
|
57
|
+
*/
|
|
58
|
+
function context_set_resolution(context: Pango.Context, dpi: number): void
|
|
59
|
+
/**
|
|
60
|
+
* Sets callback function for context to use for rendering attributes
|
|
61
|
+
* of type %PANGO_ATTR_SHAPE.
|
|
62
|
+
*
|
|
63
|
+
* See `PangoCairoShapeRendererFunc` for details.
|
|
64
|
+
* @param context a `PangoContext`, from a pangocairo font map
|
|
65
|
+
* @param func Callback function for rendering attributes of type %PANGO_ATTR_SHAPE, or %NULL to disable shape rendering.
|
|
66
|
+
*/
|
|
67
|
+
function context_set_shape_renderer(context: Pango.Context, func: ShapeRendererFunc | null): void
|
|
68
|
+
/**
|
|
69
|
+
* Creates a context object set up to match the current transformation
|
|
70
|
+
* and target surface of the Cairo context.
|
|
71
|
+
*
|
|
72
|
+
* This context can then be
|
|
73
|
+
* used to create a layout using [ctor`Pango`.Layout.new].
|
|
74
|
+
*
|
|
75
|
+
* This function is a convenience function that creates a context using
|
|
76
|
+
* the default font map, then updates it to `cr`. If you just need to
|
|
77
|
+
* create a layout for use with `cr` and do not need to access `PangoContext`
|
|
78
|
+
* directly, you can use [func`create_layout]` instead.
|
|
79
|
+
* @param cr a Cairo context
|
|
80
|
+
* @returns the newly created `PangoContext`
|
|
81
|
+
*/
|
|
82
|
+
function create_context(cr: cairo.Context): Pango.Context
|
|
83
|
+
/**
|
|
84
|
+
* Creates a layout object set up to match the current transformation
|
|
85
|
+
* and target surface of the Cairo context.
|
|
86
|
+
*
|
|
87
|
+
* This layout can then be used for text measurement with functions
|
|
88
|
+
* like [method`Pango`.Layout.get_size] or drawing with functions like
|
|
89
|
+
* [func`show_layout]`. If you change the transformation or target
|
|
90
|
+
* surface for `cr,` you need to call [func`update_layout]`.
|
|
91
|
+
*
|
|
92
|
+
* This function is the most convenient way to use Cairo with Pango,
|
|
93
|
+
* however it is slightly inefficient since it creates a separate
|
|
94
|
+
* `PangoContext` object for each layout. This might matter in an
|
|
95
|
+
* application that was laying out large amounts of text.
|
|
96
|
+
* @param cr a Cairo context
|
|
97
|
+
* @returns the newly created `PangoLayout`
|
|
98
|
+
*/
|
|
99
|
+
function create_layout(cr: cairo.Context): Pango.Layout
|
|
100
|
+
/**
|
|
101
|
+
* Add a squiggly line to the current path in the specified cairo context that
|
|
102
|
+
* approximately covers the given rectangle in the style of an underline used
|
|
103
|
+
* to indicate a spelling error.
|
|
104
|
+
*
|
|
105
|
+
* The width of the underline is rounded to an integer number of up/down
|
|
106
|
+
* segments and the resulting rectangle is centered in the original rectangle.
|
|
107
|
+
* @param cr a Cairo context
|
|
108
|
+
* @param x The X coordinate of one corner of the rectangle
|
|
109
|
+
* @param y The Y coordinate of one corner of the rectangle
|
|
110
|
+
* @param width Non-negative width of the rectangle
|
|
111
|
+
* @param height Non-negative height of the rectangle
|
|
112
|
+
*/
|
|
113
|
+
function error_underline_path(cr: cairo.Context, x: number, y: number, width: number, height: number): void
|
|
114
|
+
/**
|
|
115
|
+
* Gets a default `PangoCairoFontMap` to use with Cairo.
|
|
116
|
+
*
|
|
117
|
+
* Note that the type of the returned object will depend on the
|
|
118
|
+
* particular font backend Cairo was compiled to use; you generally
|
|
119
|
+
* should only use the `PangoFontMap` and `PangoCairoFontMap`
|
|
120
|
+
* interfaces on the returned object.
|
|
121
|
+
*
|
|
122
|
+
* The default Cairo fontmap can be changed by using
|
|
123
|
+
* [method`PangoCairo`.FontMap.set_default]. This can be used to
|
|
124
|
+
* change the Cairo font backend that the default fontmap uses
|
|
125
|
+
* for example.
|
|
126
|
+
*
|
|
127
|
+
* Note that since Pango 1.32.6, the default fontmap is per-thread.
|
|
128
|
+
* Each thread gets its own default fontmap. In this way, PangoCairo
|
|
129
|
+
* can be used safely from multiple threads.
|
|
130
|
+
* @returns the default PangoCairo fontmap for the current thread. This object is owned by Pango and must not be freed.
|
|
131
|
+
*/
|
|
132
|
+
function font_map_get_default(): Pango.FontMap
|
|
133
|
+
/**
|
|
134
|
+
* Creates a new `PangoCairoFontMap` object.
|
|
135
|
+
*
|
|
136
|
+
* A fontmap is used to cache information about available fonts,
|
|
137
|
+
* and holds certain global parameters such as the resolution.
|
|
138
|
+
* In most cases, you can use `func`PangoCairo`.font_map_get_default]
|
|
139
|
+
* instead.
|
|
140
|
+
*
|
|
141
|
+
* Note that the type of the returned object will depend
|
|
142
|
+
* on the particular font backend Cairo was compiled to use;
|
|
143
|
+
* You generally should only use the `PangoFontMap` and
|
|
144
|
+
* `PangoCairoFontMap` interfaces on the returned object.
|
|
145
|
+
*
|
|
146
|
+
* You can override the type of backend returned by using an
|
|
147
|
+
* environment variable %PANGOCAIRO_BACKEND. Supported types,
|
|
148
|
+
* based on your build, are fc (fontconfig), win32, and coretext.
|
|
149
|
+
* If requested type is not available, NULL is returned. Ie.
|
|
150
|
+
* this is only useful for testing, when at least two backends
|
|
151
|
+
* are compiled in.
|
|
152
|
+
* @returns the newly allocated `PangoFontMap`, which should be freed with g_object_unref().
|
|
153
|
+
*/
|
|
154
|
+
function font_map_new(): Pango.FontMap
|
|
155
|
+
/**
|
|
156
|
+
* Creates a new `PangoCairoFontMap` object of the type suitable
|
|
157
|
+
* to be used with cairo font backend of type `fonttype`.
|
|
158
|
+
*
|
|
159
|
+
* In most cases one should simply use [func`PangoCairo`.FontMap.new], or
|
|
160
|
+
* in fact in most of those cases, just use [func`PangoCairo`.FontMap.get_default].
|
|
161
|
+
* @param fonttype desired #cairo_font_type_t
|
|
162
|
+
* @returns the newly allocated `PangoFontMap` of suitable type which should be freed with g_object_unref(), or %NULL if the requested cairo font backend is not supported / compiled in.
|
|
163
|
+
*/
|
|
164
|
+
function font_map_new_for_font_type(fonttype: cairo.FontType): Pango.FontMap | null
|
|
165
|
+
/**
|
|
166
|
+
* Adds the glyphs in `glyphs` to the current path in the specified
|
|
167
|
+
* cairo context.
|
|
168
|
+
*
|
|
169
|
+
* The origin of the glyphs (the left edge of the baseline)
|
|
170
|
+
* will be at the current point of the cairo context.
|
|
171
|
+
* @param cr a Cairo context
|
|
172
|
+
* @param font a `PangoFont` from a `PangoCairoFontMap`
|
|
173
|
+
* @param glyphs a `PangoGlyphString`
|
|
174
|
+
*/
|
|
175
|
+
function glyph_string_path(cr: cairo.Context, font: Pango.Font, glyphs: Pango.GlyphString): void
|
|
176
|
+
/**
|
|
177
|
+
* Adds the text in `PangoLayoutLine` to the current path in the
|
|
178
|
+
* specified cairo context.
|
|
179
|
+
*
|
|
180
|
+
* The origin of the glyphs (the left edge of the line) will be
|
|
181
|
+
* at the current point of the cairo context.
|
|
182
|
+
* @param cr a Cairo context
|
|
183
|
+
* @param line a `PangoLayoutLine`
|
|
184
|
+
*/
|
|
185
|
+
function layout_line_path(cr: cairo.Context, line: Pango.LayoutLine): void
|
|
186
|
+
/**
|
|
187
|
+
* Adds the text in a `PangoLayout` to the current path in the
|
|
188
|
+
* specified cairo context.
|
|
189
|
+
*
|
|
190
|
+
* The top-left corner of the `PangoLayout` will be at the
|
|
191
|
+
* current point of the cairo context.
|
|
192
|
+
* @param cr a Cairo context
|
|
193
|
+
* @param layout a Pango layout
|
|
194
|
+
*/
|
|
195
|
+
function layout_path(cr: cairo.Context, layout: Pango.Layout): void
|
|
196
|
+
/**
|
|
197
|
+
* Draw a squiggly line in the specified cairo context that approximately
|
|
198
|
+
* covers the given rectangle in the style of an underline used to indicate a
|
|
199
|
+
* spelling error.
|
|
200
|
+
*
|
|
201
|
+
* The width of the underline is rounded to an integer
|
|
202
|
+
* number of up/down segments and the resulting rectangle is centered in the
|
|
203
|
+
* original rectangle.
|
|
204
|
+
* @param cr a Cairo context
|
|
205
|
+
* @param x The X coordinate of one corner of the rectangle
|
|
206
|
+
* @param y The Y coordinate of one corner of the rectangle
|
|
207
|
+
* @param width Non-negative width of the rectangle
|
|
208
|
+
* @param height Non-negative height of the rectangle
|
|
209
|
+
*/
|
|
210
|
+
function show_error_underline(cr: cairo.Context, x: number, y: number, width: number, height: number): void
|
|
211
|
+
/**
|
|
212
|
+
* Draws the glyphs in `glyph_item` in the specified cairo context,
|
|
213
|
+
*
|
|
214
|
+
* embedding the text associated with the glyphs in the output if the
|
|
215
|
+
* output format supports it (PDF for example), otherwise it acts
|
|
216
|
+
* similar to [func`show_glyph_string]`.
|
|
217
|
+
*
|
|
218
|
+
* The origin of the glyphs (the left edge of the baseline) will
|
|
219
|
+
* be drawn at the current point of the cairo context.
|
|
220
|
+
*
|
|
221
|
+
* Note that `text` is the start of the text for layout, which is then
|
|
222
|
+
* indexed by `glyph_item->item->offset`.
|
|
223
|
+
* @param cr a Cairo context
|
|
224
|
+
* @param text the UTF-8 text that `glyph_item` refers to
|
|
225
|
+
* @param glyph_item a `PangoGlyphItem`
|
|
226
|
+
*/
|
|
227
|
+
function show_glyph_item(cr: cairo.Context, text: string | null, glyph_item: Pango.GlyphItem): void
|
|
228
|
+
/**
|
|
229
|
+
* Draws the glyphs in `glyphs` in the specified cairo context.
|
|
230
|
+
*
|
|
231
|
+
* The origin of the glyphs (the left edge of the baseline) will
|
|
232
|
+
* be drawn at the current point of the cairo context.
|
|
233
|
+
* @param cr a Cairo context
|
|
234
|
+
* @param font a `PangoFont` from a `PangoCairoFontMap`
|
|
235
|
+
* @param glyphs a `PangoGlyphString`
|
|
236
|
+
*/
|
|
237
|
+
function show_glyph_string(cr: cairo.Context, font: Pango.Font, glyphs: Pango.GlyphString): void
|
|
238
|
+
/**
|
|
239
|
+
* Draws a `PangoLayout` in the specified cairo context.
|
|
240
|
+
*
|
|
241
|
+
* The top-left corner of the `PangoLayout` will be drawn
|
|
242
|
+
* at the current point of the cairo context.
|
|
243
|
+
* @param cr a Cairo context
|
|
244
|
+
* @param layout a Pango layout
|
|
245
|
+
*/
|
|
246
|
+
function show_layout(cr: cairo.Context, layout: Pango.Layout): void
|
|
247
|
+
/**
|
|
248
|
+
* Draws a `PangoLayoutLine` in the specified cairo context.
|
|
249
|
+
*
|
|
250
|
+
* The origin of the glyphs (the left edge of the line) will
|
|
251
|
+
* be drawn at the current point of the cairo context.
|
|
252
|
+
* @param cr a Cairo context
|
|
253
|
+
* @param line a `PangoLayoutLine`
|
|
254
|
+
*/
|
|
255
|
+
function show_layout_line(cr: cairo.Context, line: Pango.LayoutLine): void
|
|
256
|
+
/**
|
|
257
|
+
* Updates a `PangoContext` previously created for use with Cairo to
|
|
258
|
+
* match the current transformation and target surface of a Cairo
|
|
259
|
+
* context.
|
|
260
|
+
*
|
|
261
|
+
* If any layouts have been created for the context, it's necessary
|
|
262
|
+
* to call [method`Pango`.Layout.context_changed] on those layouts.
|
|
263
|
+
* @param cr a Cairo context
|
|
264
|
+
* @param context a `PangoContext`, from a pangocairo font map
|
|
265
|
+
*/
|
|
266
|
+
function update_context(cr: cairo.Context, context: Pango.Context): void
|
|
267
|
+
/**
|
|
268
|
+
* Updates the private `PangoContext` of a `PangoLayout` created with
|
|
269
|
+
* [func`create_layout]` to match the current transformation and target
|
|
270
|
+
* surface of a Cairo context.
|
|
271
|
+
* @param cr a Cairo context
|
|
272
|
+
* @param layout a `PangoLayout`, from [func`create_layout]`
|
|
273
|
+
*/
|
|
274
|
+
function update_layout(cr: cairo.Context, layout: Pango.Layout): void
|
|
275
|
+
/**
|
|
276
|
+
* Function type for rendering attributes of type %PANGO_ATTR_SHAPE
|
|
277
|
+
* with Pango's Cairo renderer.
|
|
278
|
+
* @callback
|
|
279
|
+
* @param cr a Cairo context with current point set to where the shape should be rendered
|
|
280
|
+
* @param attr the %PANGO_ATTR_SHAPE to render
|
|
281
|
+
* @param do_path whether only the shape path should be appended to current path of `cr` and no filling/stroking done. This will be set to %TRUE when called from pango_cairo_layout_path() and pango_cairo_layout_line_path() rendering functions.
|
|
282
|
+
*/
|
|
283
|
+
interface ShapeRendererFunc {
|
|
284
|
+
(cr: cairo.Context, attr: Pango.AttrShape, do_path: boolean): void
|
|
285
|
+
}
|
|
286
|
+
module Font {
|
|
287
|
+
|
|
288
|
+
// Constructor properties interface
|
|
289
|
+
|
|
290
|
+
interface ConstructorProperties extends Pango.Font.ConstructorProperties, GObject.Object.ConstructorProperties {
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
interface Font extends Pango.Font {
|
|
296
|
+
|
|
297
|
+
// Owm methods of PangoCairo-1.0.PangoCairo.Font
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Gets the `cairo_scaled_font_t` used by `font`.
|
|
301
|
+
* The scaled font can be referenced and kept using
|
|
302
|
+
* cairo_scaled_font_reference().
|
|
303
|
+
* @returns the `cairo_scaled_font_t` used by @font
|
|
304
|
+
*/
|
|
305
|
+
get_scaled_font(): cairo.ScaledFont | null
|
|
306
|
+
|
|
307
|
+
// Class property signals of PangoCairo-1.0.PangoCairo.Font
|
|
308
|
+
|
|
309
|
+
connect(sigName: string, callback: (...args: any[]) => void): number
|
|
310
|
+
connect_after(sigName: string, callback: (...args: any[]) => void): number
|
|
311
|
+
emit(sigName: string, ...args: any[]): void
|
|
312
|
+
disconnect(id: number): void
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* `PangoCairoFont` is an interface exported by fonts for
|
|
317
|
+
* use with Cairo.
|
|
318
|
+
*
|
|
319
|
+
* The actual type of the font will depend on the particular
|
|
320
|
+
* font technology Cairo was compiled to use.
|
|
321
|
+
* @interface
|
|
322
|
+
*/
|
|
323
|
+
class Font extends GObject.Object {
|
|
324
|
+
|
|
325
|
+
// Own properties of PangoCairo-1.0.PangoCairo.Font
|
|
326
|
+
|
|
327
|
+
static name: string
|
|
328
|
+
static $gtype: GObject.GType<Font>
|
|
329
|
+
|
|
330
|
+
// Constructors of PangoCairo-1.0.PangoCairo.Font
|
|
331
|
+
|
|
332
|
+
constructor(config?: Font.ConstructorProperties)
|
|
333
|
+
_init(config?: Font.ConstructorProperties): void
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
module FontMap {
|
|
337
|
+
|
|
338
|
+
// Constructor properties interface
|
|
339
|
+
|
|
340
|
+
interface ConstructorProperties extends Pango.FontMap.ConstructorProperties, GObject.Object.ConstructorProperties {
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
interface FontMap extends Pango.FontMap {
|
|
346
|
+
|
|
347
|
+
// Owm methods of PangoCairo-1.0.PangoCairo.FontMap
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Gets the type of Cairo font backend that `fontmap` uses.
|
|
351
|
+
* @returns the `cairo_font_type_t` cairo font backend type
|
|
352
|
+
*/
|
|
353
|
+
get_font_type(): cairo.FontType
|
|
354
|
+
/**
|
|
355
|
+
* Gets the resolution for the fontmap.
|
|
356
|
+
*
|
|
357
|
+
* See [method`PangoCairo`.FontMap.set_resolution].
|
|
358
|
+
* @returns the resolution in "dots per inch"
|
|
359
|
+
*/
|
|
360
|
+
get_resolution(): number
|
|
361
|
+
/**
|
|
362
|
+
* Sets a default `PangoCairoFontMap` to use with Cairo.
|
|
363
|
+
*
|
|
364
|
+
* This can be used to change the Cairo font backend that the
|
|
365
|
+
* default fontmap uses for example. The old default font map
|
|
366
|
+
* is unreffed and the new font map referenced.
|
|
367
|
+
*
|
|
368
|
+
* Note that since Pango 1.32.6, the default fontmap is per-thread.
|
|
369
|
+
* This function only changes the default fontmap for
|
|
370
|
+
* the current thread. Default fontmaps of existing threads
|
|
371
|
+
* are not changed. Default fontmaps of any new threads will
|
|
372
|
+
* still be created using [func`PangoCairo`.FontMap.new].
|
|
373
|
+
*
|
|
374
|
+
* A value of %NULL for `fontmap` will cause the current default
|
|
375
|
+
* font map to be released and a new default font map to be created
|
|
376
|
+
* on demand, using [func`PangoCairo`.FontMap.new].
|
|
377
|
+
*/
|
|
378
|
+
set_default(): void
|
|
379
|
+
/**
|
|
380
|
+
* Sets the resolution for the fontmap.
|
|
381
|
+
*
|
|
382
|
+
* This is a scale factor between
|
|
383
|
+
* points specified in a `PangoFontDescription` and Cairo units. The
|
|
384
|
+
* default value is 96, meaning that a 10 point font will be 13
|
|
385
|
+
* units high. (10 * 96. / 72. = 13.3).
|
|
386
|
+
* @param dpi the resolution in "dots per inch". (Physical inches aren't actually involved; the terminology is conventional.)
|
|
387
|
+
*/
|
|
388
|
+
set_resolution(dpi: number): void
|
|
389
|
+
|
|
390
|
+
// Class property signals of PangoCairo-1.0.PangoCairo.FontMap
|
|
391
|
+
|
|
392
|
+
connect(sigName: "notify::item-type", callback: (($obj: FontMap, pspec: GObject.ParamSpec) => void)): number
|
|
393
|
+
connect_after(sigName: "notify::item-type", callback: (($obj: FontMap, pspec: GObject.ParamSpec) => void)): number
|
|
394
|
+
emit(sigName: "notify::item-type", ...args: any[]): void
|
|
395
|
+
connect(sigName: "notify::n-items", callback: (($obj: FontMap, pspec: GObject.ParamSpec) => void)): number
|
|
396
|
+
connect_after(sigName: "notify::n-items", callback: (($obj: FontMap, pspec: GObject.ParamSpec) => void)): number
|
|
397
|
+
emit(sigName: "notify::n-items", ...args: any[]): void
|
|
398
|
+
connect(sigName: string, callback: (...args: any[]) => void): number
|
|
399
|
+
connect_after(sigName: string, callback: (...args: any[]) => void): number
|
|
400
|
+
emit(sigName: string, ...args: any[]): void
|
|
401
|
+
disconnect(id: number): void
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* `PangoCairoFontMap` is an interface exported by font maps for
|
|
406
|
+
* use with Cairo.
|
|
407
|
+
*
|
|
408
|
+
* The actual type of the font map will depend on the particular
|
|
409
|
+
* font technology Cairo was compiled to use.
|
|
410
|
+
* @interface
|
|
411
|
+
*/
|
|
412
|
+
class FontMap extends GObject.Object {
|
|
413
|
+
|
|
414
|
+
// Own properties of PangoCairo-1.0.PangoCairo.FontMap
|
|
415
|
+
|
|
416
|
+
static name: string
|
|
417
|
+
static $gtype: GObject.GType<FontMap>
|
|
418
|
+
|
|
419
|
+
// Constructors of PangoCairo-1.0.PangoCairo.FontMap
|
|
420
|
+
|
|
421
|
+
constructor(config?: FontMap.ConstructorProperties)
|
|
422
|
+
_init(config?: FontMap.ConstructorProperties): void
|
|
423
|
+
/**
|
|
424
|
+
* Creates a new `PangoCairoFontMap` object.
|
|
425
|
+
*
|
|
426
|
+
* A fontmap is used to cache information about available fonts,
|
|
427
|
+
* and holds certain global parameters such as the resolution.
|
|
428
|
+
* In most cases, you can use `func`PangoCairo`.font_map_get_default]
|
|
429
|
+
* instead.
|
|
430
|
+
*
|
|
431
|
+
* Note that the type of the returned object will depend
|
|
432
|
+
* on the particular font backend Cairo was compiled to use;
|
|
433
|
+
* You generally should only use the `PangoFontMap` and
|
|
434
|
+
* `PangoCairoFontMap` interfaces on the returned object.
|
|
435
|
+
*
|
|
436
|
+
* You can override the type of backend returned by using an
|
|
437
|
+
* environment variable %PANGOCAIRO_BACKEND. Supported types,
|
|
438
|
+
* based on your build, are fc (fontconfig), win32, and coretext.
|
|
439
|
+
* If requested type is not available, NULL is returned. Ie.
|
|
440
|
+
* this is only useful for testing, when at least two backends
|
|
441
|
+
* are compiled in.
|
|
442
|
+
* @returns the newly allocated `PangoFontMap`, which should be freed with g_object_unref().
|
|
443
|
+
*/
|
|
444
|
+
static new(): Pango.FontMap
|
|
445
|
+
/**
|
|
446
|
+
* Creates a new `PangoCairoFontMap` object of the type suitable
|
|
447
|
+
* to be used with cairo font backend of type `fonttype`.
|
|
448
|
+
*
|
|
449
|
+
* In most cases one should simply use [func`PangoCairo`.FontMap.new], or
|
|
450
|
+
* in fact in most of those cases, just use [func`PangoCairo`.FontMap.get_default].
|
|
451
|
+
* @param fonttype desired #cairo_font_type_t
|
|
452
|
+
* @returns the newly allocated `PangoFontMap` of suitable type which should be freed with g_object_unref(), or %NULL if the requested cairo font backend is not supported / compiled in.
|
|
453
|
+
*/
|
|
454
|
+
static new_for_font_type(fonttype: cairo.FontType): Pango.FontMap | null
|
|
455
|
+
/**
|
|
456
|
+
* Gets a default `PangoCairoFontMap` to use with Cairo.
|
|
457
|
+
*
|
|
458
|
+
* Note that the type of the returned object will depend on the
|
|
459
|
+
* particular font backend Cairo was compiled to use; you generally
|
|
460
|
+
* should only use the `PangoFontMap` and `PangoCairoFontMap`
|
|
461
|
+
* interfaces on the returned object.
|
|
462
|
+
*
|
|
463
|
+
* The default Cairo fontmap can be changed by using
|
|
464
|
+
* [method`PangoCairo`.FontMap.set_default]. This can be used to
|
|
465
|
+
* change the Cairo font backend that the default fontmap uses
|
|
466
|
+
* for example.
|
|
467
|
+
*
|
|
468
|
+
* Note that since Pango 1.32.6, the default fontmap is per-thread.
|
|
469
|
+
* Each thread gets its own default fontmap. In this way, PangoCairo
|
|
470
|
+
* can be used safely from multiple threads.
|
|
471
|
+
* @returns the default PangoCairo fontmap for the current thread. This object is owned by Pango and must not be freed.
|
|
472
|
+
*/
|
|
473
|
+
static get_default(): Pango.FontMap
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
|
+
* Name of the imported GIR library
|
|
478
|
+
* @see https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L188
|
|
479
|
+
*/
|
|
480
|
+
const __name__: string
|
|
481
|
+
/**
|
|
482
|
+
* Version of the imported GIR library
|
|
483
|
+
* @see https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L189
|
|
484
|
+
*/
|
|
485
|
+
const __version__: string
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
export default PangoCairo;
|
|
489
|
+
// END
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
// General settings for code interpretation
|
|
4
|
+
"target": "ESNext",
|
|
5
|
+
"module": "ESNext",
|
|
6
|
+
"experimentalDecorators": true,
|
|
7
|
+
"moduleResolution": "node",
|
|
8
|
+
"noEmit": true,
|
|
9
|
+
"noEmitOnError": false,
|
|
10
|
+
"baseUrl": "./",
|
|
11
|
+
"rootDir": ".",
|
|
12
|
+
// General settings for code generation
|
|
13
|
+
"removeComments": false,
|
|
14
|
+
"inlineSourceMap": false,
|
|
15
|
+
"inlineSources": false,
|
|
16
|
+
"newLine": "LF"
|
|
17
|
+
},
|
|
18
|
+
"include": ["./pangocairo-1.0.d.ts"]
|
|
19
|
+
}
|