1544
by johan
* gobject/gobjectmodule.c (initgobject): Call |
1 |
/* -*- Mode: C; c-basic-offset: 4 -*- |
731
by jamesh
2003-06-26 James Henstridge <james@daa.com.au> |
2 |
* pygtk- Python bindings for the GTK toolkit. |
3 |
* Copyright (C) 1998-2003 James Henstridge |
|
4 |
*
|
|
5 |
* pango.override: overrides for the Pango library |
|
6 |
*
|
|
7 |
* This library is free software; you can redistribute it and/or |
|
8 |
* modify it under the terms of the GNU Lesser General Public |
|
9 |
* License as published by the Free Software Foundation; either |
|
10 |
* version 2.1 of the License, or (at your option) any later version. |
|
11 |
*
|
|
12 |
* This library is distributed in the hope that it will be useful, |
|
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
15 |
* Lesser General Public License for more details. |
|
16 |
*
|
|
17 |
* You should have received a copy of the GNU Lesser General Public |
|
18 |
* License along with this library; if not, write to the Free Software |
|
19 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
|
20 |
* USA |
|
21 |
*/
|
|
186
by jamesh
2001-07-02 James Henstridge <james@daa.com.au> |
22 |
%%
|
23 |
headers
|
|
24 |
#define NO_IMPORT_PYGOBJECT
|
|
1166
by finlay
* pango.defs (pango_font_family_is_monospace) Add definition. |
25 |
#define PANGO_ENABLE_BACKEND
|
26 |
#define PANGO_ENABLE_ENGINE
|
|
186
by jamesh
2001-07-02 James Henstridge <james@daa.com.au> |
27 |
#include <pygobject.h>
|
28 |
#include <pango/pango.h>
|
|
187
by jamesh
2001-07-02 James Henstridge <james@daa.com.au> |
29 |
|
1159
by finlay
* pango.override (_wrap_pango_attr_list_filter) Add. |
30 |
typedef struct { |
31 |
PyObject *func, *data; |
|
32 |
} PyGtkCustomNotify; |
|
33 |
||
1912
by gjc
some more pango apis |
34 |
#ifndef PANGO_TYPE_LAYOUT_LINE
|
1919
by gjc
wrap more pango stuff |
35 |
# define PANGO_TYPE_LAYOUT_LINE pypango_layout_line_get_type()
|
1913
by gjc
fix PangoLayoutLine boxed copy func. |
36 |
|
37 |
static PangoLayoutLine * |
|
38 |
_layout_line_boxed_copy(PangoLayoutLine *line) |
|
39 |
{
|
|
40 |
pango_layout_line_ref(line); |
|
41 |
return line; |
|
42 |
}
|
|
43 |
||
1912
by gjc
some more pango apis |
44 |
static GType |
45 |
pypango_layout_line_get_type(void) |
|
46 |
{
|
|
47 |
static GType our_type = 0; |
|
48 |
||
49 |
if (our_type == 0) |
|
50 |
our_type = g_boxed_type_register_static("PangoLayoutLine", |
|
1913
by gjc
fix PangoLayoutLine boxed copy func. |
51 |
(GBoxedCopyFunc)_layout_line_boxed_copy, |
1912
by gjc
some more pango apis |
52 |
(GBoxedFreeFunc)pango_layout_line_unref); |
53 |
return our_type; |
|
54 |
}
|
|
1919
by gjc
wrap more pango stuff |
55 |
#endif /* #ifndef PANGO_TYPE_LAYOUT_LINE */
|
56 |
||
57 |
#ifndef PANGO_TYPE_ITEM
|
|
58 |
# define PANGO_TYPE_ITEM (pypango_item_get_type ())
|
|
59 |
||
60 |
static GType |
|
61 |
pypango_item_get_type (void) |
|
62 |
{
|
|
63 |
static GType our_type = 0; |
|
64 |
||
65 |
if (our_type == 0) |
|
66 |
our_type = g_boxed_type_register_static ("PangoItem", |
|
67 |
(GBoxedCopyFunc) pango_item_copy, |
|
68 |
(GBoxedFreeFunc) pango_item_free); |
|
69 |
return our_type; |
|
70 |
}
|
|
71 |
#endif /* #ifndef PANGO_TYPE_ITEM */
|
|
1912
by gjc
some more pango apis |
72 |
|
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
73 |
/* ------------- PangoAttribute ------------- */ |
74 |
||
75 |
typedef struct { |
|
76 |
PyObject_HEAD
|
|
77 |
PangoAttribute *attr; |
|
78 |
} PyPangoAttribute; |
|
79 |
staticforward PyTypeObject PyPangoAttribute_Type; |
|
80 |
||
81 |
static PyObject * |
|
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
82 |
pypango_attr_new(PangoAttribute *attr, guint start, guint end) |
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
83 |
{
|
84 |
PyPangoAttribute *self; |
|
85 |
||
86 |
self = (PyPangoAttribute *)PyObject_NEW(PyPangoAttribute, |
|
87 |
&PyPangoAttribute_Type); |
|
88 |
if (self == NULL) |
|
89 |
return NULL; |
|
90 |
self->attr = attr; |
|
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
91 |
attr->start_index = start; |
92 |
attr->end_index = end; |
|
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
93 |
|
94 |
return (PyObject *)self; |
|
95 |
}
|
|
96 |
||
97 |
static void |
|
98 |
pypango_attr_dealloc(PyPangoAttribute *self) |
|
99 |
{
|
|
100 |
pango_attribute_destroy(self->attr); |
|
101 |
PyObject_DEL(self); |
|
102 |
}
|
|
103 |
||
104 |
static int |
|
105 |
pypango_attr_compare(PyPangoAttribute *self, PyPangoAttribute *v) |
|
106 |
{
|
|
107 |
if (pango_attribute_equal(self->attr, v->attr)) |
|
108 |
return 0; |
|
109 |
if (self->attr > v->attr) |
|
110 |
return -1; |
|
111 |
return 1; |
|
112 |
}
|
|
113 |
||
114 |
static long |
|
115 |
pypango_attr_hash(PyPangoAttribute *self) |
|
116 |
{
|
|
117 |
return (long)self->attr; |
|
118 |
}
|
|
119 |
||
120 |
static PyObject * |
|
121 |
pypango_attr_copy(PyPangoAttribute *self) |
|
122 |
{
|
|
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
123 |
return pypango_attr_new(pango_attribute_copy(self->attr), |
124 |
self->attr->start_index, self->attr->end_index); |
|
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
125 |
}
|
126 |
||
127 |
static PyMethodDef pypango_attr_methods[] = { |
|
128 |
{ "copy", (PyCFunction)pypango_attr_copy, METH_NOARGS }, |
|
129 |
{ NULL, NULL, 0 } |
|
130 |
};
|
|
131 |
||
132 |
static PyObject * |
|
133 |
pypango_attr_get_index(PyPangoAttribute *self, void *closure) |
|
134 |
{
|
|
135 |
gboolean is_end = GPOINTER_TO_INT(closure) != 0; |
|
136 |
||
137 |
if (is_end) |
|
138 |
return PyInt_FromLong(self->attr->end_index); |
|
139 |
else
|
|
140 |
return PyInt_FromLong(self->attr->start_index); |
|
141 |
}
|
|
142 |
||
143 |
static int |
|
144 |
pypango_attr_set_index(PyPangoAttribute *self, PyObject *value, void *closure) |
|
145 |
{
|
|
146 |
gboolean is_end = GPOINTER_TO_INT(closure) != 0; |
|
147 |
gint val; |
|
148 |
||
149 |
val = PyInt_AsLong(value); |
|
150 |
if (PyErr_Occurred()) { |
|
151 |
PyErr_Clear(); |
|
152 |
PyErr_SetString(PyExc_TypeError, "index must be an integer"); |
|
153 |
return -1; |
|
154 |
}
|
|
155 |
if (is_end) |
|
156 |
self->attr->end_index = val; |
|
157 |
else
|
|
158 |
self->attr->start_index = val; |
|
159 |
return 0; |
|
160 |
}
|
|
161 |
||
756
by finlay
* pango.override (pypango_attr_tp_getattr) |
162 |
static PyObject * |
163 |
pypango_attr_get_type(PyPangoAttribute *self, void *closure) |
|
164 |
{
|
|
165 |
return PyInt_FromLong(self->attr->klass->type); |
|
166 |
}
|
|
167 |
||
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
168 |
static PyGetSetDef pypango_attr_getsets[] = { |
169 |
{ "start_index", (getter)pypango_attr_get_index, |
|
170 |
(setter)pypango_attr_set_index, NULL, GINT_TO_POINTER(0) }, |
|
171 |
{ "end_index", (getter)pypango_attr_get_index, |
|
172 |
(setter)pypango_attr_set_index, NULL, GINT_TO_POINTER(1) }, |
|
756
by finlay
* pango.override (pypango_attr_tp_getattr) |
173 |
{ "type", (getter)pypango_attr_get_type, (setter)0, NULL, NULL }, |
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
174 |
{ NULL, (getter)0, (setter)0, NULL, NULL } |
175 |
};
|
|
176 |
||
756
by finlay
* pango.override (pypango_attr_tp_getattr) |
177 |
static PyObject * |
178 |
pypango_attr_tp_getattr(PyPangoAttribute *self, char *attr) |
|
179 |
{
|
|
180 |
PangoAttribute *attribute = self->attr; |
|
181 |
PyObject *name, *ret; |
|
182 |
||
183 |
switch (attribute->klass->type) { |
|
184 |
case PANGO_ATTR_LANGUAGE: |
|
185 |
if (!strcmp(attr, "__members__")) |
|
186 |
return Py_BuildValue("[s]", "value"); |
|
187 |
if (!strcmp(attr, "value")) |
|
188 |
return pyg_boxed_new(PANGO_TYPE_LANGUAGE, |
|
189 |
((PangoAttrLanguage *)attribute)->value, |
|
190 |
TRUE, TRUE); |
|
191 |
break; |
|
192 |
case PANGO_ATTR_FAMILY: |
|
193 |
if (!strcmp(attr, "__members__")) |
|
194 |
return Py_BuildValue("[s]", "value"); |
|
195 |
if (!strcmp(attr, "value")) |
|
196 |
return PyString_FromString(((PangoAttrString *)attribute)->value); |
|
197 |
break; |
|
198 |
case PANGO_ATTR_STYLE: |
|
199 |
case PANGO_ATTR_WEIGHT: |
|
200 |
case PANGO_ATTR_VARIANT: |
|
201 |
case PANGO_ATTR_STRETCH: |
|
202 |
case PANGO_ATTR_SIZE: |
|
203 |
case PANGO_ATTR_UNDERLINE: |
|
204 |
case PANGO_ATTR_STRIKETHROUGH: |
|
205 |
case PANGO_ATTR_RISE: |
|
1155
by finlay
* pango.defs (pango_attr_fallback_new) Add definition for AttrFallback. |
206 |
case PANGO_ATTR_FALLBACK: |
2345
by finlay
* pango.override (_wrap_pango_attr_underline_color_new) |
207 |
case PANGO_ATTR_LETTER_SPACING: |
208 |
case PANGO_ATTR_ABSOLUTE_SIZE: |
|
756
by finlay
* pango.override (pypango_attr_tp_getattr) |
209 |
if (!strcmp(attr, "__members__")) |
210 |
return Py_BuildValue("[s]", "value"); |
|
211 |
if (!strcmp(attr, "value")) |
|
212 |
return PyInt_FromLong(((PangoAttrInt *)attribute)->value); |
|
213 |
break; |
|
214 |
case PANGO_ATTR_FONT_DESC: |
|
215 |
if (!strcmp(attr, "__members__")) |
|
216 |
return Py_BuildValue("[s]", "desc"); |
|
217 |
if (!strcmp(attr, "desc")) |
|
218 |
return pyg_boxed_new(PANGO_TYPE_FONT_DESCRIPTION, |
|
219 |
((PangoAttrFontDesc *)attribute)->desc, |
|
220 |
TRUE, TRUE); |
|
221 |
break; |
|
222 |
case PANGO_ATTR_FOREGROUND: |
|
223 |
case PANGO_ATTR_BACKGROUND: |
|
2345
by finlay
* pango.override (_wrap_pango_attr_underline_color_new) |
224 |
case PANGO_ATTR_UNDERLINE_COLOR: |
225 |
case PANGO_ATTR_STRIKETHROUGH_COLOR: |
|
756
by finlay
* pango.override (pypango_attr_tp_getattr) |
226 |
if (!strcmp(attr, "__members__")) |
227 |
return Py_BuildValue("[s]", "color"); |
|
228 |
if (!strcmp(attr, "color")) |
|
229 |
return pyg_boxed_new(PANGO_TYPE_COLOR, |
|
230 |
&((PangoAttrColor *)attribute)->color, |
|
231 |
TRUE, TRUE); |
|
232 |
break; |
|
233 |
case PANGO_ATTR_SHAPE: |
|
234 |
if (!strcmp(attr, "__members__")) |
|
235 |
return Py_BuildValue("[ss]", "ink_rect", "logical_rect"); |
|
236 |
if (!strcmp(attr, "ink_rect")) { |
|
237 |
PangoRectangle rect = ((PangoAttrShape *)attribute)->ink_rect; |
|
238 |
||
239 |
return Py_BuildValue("iiii", rect.x, rect.y, |
|
240 |
rect.width, rect.height); |
|
241 |
}
|
|
242 |
if (!strcmp(attr, "logical_rect")) { |
|
243 |
PangoRectangle rect = ((PangoAttrShape *)attribute)->logical_rect; |
|
244 |
||
245 |
return Py_BuildValue("iiii", rect.x, rect.y, |
|
246 |
rect.width, rect.height); |
|
247 |
}
|
|
248 |
break; |
|
249 |
case PANGO_ATTR_SCALE: |
|
250 |
if (!strcmp(attr, "__members__")) |
|
251 |
return Py_BuildValue("[s]", "value"); |
|
252 |
if (!strcmp(attr, "value")) |
|
253 |
return PyFloat_FromDouble(((PangoAttrFloat *)attribute)->value); |
|
254 |
break; |
|
255 |
default: |
|
256 |
break; |
|
257 |
}
|
|
258 |
||
259 |
name = PyString_FromString(attr); |
|
260 |
ret = PyObject_GenericGetAttr((PyObject *)self, name); |
|
261 |
Py_DECREF(name); |
|
262 |
return ret; |
|
263 |
}
|
|
264 |
||
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
265 |
static PyTypeObject PyPangoAttribute_Type = { |
266 |
PyObject_HEAD_INIT(NULL) |
|
267 |
0, /* ob_size */ |
|
268 |
"pango.Attribute", /* tp_name */ |
|
269 |
sizeof(PyPangoAttribute), /* tp_basicsize */ |
|
270 |
0, /* tp_itemsize */ |
|
271 |
/* methods */ |
|
272 |
(destructor)pypango_attr_dealloc, /* tp_dealloc */ |
|
273 |
(printfunc)0, /* tp_print */ |
|
756
by finlay
* pango.override (pypango_attr_tp_getattr) |
274 |
(getattrfunc)pypango_attr_tp_getattr, /* tp_getattr */ |
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
275 |
(setattrfunc)0, /* tp_setattr */ |
276 |
(cmpfunc)pypango_attr_compare, /* tp_compare */ |
|
277 |
(reprfunc)0, /* tp_repr */ |
|
278 |
0, /* tp_as_number */ |
|
279 |
0, /* tp_as_sequence */ |
|
280 |
0, /* tp_as_mapping */ |
|
281 |
(hashfunc)pypango_attr_hash, /* tp_hash */ |
|
282 |
(ternaryfunc)0, /* tp_call */ |
|
283 |
(reprfunc)0, /* tp_str */ |
|
284 |
(getattrofunc)0, /* tp_getattro */ |
|
285 |
(setattrofunc)0, /* tp_setattro */ |
|
286 |
0, /* tp_as_buffer */ |
|
287 |
Py_TPFLAGS_DEFAULT, /* tp_flags */ |
|
288 |
NULL, /* Documentation string */ |
|
289 |
(traverseproc)0, /* tp_traverse */ |
|
290 |
(inquiry)0, /* tp_clear */ |
|
291 |
(richcmpfunc)0, /* tp_richcompare */ |
|
292 |
0, /* tp_weaklistoffset */ |
|
293 |
(getiterfunc)0, /* tp_iter */ |
|
294 |
(iternextfunc)0, /* tp_iternext */ |
|
295 |
pypango_attr_methods, /* tp_methods */ |
|
296 |
0, /* tp_members */ |
|
297 |
pypango_attr_getsets, /* tp_getset */ |
|
298 |
(PyTypeObject *)0, /* tp_base */ |
|
299 |
(PyObject *)0, /* tp_dict */ |
|
300 |
0, /* tp_descr_get */ |
|
301 |
0, /* tp_descr_set */ |
|
302 |
0, /* tp_dictoffset */ |
|
303 |
(initproc)0, /* tp_init */ |
|
549
by jamesh
2002-08-24 James Henstridge <james@daa.com.au> |
304 |
(allocfunc)0, /* tp_alloc */ |
305 |
(newfunc)0, /* tp_new */ |
|
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
306 |
0, /* tp_free */ |
307 |
(inquiry)0, /* tp_is_gc */ |
|
308 |
(PyObject *)0, /* tp_bases */ |
|
309 |
};
|
|
310 |
||
758
by finlay
* pango.override (PangoAttrIterator) Add this type and its methods. |
311 |
/* ------------- PangoAttrIterator ------------- */ |
312 |
||
313 |
typedef struct { |
|
314 |
PyObject_HEAD
|
|
315 |
PangoAttrIterator *iter; |
|
316 |
} PyPangoAttrIterator; |
|
317 |
staticforward PyTypeObject PyPangoAttrIterator_Type; |
|
318 |
||
319 |
static PyObject * |
|
320 |
pypango_attr_iterator_new(PangoAttrIterator *iter) |
|
321 |
{
|
|
322 |
PyPangoAttrIterator *self; |
|
323 |
||
324 |
self = (PyPangoAttrIterator *)PyObject_NEW(PyPangoAttrIterator, |
|
325 |
&PyPangoAttrIterator_Type); |
|
326 |
if (self == NULL) |
|
327 |
return NULL; |
|
328 |
self->iter = iter; |
|
329 |
||
330 |
return (PyObject *)self; |
|
331 |
}
|
|
332 |
||
333 |
static void |
|
334 |
pypango_attr_iterator_dealloc(PyPangoAttrIterator *self) |
|
335 |
{
|
|
336 |
pango_attr_iterator_destroy(self->iter); |
|
337 |
PyObject_DEL(self); |
|
338 |
}
|
|
339 |
||
340 |
static int |
|
341 |
pypango_attr_iterator_compare(PyPangoAttrIterator *self, |
|
342 |
PyPangoAttrIterator *v) |
|
343 |
{
|
|
344 |
if (self->iter == v->iter) |
|
345 |
return 0; |
|
346 |
if (self->iter > v->iter) |
|
347 |
return -1; |
|
348 |
return 1; |
|
349 |
}
|
|
350 |
||
351 |
static long |
|
352 |
pypango_attr_iterator_hash(PyPangoAttrIterator *self) |
|
353 |
{
|
|
354 |
return (long)self->iter; |
|
355 |
}
|
|
356 |
||
357 |
static PyObject * |
|
358 |
pypango_attr_iterator_copy(PyPangoAttrIterator *self) |
|
359 |
{
|
|
360 |
return pypango_attr_iterator_new(pango_attr_iterator_copy(self->iter)); |
|
361 |
}
|
|
362 |
||
363 |
static PyObject * |
|
364 |
pypango_attr_iterator_range(PyPangoAttrIterator *self) |
|
365 |
{
|
|
366 |
gint start, end; |
|
367 |
||
368 |
pango_attr_iterator_range(self->iter, &start, &end); |
|
369 |
return Py_BuildValue("ii", start, end); |
|
370 |
}
|
|
371 |
||
372 |
static PyObject * |
|
373 |
pypango_attr_iterator_next(PyPangoAttrIterator *self) |
|
374 |
{
|
|
1551
by johan
* codegen/argtypes.py: |
375 |
return PyBool_FromLong(pango_attr_iterator_next(self->iter)); |
758
by finlay
* pango.override (PangoAttrIterator) Add this type and its methods. |
376 |
}
|
377 |
||
378 |
static PyObject * |
|
379 |
pypango_attr_iterator_get(PyPangoAttrIterator *self, PyObject *args, |
|
380 |
PyObject *kwargs) |
|
381 |
{
|
|
382 |
static char *kwlist[] = { "type", NULL }; |
|
383 |
PyObject *py_type; |
|
384 |
PangoAttrType type; |
|
385 |
PangoAttribute *attr; |
|
386 |
||
387 |
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:pango.AttrIterator.get", |
|
388 |
kwlist, &py_type)) |
|
389 |
return NULL; |
|
390 |
||
391 |
if (pyg_enum_get_value(PANGO_TYPE_ATTR_TYPE, py_type, (gint*)&type)) |
|
392 |
return NULL; |
|
393 |
||
394 |
if (!(attr = pango_attr_iterator_get(self->iter, type))) { |
|
395 |
Py_INCREF(Py_None); |
|
396 |
return Py_None; |
|
397 |
}
|
|
398 |
||
399 |
return pypango_attr_new(attr, attr->start_index, attr->end_index); |
|
400 |
}
|
|
401 |
||
402 |
static PyObject * |
|
403 |
pypango_attr_iterator_get_font(PyPangoAttrIterator *self) |
|
404 |
{
|
|
405 |
PangoFontDescription *desc; |
|
406 |
PangoLanguage *language; |
|
407 |
GSList *extra_attrs, *tmp; |
|
408 |
PyObject *py_desc, *py_language, *py_extra_attrs; |
|
409 |
||
410 |
if (!(desc = pango_font_description_new())) { |
|
411 |
PyErr_SetString(PyExc_RuntimeError, "can't get font info"); |
|
412 |
return NULL; |
|
413 |
}
|
|
414 |
pango_attr_iterator_get_font(self->iter, desc, &language, &extra_attrs); |
|
415 |
py_desc = pyg_boxed_new(PANGO_TYPE_FONT_DESCRIPTION, desc, TRUE, TRUE); |
|
416 |
py_language = pyg_boxed_new(PANGO_TYPE_LANGUAGE, language, TRUE, TRUE); |
|
417 |
||
418 |
py_extra_attrs = PyList_New(0); |
|
419 |
for (tmp = extra_attrs; tmp != NULL; tmp = tmp->next) { |
|
420 |
PangoAttribute *attr = (PangoAttribute *)tmp->data; |
|
421 |
PyObject *py_attr = pypango_attr_new(attr, attr->start_index, |
|
422 |
attr->end_index); |
|
423 |
PyList_Append(py_extra_attrs, py_attr); |
|
424 |
Py_DECREF(py_attr); |
|
425 |
}
|
|
426 |
g_slist_free(extra_attrs); |
|
427 |
||
1525
by finlay
* gtk/gtktreeview.override (_wrap_gtk_tree_view_get_cursor) |
428 |
return Py_BuildValue("NNN", py_desc, py_language, py_extra_attrs); |
758
by finlay
* pango.override (PangoAttrIterator) Add this type and its methods. |
429 |
}
|
430 |
||
1157
by finlay
* pango.defs (pango_attr_iterator_get_attrs) Add definition. |
431 |
static PyObject * |
432 |
pypango_attr_iterator_get_attrs(PyPangoAttrIterator *self) |
|
433 |
{
|
|
434 |
GSList *alist; |
|
435 |
PyObject *py_list; |
|
436 |
guint i, len; |
|
437 |
||
438 |
alist = pango_attr_iterator_get_attrs(self->iter); |
|
439 |
||
440 |
len = g_slist_length(alist); |
|
441 |
py_list = PyTuple_New(len); |
|
442 |
for (i = 0; i < len; i++) { |
|
443 |
PangoAttribute *attr = (PangoAttribute *)g_slist_nth_data(alist, i); |
|
444 |
||
445 |
PyTuple_SetItem(py_list, i, pypango_attr_new(attr, attr->start_index, |
|
446 |
attr->end_index)); |
|
447 |
}
|
|
1159
by finlay
* pango.override (_wrap_pango_attr_list_filter) Add. |
448 |
/* don't have to destroy attributes since we use them */ |
449 |
g_slist_free(alist); |
|
1157
by finlay
* pango.defs (pango_attr_iterator_get_attrs) Add definition. |
450 |
return py_list; |
451 |
}
|
|
452 |
||
758
by finlay
* pango.override (PangoAttrIterator) Add this type and its methods. |
453 |
static PyMethodDef pypango_attr_iterator_methods[] = { |
454 |
{ "copy", (PyCFunction)pypango_attr_iterator_copy, METH_NOARGS }, |
|
455 |
{ "range", (PyCFunction)pypango_attr_iterator_range, METH_NOARGS }, |
|
456 |
{ "next", (PyCFunction)pypango_attr_iterator_next, METH_NOARGS }, |
|
457 |
{ "get", (PyCFunction)pypango_attr_iterator_get, METH_VARARGS|METH_KEYWORDS }, |
|
458 |
{ "get_font", (PyCFunction)pypango_attr_iterator_get_font, METH_NOARGS }, |
|
1157
by finlay
* pango.defs (pango_attr_iterator_get_attrs) Add definition. |
459 |
{ "get_attrs", (PyCFunction)pypango_attr_iterator_get_attrs, METH_NOARGS }, |
758
by finlay
* pango.override (PangoAttrIterator) Add this type and its methods. |
460 |
{ NULL, NULL, 0 } |
461 |
};
|
|
462 |
||
463 |
static PyTypeObject PyPangoAttrIterator_Type = { |
|
464 |
PyObject_HEAD_INIT(NULL) |
|
465 |
0, /* ob_size */ |
|
466 |
"pango.AttrIterator", /* tp_name */ |
|
467 |
sizeof(PyPangoAttrIterator), /* tp_basicsize */ |
|
468 |
0, /* tp_itemsize */ |
|
469 |
/* methods */ |
|
470 |
(destructor)pypango_attr_iterator_dealloc, /* tp_dealloc */ |
|
471 |
(printfunc)0, /* tp_print */ |
|
472 |
(getattrfunc)0, /* tp_getattr */ |
|
473 |
(setattrfunc)0, /* tp_setattr */ |
|
474 |
(cmpfunc)pypango_attr_iterator_compare, /* tp_compare */ |
|
475 |
(reprfunc)0, /* tp_repr */ |
|
476 |
0, /* tp_as_number */ |
|
477 |
0, /* tp_as_sequence */ |
|
478 |
0, /* tp_as_mapping */ |
|
479 |
(hashfunc)pypango_attr_iterator_hash, /* tp_hash */ |
|
480 |
(ternaryfunc)0, /* tp_call */ |
|
481 |
(reprfunc)0, /* tp_str */ |
|
482 |
(getattrofunc)0, /* tp_getattro */ |
|
483 |
(setattrofunc)0, /* tp_setattro */ |
|
484 |
0, /* tp_as_buffer */ |
|
485 |
Py_TPFLAGS_DEFAULT, /* tp_flags */ |
|
486 |
NULL, /* Documentation string */ |
|
487 |
(traverseproc)0, /* tp_traverse */ |
|
488 |
(inquiry)0, /* tp_clear */ |
|
489 |
(richcmpfunc)0, /* tp_richcompare */ |
|
490 |
0, /* tp_weaklistoffset */ |
|
491 |
(getiterfunc)0, /* tp_iter */ |
|
492 |
(iternextfunc)0, /* tp_iternext */ |
|
493 |
pypango_attr_iterator_methods, /* tp_methods */ |
|
494 |
0, /* tp_members */ |
|
495 |
0, /* tp_getset */ |
|
496 |
(PyTypeObject *)0, /* tp_base */ |
|
497 |
(PyObject *)0, /* tp_dict */ |
|
498 |
0, /* tp_descr_get */ |
|
499 |
0, /* tp_descr_set */ |
|
500 |
0, /* tp_dictoffset */ |
|
501 |
(initproc)0, /* tp_init */ |
|
502 |
(allocfunc)0, /* tp_alloc */ |
|
503 |
(newfunc)0, /* tp_new */ |
|
504 |
0, /* tp_free */ |
|
505 |
(inquiry)0, /* tp_is_gc */ |
|
506 |
(PyObject *)0, /* tp_bases */ |
|
507 |
};
|
|
508 |
||
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
509 |
%%
|
510 |
init
|
|
549
by jamesh
2002-08-24 James Henstridge <james@daa.com.au> |
511 |
PyPangoAttribute_Type.tp_alloc = PyType_GenericAlloc; |
512 |
PyPangoAttribute_Type.tp_new = PyType_GenericNew; |
|
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
513 |
if (PyType_Ready(&PyPangoAttribute_Type) < 0) |
514 |
return; |
|
758
by finlay
* pango.override (PangoAttrIterator) Add this type and its methods. |
515 |
|
516 |
PyPangoAttrIterator_Type.tp_alloc = PyType_GenericAlloc; |
|
517 |
PyPangoAttrIterator_Type.tp_new = PyType_GenericNew; |
|
518 |
if (PyType_Ready(&PyPangoAttrIterator_Type) < 0) |
|
519 |
return; |
|
186
by jamesh
2001-07-02 James Henstridge <james@daa.com.au> |
520 |
%%
|
437
by jamesh
2002-03-16 James Henstridge <james@daa.com.au> |
521 |
modulename pango |
522 |
%%
|
|
275
by jamesh
2001-10-08 James Henstridge <james@daa.com.au> |
523 |
import gobject.GObject as PyGObject_Type |
188
by jamesh
2001-07-03 James Henstridge <james@daa.com.au> |
524 |
%%
|
2430
by finlay
* pango.override (*_get_type, *_ref, *_unref, *_free): ignore-glob |
525 |
ignore-glob |
526 |
*_get_type |
|
527 |
*_ref |
|
528 |
*_unref |
|
529 |
*_free |
|
188
by jamesh
2001-07-03 James Henstridge <james@daa.com.au> |
530 |
%%
|
531 |
ignore
|
|
532 |
pango_color_copy
|
|
533 |
pango_attribute_copy
|
|
534 |
pango_attribute_destroy
|
|
535 |
pango_attribute_equal
|
|
536 |
pango_font_description_equal
|
|
537 |
pango_font_map_free_families
|
|
439
by jamesh
2002-03-17 James Henstridge <james@daa.com.au> |
538 |
pango_font_get_coverage
|
539 |
pango_font_find_shaper
|
|
540 |
pango_layout_get_log_attrs
|
|
230
by jamesh
2001-09-19 James Henstridge <james@daa.com.au> |
541 |
%%
|
416
by jamesh
2002-02-05 James Henstridge <james@daa.com.au> |
542 |
ignore
|
543 |
pango_context_set_font_map
|
|
448
by jamesh
2002-04-10 James Henstridge <james@daa.com.au> |
544 |
pango_glyph_string_index_to_x
|
545 |
pango_glyph_string_x_to_index
|
|
546 |
pango_break
|
|
2430
by finlay
* pango.override (*_get_type, *_ref, *_unref, *_free): ignore-glob |
547 |
pango_default_break
|
448
by jamesh
2002-04-10 James Henstridge <james@daa.com.au> |
548 |
pango_shape
|
416
by jamesh
2002-02-05 James Henstridge <james@daa.com.au> |
549 |
%%
|
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
550 |
override pango_attr_language_new kwargs |
551 |
static PyObject * |
|
552 |
_wrap_pango_attr_language_new(PyObject *self, PyObject *args, PyObject *kwargs) |
|
553 |
{
|
|
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
554 |
static char *kwlist[] = { "language", "start_index", "end_index", NULL }; |
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
555 |
char *slanguage; |
556 |
PangoLanguage *language; |
|
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
557 |
guint start = 0, end = 1; |
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
558 |
|
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
559 |
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|ii:PangoAttrLanguage", |
560 |
kwlist, &slanguage, &start, &end)) |
|
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
561 |
return NULL; |
562 |
||
563 |
language = pango_language_from_string(slanguage); |
|
564 |
||
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
565 |
return pypango_attr_new(pango_attr_language_new(language), start, end); |
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
566 |
}
|
567 |
%%
|
|
568 |
override pango_attr_family_new kwargs |
|
569 |
static PyObject * |
|
570 |
_wrap_pango_attr_family_new(PyObject *self, PyObject *args, PyObject *kwargs) |
|
571 |
{
|
|
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
572 |
static char *kwlist[] = { "family", "start_index", "end_index", NULL }; |
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
573 |
char *family; |
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
574 |
guint start = 0, end = 1; |
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
575 |
|
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
576 |
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|ii:PangoAttrFamily", |
577 |
kwlist, &family, &start, &end)) |
|
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
578 |
return NULL; |
579 |
||
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
580 |
return pypango_attr_new(pango_attr_family_new(family), start, end); |
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
581 |
}
|
582 |
%%
|
|
583 |
override pango_attr_foreground_new kwargs |
|
584 |
static PyObject * |
|
585 |
_wrap_pango_attr_foreground_new(PyObject *self,PyObject *args,PyObject *kwargs) |
|
586 |
{
|
|
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
587 |
static char *kwlist[] = { "red", "green", "blue", "start_index", |
588 |
"end_index", NULL }; |
|
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
589 |
guint16 red, green, blue; |
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
590 |
guint start = 0, end = 1; |
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
591 |
|
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
592 |
if (!PyArg_ParseTupleAndKeywords(args, kwargs, |
593 |
"HHH|ii:PangoAttrForeground", |
|
594 |
kwlist, &red, &green, &blue, |
|
595 |
&start, &end)) |
|
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
596 |
return NULL; |
597 |
||
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
598 |
return pypango_attr_new(pango_attr_foreground_new(red, green, blue), |
599 |
start, end); |
|
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
600 |
}
|
601 |
%%
|
|
602 |
override pango_attr_background_new kwargs |
|
603 |
static PyObject * |
|
604 |
_wrap_pango_attr_background_new(PyObject *self,PyObject *args,PyObject *kwargs) |
|
605 |
{
|
|
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
606 |
static char *kwlist[] = { "red", "green", "blue", "start_index", |
607 |
"end_index", NULL }; |
|
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
608 |
guint16 red, green, blue; |
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
609 |
guint start = 0, end = 1; |
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
610 |
|
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
611 |
if (!PyArg_ParseTupleAndKeywords(args, kwargs, |
612 |
"HHH|ii:PangoAttrBackground", |
|
613 |
kwlist, &red, &green, &blue, |
|
614 |
&start, &end)) |
|
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
615 |
return NULL; |
616 |
||
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
617 |
return pypango_attr_new(pango_attr_background_new(red, green, blue), |
618 |
start, end); |
|
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
619 |
}
|
620 |
%%
|
|
621 |
override pango_attr_size_new kwargs |
|
622 |
static PyObject * |
|
623 |
_wrap_pango_attr_size_new(PyObject *self, PyObject *args, PyObject *kwargs) |
|
624 |
{
|
|
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
625 |
static char *kwlist[] = { "size", "start_index", "end_index", NULL }; |
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
626 |
int size; |
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
627 |
guint start = 0, end = 1; |
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
628 |
|
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
629 |
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i|ii:PangoAttrSize", |
630 |
kwlist, &size, &start, &end)) |
|
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
631 |
return NULL; |
632 |
||
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
633 |
return pypango_attr_new(pango_attr_size_new(size), start, end); |
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
634 |
}
|
635 |
%%
|
|
636 |
override pango_attr_style_new kwargs |
|
637 |
static PyObject * |
|
638 |
_wrap_pango_attr_style_new(PyObject *self, PyObject *args, PyObject *kwargs) |
|
639 |
{
|
|
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
640 |
static char *kwlist[] = { "style", "start_index", "end_index", NULL }; |
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
641 |
PyObject *py_style; |
642 |
PangoStyle style; |
|
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
643 |
guint start = 0, end = 1; |
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
644 |
|
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
645 |
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|ii:PangoAttrStyle", |
646 |
kwlist, &py_style, &start, &end)) |
|
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
647 |
return NULL; |
577
by jamesh
2002-11-16 James Henstridge <james@daa.com.au> |
648 |
if (pyg_enum_get_value(PANGO_TYPE_STYLE, py_style, (gint *)&style)) |
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
649 |
return NULL; |
650 |
||
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
651 |
return pypango_attr_new(pango_attr_style_new(style), start, end); |
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
652 |
}
|
653 |
%%
|
|
654 |
override pango_attr_weight_new kwargs |
|
655 |
static PyObject * |
|
656 |
_wrap_pango_attr_weight_new(PyObject *self, PyObject *args, PyObject *kwargs) |
|
657 |
{
|
|
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
658 |
static char *kwlist[] = { "weight", "start_index", "end_index", NULL }; |
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
659 |
PyObject *py_weight; |
660 |
PangoWeight weight; |
|
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
661 |
guint start = 0, end = 1; |
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
662 |
|
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
663 |
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|ii:PangoAttrWeight", |
664 |
kwlist, &py_weight, &start, &end)) |
|
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
665 |
return NULL; |
577
by jamesh
2002-11-16 James Henstridge <james@daa.com.au> |
666 |
if (pyg_enum_get_value(PANGO_TYPE_WEIGHT, py_weight, (gint *)&weight)) |
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
667 |
return NULL; |
668 |
||
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
669 |
return pypango_attr_new(pango_attr_weight_new(weight), start, end); |
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
670 |
}
|
671 |
%%
|
|
672 |
override pango_attr_variant_new kwargs |
|
673 |
static PyObject * |
|
674 |
_wrap_pango_attr_variant_new(PyObject *self, PyObject *args, PyObject *kwargs) |
|
675 |
{
|
|
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
676 |
static char *kwlist[] = { "variant", "start_index", "end_index", NULL }; |
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
677 |
PyObject *py_variant; |
678 |
PangoVariant variant; |
|
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
679 |
guint start = 0, end = 1; |
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
680 |
|
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
681 |
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|ii:PangoAttrVariant", |
682 |
kwlist, &py_variant, &start, &end)) |
|
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
683 |
return NULL; |
577
by jamesh
2002-11-16 James Henstridge <james@daa.com.au> |
684 |
if (pyg_enum_get_value(PANGO_TYPE_VARIANT, py_variant, (gint *)&variant)) |
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
685 |
return NULL; |
686 |
||
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
687 |
return pypango_attr_new(pango_attr_variant_new(variant), start, end); |
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
688 |
}
|
689 |
%%
|
|
690 |
override pango_attr_stretch_new kwargs |
|
691 |
static PyObject * |
|
692 |
_wrap_pango_attr_stretch_new(PyObject *self, PyObject *args, PyObject *kwargs) |
|
693 |
{
|
|
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
694 |
static char *kwlist[] = { "stretch", "start_index", "end_index", NULL }; |
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
695 |
PyObject *py_stretch; |
696 |
PangoStretch stretch; |
|
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
697 |
guint start = 0, end = 1; |
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
698 |
|
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
699 |
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|ii:PangoAttrStretch", |
700 |
kwlist, &py_stretch, &start, &end)) |
|
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
701 |
return NULL; |
577
by jamesh
2002-11-16 James Henstridge <james@daa.com.au> |
702 |
if (pyg_enum_get_value(PANGO_TYPE_STRETCH, py_stretch, (gint *)&stretch)) |
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
703 |
return NULL; |
704 |
||
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
705 |
return pypango_attr_new(pango_attr_stretch_new(stretch), start, end); |
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
706 |
}
|
707 |
%%
|
|
708 |
override pango_attr_font_desc_new kwargs |
|
709 |
static PyObject * |
|
710 |
_wrap_pango_attr_font_desc_new(PyObject *self, PyObject *args,PyObject *kwargs) |
|
711 |
{
|
|
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
712 |
static char *kwlist[] = { "desc", "start_index", "end_index", NULL }; |
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
713 |
PyObject *font_desc; |
714 |
PangoFontDescription *desc; |
|
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
715 |
guint start = 0, end = 1; |
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
716 |
|
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
717 |
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|ii:PangoAttrFontDesc", |
718 |
kwlist, &font_desc, &start, &end)) |
|
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
719 |
return NULL; |
720 |
if (!pyg_boxed_check(font_desc, PANGO_TYPE_FONT_DESCRIPTION)) { |
|
721 |
PyErr_SetString(PyExc_TypeError,"desc must be a PangoFontDescription"); |
|
722 |
return NULL; |
|
723 |
}
|
|
724 |
desc = pyg_boxed_get(font_desc, PangoFontDescription); |
|
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
725 |
return pypango_attr_new(pango_attr_font_desc_new(desc), start, end); |
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
726 |
}
|
727 |
%%
|
|
728 |
override pango_attr_underline_new kwargs |
|
729 |
static PyObject * |
|
730 |
_wrap_pango_attr_underline_new(PyObject *self, PyObject *args,PyObject *kwargs) |
|
731 |
{
|
|
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
732 |
static char *kwlist[] = { "underline", "start_index", "end_index", NULL }; |
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
733 |
PyObject *py_underline; |
734 |
PangoUnderline underline; |
|
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
735 |
guint start = 0, end = 1; |
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
736 |
|
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
737 |
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|ii:PangoAttrUnderline", |
738 |
kwlist, &py_underline, &start, &end)) |
|
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
739 |
return NULL; |
577
by jamesh
2002-11-16 James Henstridge <james@daa.com.au> |
740 |
if (pyg_enum_get_value(PANGO_TYPE_UNDERLINE, py_underline, |
741 |
(gint *)&underline)) |
|
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
742 |
return NULL; |
743 |
||
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
744 |
return pypango_attr_new(pango_attr_underline_new(underline), start, end); |
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
745 |
}
|
746 |
%%
|
|
747 |
override pango_attr_strikethrough_new kwargs |
|
748 |
static PyObject * |
|
749 |
_wrap_pango_attr_strikethrough_new(PyObject *self, PyObject *args, |
|
750 |
PyObject *kwargs) |
|
751 |
{
|
|
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
752 |
static char *kwlist[] = { "strikethrough", "start_index", |
753 |
"end_index", NULL }; |
|
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
754 |
gboolean strikethrough; |
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
755 |
guint start = 0, end = 1; |
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
756 |
|
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
757 |
if (!PyArg_ParseTupleAndKeywords(args, kwargs, |
758 |
"i|ii:PangoAttrStrikethrough", |
|
759 |
kwlist, &strikethrough, &start, &end)) |
|
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
760 |
return NULL; |
761 |
||
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
762 |
return pypango_attr_new(pango_attr_strikethrough_new(strikethrough), |
763 |
start, end); |
|
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
764 |
}
|
765 |
%%
|
|
766 |
override pango_attr_rise_new kwargs |
|
767 |
static PyObject * |
|
768 |
_wrap_pango_attr_rise_new(PyObject *self, PyObject *args, PyObject *kwargs) |
|
769 |
{
|
|
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
770 |
static char *kwlist[] = { "rise", "start_index", "end_index", NULL }; |
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
771 |
gint rise; |
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
772 |
guint start = 0, end = 1; |
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
773 |
|
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
774 |
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i|ii:PangoAttrRise", |
775 |
kwlist, &rise, &start, &end)) |
|
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
776 |
return NULL; |
777 |
||
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
778 |
return pypango_attr_new(pango_attr_rise_new(rise), start, end); |
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
779 |
}
|
780 |
%%
|
|
781 |
override pango_attr_shape_new kwargs |
|
782 |
static PyObject * |
|
783 |
_wrap_pango_attr_shape_new(PyObject *self, PyObject *args, PyObject *kwargs) |
|
784 |
{
|
|
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
785 |
static char *kwlist[] = { "ink_rect", "logical_rect", "start_index", |
786 |
"end_index", NULL }; |
|
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
787 |
PangoRectangle ink_rect, logical_rect; |
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
788 |
PyObject *py_ink_rect, *py_logical_rect; |
789 |
guint start = 0, end = 1; |
|
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
790 |
|
791 |
if (!PyArg_ParseTupleAndKeywords(args, kwargs, |
|
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
792 |
"OO|ii:PangoAttrShape", kwlist, |
793 |
&py_ink_rect, &py_logical_rect, |
|
794 |
&start, &end)) |
|
795 |
return NULL; |
|
796 |
||
797 |
if (!PyTuple_Check(py_ink_rect) |
|
798 |
|| !PyArg_ParseTuple(py_ink_rect, "iiii", |
|
799 |
&ink_rect.x, &ink_rect.y, |
|
800 |
&ink_rect.width, &ink_rect.height)) { |
|
801 |
PyErr_Clear(); |
|
802 |
PyErr_SetString(PyExc_TypeError, |
|
803 |
"ink_rect must be a 4-tuple of integers"); |
|
804 |
return NULL; |
|
805 |
}
|
|
806 |
||
807 |
if (!PyTuple_Check(py_logical_rect) |
|
808 |
|| !PyArg_ParseTuple(py_logical_rect, "iiii", |
|
809 |
&logical_rect.x, &logical_rect.y, |
|
810 |
&logical_rect.width,&logical_rect.height)) { |
|
811 |
PyErr_Clear(); |
|
812 |
PyErr_SetString(PyExc_TypeError, |
|
813 |
"logical_rect must be a 4-tuple of integers"); |
|
814 |
return NULL; |
|
815 |
}
|
|
816 |
||
817 |
return pypango_attr_new(pango_attr_shape_new(&ink_rect, &logical_rect), |
|
818 |
start, end); |
|
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
819 |
}
|
820 |
%%
|
|
821 |
override pango_attr_scale_new kwargs |
|
822 |
static PyObject * |
|
823 |
_wrap_pango_attr_scale_new(PyObject *self, PyObject *args, PyObject *kwargs) |
|
824 |
{
|
|
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
825 |
static char *kwlist[] = { "scale", "start_index", "end_index", NULL }; |
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
826 |
double scale; |
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
827 |
guint start = 0, end = 1; |
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
828 |
|
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
829 |
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "d|ii:PangoAttrScale", |
830 |
kwlist, &scale, &start, &end)) |
|
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
831 |
return NULL; |
832 |
||
757
by finlay
* pango.override (pypango_attr_new) Add start and end args to specify |
833 |
return pypango_attr_new(pango_attr_scale_new(scale), start, end); |
451
by jamesh
2002-04-15 James Henstridge <james@daa.com.au> |
834 |
}
|
835 |
%%
|
|
836 |
override pango_attr_list_insert kwargs |
|
837 |
static PyObject * |
|
838 |
_wrap_pango_attr_list_insert(PyObject *self, PyObject *args, PyObject *kwargs) |
|
839 |
{
|
|
840 |
static char *kwlist[] = { "attr", NULL }; |
|
841 |
PyPangoAttribute *py_attr; |
|
842 |
PangoAttribute *attr; |
|
843 |
||
844 |
if (!PyArg_ParseTupleAndKeywords(args, kwargs, |
|
845 |
"O!:PangoAttrList.insert", kwlist, |
|
846 |
&PyPangoAttribute_Type, &py_attr)) |
|
847 |
return NULL; |
|
848 |
attr = pango_attribute_copy(py_attr->attr); |
|
849 |
||
850 |
pango_attr_list_insert(pyg_boxed_get(self, PangoAttrList), attr); |
|
851 |
||
852 |
Py_INCREF(Py_None); |
|
853 |
return Py_None; |
|
854 |
}
|
|
855 |
%%
|
|
856 |
override pango_attr_list_insert_before kwargs |
|
857 |
static PyObject * |
|
858 |
_wrap_pango_attr_list_insert_before(PyObject *self, PyObject *args, |
|
859 |
PyObject *kwargs) |
|
860 |
{
|
|
861 |
static char *kwlist[] = { "attr", NULL }; |
|
862 |
PyPangoAttribute *py_attr; |
|
863 |
PangoAttribute *attr; |
|
864 |
||
865 |
if (!PyArg_ParseTupleAndKeywords(args, kwargs, |
|
866 |
"O!:PangoAttrList.insert_before", kwlist, |
|
867 |
&PyPangoAttribute_Type, &py_attr)) |
|
868 |
return NULL; |
|
869 |
attr = pango_attribute_copy(py_attr->attr); |
|
870 |
||
871 |
pango_attr_list_insert_before(pyg_boxed_get(self, PangoAttrList), attr); |
|
872 |
||
873 |
Py_INCREF(Py_None); |
|
874 |
return Py_None; |
|
875 |
}
|
|
876 |
%%
|
|
877 |
override pango_attr_list_change kwargs |
|
878 |
static PyObject * |
|
879 |
_wrap_pango_attr_list_change(PyObject *self, PyObject *args, PyObject *kwargs) |
|
880 |
{
|
|
881 |
static char *kwlist[] = { "attr", NULL }; |
|
882 |
PyPangoAttribute *py_attr; |
|
883 |
PangoAttribute *attr; |
|
884 |
||
885 |
if (!PyArg_ParseTupleAndKeywords(args, kwargs, |
|
886 |
"O!:PangoAttrList.change", kwlist, |
|
887 |
&PyPangoAttribute_Type, &py_attr)) |
|
888 |
return NULL; |
|
889 |
attr = pango_attribute_copy(py_attr->attr); |
|
890 |
||
891 |
pango_attr_list_change(pyg_boxed_get(self, PangoAttrList), attr); |
|
892 |
||
893 |
Py_INCREF(Py_None); |
|
894 |
return Py_None; |
|
895 |
}
|
|
896 |
%%
|
|
230
by jamesh
2001-09-19 James Henstridge <james@daa.com.au> |
897 |
ignore pango_font_description_from_string |
898 |
%%
|
|
899 |
override pango_font_description_new kwargs |
|
241
by jamesh
2001-09-29 James Henstridge <james@daa.com.au> |
900 |
static int |
230
by jamesh
2001-09-19 James Henstridge <james@daa.com.au> |
901 |
_wrap_pango_font_description_new(PyGBoxed *self, PyObject *args, |
902 |
PyObject *kwargs) |
|
903 |
{
|
|
904 |
static char *kwlist[] = { "str", NULL }; |
|
905 |
char *str = NULL; |
|
906 |
||
907 |
if (!PyArg_ParseTupleAndKeywords(args, kwargs, |
|
908 |
"|z:PangoFontDescription.__init__", |
|
909 |
kwlist, &str)) |
|
241
by jamesh
2001-09-29 James Henstridge <james@daa.com.au> |
910 |
return -1; |
230
by jamesh
2001-09-19 James Henstridge <james@daa.com.au> |
911 |
|
912 |
self->gtype = PANGO_TYPE_FONT_DESCRIPTION; |
|
913 |
self->free_on_dealloc = FALSE; |
|
914 |
if (str) |
|
915 |
self->boxed = pango_font_description_from_string(str); |
|
916 |
else
|
|
917 |
self->boxed = pango_font_description_new(); |
|
918 |
if (!self->boxed) { |
|
919 |
PyErr_SetString(PyExc_RuntimeError, |
|
920 |
"could not create PangoFontDescription object"); |
|
241
by jamesh
2001-09-29 James Henstridge <james@daa.com.au> |
921 |
return -1; |
230
by jamesh
2001-09-19 James Henstridge <james@daa.com.au> |
922 |
}
|
923 |
self->free_on_dealloc = TRUE; |
|
241
by jamesh
2001-09-29 James Henstridge <james@daa.com.au> |
924 |
return 0; |
230
by jamesh
2001-09-19 James Henstridge <james@daa.com.au> |
925 |
}
|
433
by jamesh
2002-03-16 James Henstridge <james@daa.com.au> |
926 |
%%
|
927 |
override-slot PangoFontDescription.tp_compare |
|
928 |
static int |
|
929 |
_wrap_pango_font_description_tp_compare(PyGBoxed *self, PyGBoxed *other) |
|
930 |
{
|
|
931 |
if (self->boxed == other->boxed || |
|
932 |
pango_font_description_equal(pyg_boxed_get(self, PangoFontDescription), |
|
933 |
pyg_boxed_get(other, PangoFontDescription))) |
|
934 |
return 0; |
|
935 |
if (self->boxed > other->boxed) |
|
936 |
return -1; |
|
937 |
return 1; |
|
938 |
}
|
|
939 |
%%
|
|
940 |
override-slot PangoFontDescription.tp_hash |
|
941 |
static long |
|
942 |
_wrap_pango_font_description_tp_hash(PyGBoxed *self) |
|
943 |
{
|
|
944 |
return (long)pango_font_description_hash( |
|
945 |
pyg_boxed_get(self, PangoFontDescription)); |
|
946 |
}
|
|
439
by jamesh
2002-03-17 James Henstridge <james@daa.com.au> |
947 |
%%
|
948 |
override pango_font_description_copy noargs |
|
949 |
static PyObject * |
|
950 |
_wrap_pango_font_description_copy(PyObject *self) |
|
951 |
{
|
|
952 |
return pyg_boxed_new(PANGO_TYPE_FONT_DESCRIPTION, |
|
953 |
pyg_boxed_get(self, PangoFontDescription), |
|
954 |
TRUE, TRUE); |
|
955 |
}
|
|
956 |
%%
|
|
957 |
override pango_context_list_families noargs |
|
958 |
static PyObject * |
|
959 |
_wrap_pango_context_list_families(PyGObject *self) |
|
960 |
{
|
|
961 |
PangoFontFamily **families; |
|
962 |
gint n_families, i; |
|
963 |
PyObject *ret; |
|
964 |
||
965 |
pango_context_list_families(PANGO_CONTEXT(self->obj), &families, |
|
966 |
&n_families); |
|
967 |
ret = PyTuple_New(n_families); |
|
968 |
for (i = 0; i < n_families; i++) { |
|
969 |
PyObject *family; |
|
970 |
||
971 |
family = pygobject_new((GObject *)families[i]); |
|
972 |
PyTuple_SetItem(ret, i, family); |
|
973 |
}
|
|
974 |
g_free(families); |
|
975 |
return ret; |
|
976 |
}
|
|
977 |
%%
|
|
978 |
override pango_font_get_glyph_extents kwargs |
|
979 |
static PyObject * |
|
980 |
_wrap_pango_font_get_glyph_extents(PyGObject *self, PyObject *args, |
|
981 |
PyObject *kwargs) |
|
982 |
{
|
|
983 |
static char *kwlist[] = { "glyph", NULL }; |
|
984 |
gint glyph; |
|
985 |
PangoRectangle ink_rect, logical_rect; |
|
986 |
||
987 |
if (!PyArg_ParseTupleAndKeywords(args, kwargs, |
|
988 |
"i:PangoFont.get_glyph_extents", kwlist, |
|
989 |
&glyph)) |
|
990 |
return NULL; |
|
991 |
pango_font_get_glyph_extents(PANGO_FONT(self->obj), (PangoGlyph)glyph, |
|
992 |
&ink_rect, &logical_rect); |
|
993 |
return Py_BuildValue("((iiii)(iiii))", |
|
994 |
ink_rect.x, ink_rect.y, |
|
995 |
ink_rect.width, ink_rect.height, |
|
996 |
logical_rect.x, logical_rect.y, |
|
997 |
logical_rect.width, logical_rect.height); |
|
998 |
}
|
|
999 |
%%
|
|
1000 |
override pango_font_family_list_faces noargs |
|
1001 |
static PyObject * |
|
1002 |
_wrap_pango_font_family_list_faces(PyGObject *self) |
|
1003 |
{
|
|
1004 |
PangoFontFace **faces; |
|
1005 |
gint n_faces, i; |
|
1006 |
PyObject *ret; |
|
1007 |
||
1008 |
pango_font_family_list_faces(PANGO_FONT_FAMILY(self->obj), |
|
1009 |
&faces, &n_faces); |
|
1010 |
ret = PyTuple_New(n_faces); |
|
1011 |
for (i = 0; i < n_faces; i++) { |
|
1012 |
PyObject *face; |
|
1013 |
||
1014 |
face = pygobject_new((GObject *)faces[i]); |
|
1015 |
PyTuple_SetItem(ret, i, face); |
|
1016 |
}
|
|
1017 |
g_free(faces); |
|
1018 |
return ret; |
|
1019 |
}
|
|
1020 |
%%
|
|
1021 |
override pango_font_map_list_families noargs |
|
1022 |
static PyObject * |
|
1023 |
_wrap_pango_font_map_list_families(PyGObject *self) |
|
1024 |
{
|
|
1025 |
PangoFontFamily **families; |
|
1026 |
gint n_families, i; |
|
1027 |
PyObject *ret; |
|
1028 |
||
1029 |
pango_font_map_list_families(PANGO_FONT_MAP(self->obj), &families, |
|
1030 |
&n_families); |
|
1031 |
ret = PyTuple_New(n_families); |
|
1032 |
for (i = 0; i < n_families; i++) { |
|
1033 |
PyObject *family; |
|
1034 |
||
1035 |
family = pygobject_new((GObject *)families[i]); |
|
1036 |
PyTuple_SetItem(ret, i, family); |
|
1037 |
}
|
|
1038 |
g_free(families); |
|
1039 |
return ret; |
|
1040 |
}
|
|
1041 |
%%
|
|
440
by jamesh
2002-03-18 James Henstridge <james@daa.com.au> |
1042 |
override pango_glyph_string_extents kwargs |
439
by jamesh
2002-03-17 James Henstridge <james@daa.com.au> |
1043 |
static PyObject * |
440
by jamesh
2002-03-18 James Henstridge <james@daa.com.au> |
1044 |
_wrap_pango_glyph_string_extents(PyObject *self, PyObject *args, |
1045 |
PyObject *kwargs) |
|
439
by jamesh
2002-03-17 James Henstridge <james@daa.com.au> |
1046 |
{
|
440
by jamesh
2002-03-18 James Henstridge <james@daa.com.au> |
1047 |
static char *kwlist[] = { "font", NULL }; |
1048 |
PyObject *font; |
|
1049 |
PangoRectangle ink_rect, logical_rect; |
|
1050 |
||
1051 |
if (!PyArg_ParseTupleAndKeywords(args, kwargs, |
|
1052 |
"O:PangoGlyphString.extents", kwlist, |
|
1053 |
&font)) |
|
1054 |
return NULL; |
|
1055 |
if (!pygobject_check(font, &PyPangoFont_Type)) { |
|
1056 |
PyErr_SetString(PyExc_TypeError, "font must be a PangoFont"); |
|
1057 |
return NULL; |
|
1058 |
}
|
|
1059 |
||
1060 |
pango_glyph_string_extents(pyg_boxed_get(self, PangoGlyphString), |
|
1061 |
PANGO_FONT(pygobject_get(font)), |
|
1062 |
&ink_rect, &logical_rect); |
|
1063 |
||
1064 |
return Py_BuildValue("((iiii)(iiii))", |
|
1065 |
ink_rect.x, ink_rect.y, |
|
1066 |
ink_rect.width, ink_rect.height, |
|
1067 |
logical_rect.x, logical_rect.y, |
|
1068 |
logical_rect.width, logical_rect.height); |
|
439
by jamesh
2002-03-17 James Henstridge <james@daa.com.au> |
1069 |
}
|
1070 |
%%
|
|
440
by jamesh
2002-03-18 James Henstridge <james@daa.com.au> |
1071 |
override pango_glyph_string_extents_range kwargs |
439
by jamesh
2002-03-17 James Henstridge <james@daa.com.au> |
1072 |
static PyObject * |
440
by jamesh
2002-03-18 James Henstridge <james@daa.com.au> |
1073 |
_wrap_pango_glyph_string_extents_range(PyObject *self, PyObject *args, |
1074 |
PyObject *kwargs) |
|
439
by jamesh
2002-03-17 James Henstridge <james@daa.com.au> |
1075 |
{
|
440
by jamesh
2002-03-18 James Henstridge <james@daa.com.au> |
1076 |
static char *kwlist[] = { "start", "end", "font", NULL }; |
1077 |
gint start, end; |
|
1078 |
PyObject *font; |
|
1079 |
PangoRectangle ink_rect, logical_rect; |
|
1080 |
||
1081 |
if (!PyArg_ParseTupleAndKeywords(args, kwargs, |
|
1082 |
"iiO:PangoGlyphString.extents_range", |
|
1083 |
kwlist, &start, &end, &font)) |
|
1084 |
return NULL; |
|
1085 |
if (!pygobject_check(font, &PyPangoFont_Type)) { |
|
1086 |
PyErr_SetString(PyExc_TypeError, "font must be a PangoFont"); |
|
1087 |
return NULL; |
|
439
by jamesh
2002-03-17 James Henstridge <james@daa.com.au> |
1088 |
}
|
440
by jamesh
2002-03-18 James Henstridge <james@daa.com.au> |
1089 |
|
1090 |
pango_glyph_string_extents_range(pyg_boxed_get(self, PangoGlyphString), |
|
1091 |
start, end, |
|
1092 |
PANGO_FONT(pygobject_get(font)), |
|
1093 |
&ink_rect, &logical_rect); |
|
1094 |
||
1095 |
return Py_BuildValue("((iiii)(iiii))", |
|
1096 |
ink_rect.x, ink_rect.y, |
|
1097 |
ink_rect.width, ink_rect.height, |
|
1098 |
logical_rect.x, logical_rect.y, |
|
1099 |
logical_rect.width, logical_rect.height); |
|
439
by jamesh
2002-03-17 James Henstridge <james@daa.com.au> |
1100 |
}
|
1101 |
%%
|
|
448
by jamesh
2002-04-10 James Henstridge <james@daa.com.au> |
1102 |
override pango_glyph_string_get_logical_widths kwargs |
1103 |
static PyObject * |
|
1104 |
_wrap_pango_glyph_string_get_logical_widths(PyObject *self, PyObject *args, |
|
1105 |
PyObject *kwargs) |
|
1106 |
{
|
|
1107 |
static char *kwlist[] = { "text", "embedding_level", NULL }; |
|
1108 |
const char *text; |
|
1109 |
gint length, embedding_level, *logical_widths; |
|
2502
by gjc
Bug 337368 â Make PyGTK work with Python 2.5 and 64-bit |
1110 |
Py_ssize_t i, slen; |
448
by jamesh
2002-04-10 James Henstridge <james@daa.com.au> |
1111 |
PyObject *ret; |
1112 |
||
1113 |
if (!PyArg_ParseTupleAndKeywords(args, kwargs, |
|
1114 |
"s#i:PangoGlyphString.get_logical_widths", |
|
1115 |
kwlist, &text, &length, &embedding_level)) |
|
1116 |
return NULL; |
|
1117 |
slen = g_utf8_strlen(text, length); |
|
1118 |
logical_widths = g_new(int, slen); |
|
1119 |
pango_glyph_string_get_logical_widths(pyg_boxed_get(self,PangoGlyphString), |
|
1120 |
text, length, embedding_level, |
|
1121 |
logical_widths); |
|
1122 |
ret = PyTuple_New(slen); |
|
1123 |
for (i = 0; i < slen; i++) { |
|
1124 |
PyObject *item = PyInt_FromLong(logical_widths[i]); |
|
1125 |
||
1126 |
PyTuple_SetItem(ret, i, item); |
|
1127 |
}
|
|
1128 |
g_free(logical_widths); |
|
1129 |
return ret; |
|
1130 |
}
|
|
1131 |
%%
|
|
439
by jamesh
2002-03-17 James Henstridge <james@daa.com.au> |
1132 |
override pango_layout_set_markup kwargs |
1133 |
static PyObject * |
|
1134 |
_wrap_pango_layout_set_markup(PyGObject *self, PyObject *args,PyObject *kwargs) |
|
1135 |
{
|
|
1136 |
static char *kwlist[] = { "markup", NULL }; |
|
1137 |
char *markup; |
|
2502
by gjc
Bug 337368 â Make PyGTK work with Python 2.5 and 64-bit |
1138 |
Py_ssize_t length; |
439
by jamesh
2002-03-17 James Henstridge <james@daa.com.au> |
1139 |
|
1140 |
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#:PangoLayout.set_markup", |
|
1141 |
kwlist, &markup, &length)) |
|
1142 |
return NULL; |
|
1143 |
||
1144 |
pango_layout_set_markup(PANGO_LAYOUT(self->obj), markup, length); |
|
1145 |
||
1146 |
Py_INCREF(Py_None); |
|
1147 |
return Py_None; |
|
1148 |
}
|
|
1149 |
%%
|
|
1150 |
override pango_layout_set_markup_with_accel kwargs |
|
1151 |
static PyObject * |
|
1152 |
_wrap_pango_layout_set_markup_with_accel(PyGObject *self, PyObject *args, |
|
1153 |
PyObject *kwargs) |
|
1154 |
{
|
|
1155 |
static char *kwlist[] = { "markup", "accel_marker", NULL }; |
|
1156 |
char *markup; |
|
2502
by gjc
Bug 337368 â Make PyGTK work with Python 2.5 and 64-bit |
1157 |
Py_ssize_t length, accel_length; |
439
by jamesh
2002-03-17 James Henstridge <james@daa.com.au> |
1158 |
Py_UNICODE *accel_marker, pychr; |
1159 |
gunichar accel_char; |
|
1160 |
||
1161 |
if (!PyArg_ParseTupleAndKeywords(args, kwargs, |
|
1162 |
"s#u#:PangoLayout.set_markup_with_accel", |
|
1163 |
kwlist, &markup, &length, |
|
1164 |
&accel_marker, &accel_length)) |
|
1165 |
return NULL; |
|
1166 |
if (accel_length != 1) { |
|
1167 |
PyErr_SetString(PyExc_TypeError, "accel_marker must be a unicode string of length 1"); |
|
1168 |
return NULL; |
|
1169 |
}
|
|
1170 |
pango_layout_set_markup_with_accel(PANGO_LAYOUT(self->obj), markup, length, |
|
1171 |
(gunichar)accel_marker[0], &accel_char); |
|
1172 |
||
1173 |
#if !defined(Py_UNICODE_SIZE) || Py_UNICODE_SIZE == 2
|
|
1174 |
if (accel_char >= 0xffff) { |
|
1175 |
PyErr_SetString(PyExc_ValueError, "unicode character is too big to fit in a 16-bit unicode character"); |
|
1176 |
return NULL; |
|
1177 |
}
|
|
1178 |
#endif
|
|
1179 |
pychr = (Py_UNICODE)accel_char; |
|
1180 |
return PyUnicode_FromUnicode(&pychr, 1); |
|
1181 |
}
|
|
1182 |
%%
|
|
440
by jamesh
2002-03-18 James Henstridge <james@daa.com.au> |
1183 |
override pango_layout_index_to_pos kwargs |
439
by jamesh
2002-03-17 James Henstridge <james@daa.com.au> |
1184 |
static PyObject * |
1185 |
_wrap_pango_layout_index_to_pos(PyGObject *self, PyObject *args, |
|
1186 |
PyObject *kwargs) |
|
1187 |
{
|
|
1188 |
static char *kwlist[] = { "index", NULL }; |
|
1189 |
gint index; |
|
1190 |
PangoRectangle pos; |
|
1191 |
||
1192 |
if (!PyArg_ParseTupleAndKeywords(args, kwargs, |
|
1193 |
"i:PangoLayout.index_to_pos", kwlist, |
|
1194 |
&index)) |
|
1195 |
return NULL; |
|
1196 |
||
1197 |
pango_layout_index_to_pos(PANGO_LAYOUT(self->obj), index, &pos); |
|
1198 |
return Py_BuildValue("(iiii)", pos.x, pos.y, pos.width, pos.height); |
|
1199 |
}
|
|
1200 |
%%
|
|
440
by jamesh
2002-03-18 James Henstridge <james@daa.com.au> |
1201 |
override pango_layout_get_cursor_pos kwargs |
439
by jamesh
2002-03-17 James Henstridge <james@daa.com.au> |
1202 |
static PyObject * |
1203 |
_wrap_pango_layout_get_cursor_pos(PyGObject *self, PyObject *args, |
|
440
by jamesh
2002-03-18 James Henstridge <james@daa.com.au> |
1204 |
PyObject *kwargs) |
439
by jamesh
2002-03-17 James Henstridge <james@daa.com.au> |
1205 |
{
|
1206 |
static char *kwlist[] = { "index", NULL }; |
|
1207 |
gint index; |
|
1208 |
PangoRectangle strong_pos, weak_pos; |
|
1209 |
||
1210 |
if (!PyArg_ParseTupleAndKeywords(args, kwargs, |
|
1211 |
"i:PangoLayout.get_cursor_pos", kwlist, |
|
1212 |
&index)) |
|
1213 |
return NULL; |
|
1214 |
||
1215 |
pango_layout_get_cursor_pos(PANGO_LAYOUT(self->obj), index, |
|
1216 |
&strong_pos, &weak_pos); |
|
1217 |
return Py_BuildValue("((iiii)(iiii))", |
|
1218 |
strong_pos.x, strong_pos.y, |
|
1219 |
strong_pos.width, strong_pos.height, |
|
1220 |
weak_pos.x, weak_pos.y, |
|
1221 |
weak_pos.width, weak_pos.height); |
|
1222 |
}
|
|
440
by jamesh
2002-03-18 James Henstridge <james@daa.com.au> |
1223 |
%%
|
1224 |
override pango_layout_move_cursor_visually kwargs |
|
1225 |
static PyObject * |
|
1226 |
_wrap_pango_layout_move_cursor_visually(PyGObject *self, PyObject *args, |
|
1227 |
PyObject *kwargs) |
|
1228 |
{
|
|
1229 |
static char *kwlist[] = { "strong", "old_index", "old_trailing", "direction", NULL }; |
|
1230 |
gboolean strong; |
|
1231 |
gint old_index, old_trailing, direction, new_index = 0, new_trailing = 0; |
|
1232 |
||
1233 |
if (!PyArg_ParseTupleAndKeywords(args, kwargs, |
|
1234 |
"iiii:PangoLayout.move_cursor_visually", |
|
1235 |
kwlist, &strong, &old_index, |
|
1236 |
&old_trailing, &direction)) |
|
1237 |
return NULL; |
|
1238 |
||
1239 |
pango_layout_move_cursor_visually(PANGO_LAYOUT(self->obj), strong, |
|
1240 |
old_index, old_trailing, direction, |
|
1241 |
&new_index, &new_trailing); |
|
1242 |
return Py_BuildValue("(ii)", new_index, new_trailing); |
|
1243 |
}
|
|
1244 |
%%
|
|
1245 |
override pango_layout_xy_to_index kwargs |
|
1246 |
static PyObject * |
|
1247 |
_wrap_pango_layout_xy_to_index(PyGObject *self, PyObject *args, |
|
1248 |
PyObject *kwargs) |
|
1249 |
{
|
|
1250 |
static char *kwlist[] = { "x", "y", NULL }; |
|
1251 |
gint x, y, index, trailing; |
|
1252 |
||
1253 |
if (!PyArg_ParseTupleAndKeywords(args, kwargs, |
|
1254 |
"ii:PangoLayout.xy_to_index", kwlist, |
|
1255 |
&x, &y)) |
|
1256 |
return NULL; |
|
1257 |
||
1258 |
pango_layout_xy_to_index(PANGO_LAYOUT(self->obj), x, y, &index, &trailing); |
|
1259 |
||
1260 |
return Py_BuildValue("(ii)", index, trailing); |
|
1261 |
}
|
|
1262 |
%%
|
|
1263 |
override pango_layout_get_extents noargs |
|
1264 |
static PyObject * |
|
1265 |
_wrap_pango_layout_get_extents(PyGObject *self) |
|
1266 |
{
|
|
1267 |
PangoRectangle ink_rect, logical_rect; |
|
1268 |
||
1269 |
pango_layout_get_extents(PANGO_LAYOUT(self->obj), |
|
1270 |
&ink_rect, &logical_rect); |
|
1271 |
||
1272 |
return Py_BuildValue("((iiii)(iiii))", |
|
1273 |
ink_rect.x, ink_rect.y, |
|
1274 |
ink_rect.width, ink_rect.height, |
|
1275 |
logical_rect.x, logical_rect.y, |
|
1276 |
logical_rect.width, logical_rect.height); |
|
1277 |
}
|
|
1278 |
%%
|
|
1279 |
override pango_layout_get_pixel_extents noargs |
|
1280 |
static PyObject * |
|
1281 |
_wrap_pango_layout_get_pixel_extents(PyGObject *self) |
|
1282 |
{
|
|
1283 |
PangoRectangle ink_rect, logical_rect; |
|
1284 |
||
577
by jamesh
2002-11-16 James Henstridge <james@daa.com.au> |
1285 |
pango_layout_get_pixel_extents(PANGO_LAYOUT(self->obj), |
1286 |
&ink_rect, &logical_rect); |
|
440
by jamesh
2002-03-18 James Henstridge <james@daa.com.au> |
1287 |
|
1288 |
return Py_BuildValue("((iiii)(iiii))", |
|
1289 |
ink_rect.x, ink_rect.y, |
|
1290 |
ink_rect.width, ink_rect.height, |
|
1291 |
logical_rect.x, logical_rect.y, |
|
1292 |
logical_rect.width, logical_rect.height); |
|
1293 |
}
|
|
1294 |
%%
|
|
1295 |
override pango_layout_get_size noargs |
|
1296 |
static PyObject * |
|
1297 |
_wrap_pango_layout_get_size(PyGObject *self) |
|
1298 |
{
|
|
1299 |
gint width, height; |
|
1300 |
||
1301 |
pango_layout_get_size(PANGO_LAYOUT(self->obj), &width, &height); |
|
1302 |
||
1303 |
return Py_BuildValue("(ii)", width, height); |
|
1304 |
}
|
|
1305 |
%%
|
|
1306 |
override pango_layout_get_pixel_size noargs |
|
1307 |
static PyObject * |
|
1308 |
_wrap_pango_layout_get_pixel_size(PyGObject *self) |
|
1309 |
{
|
|
1310 |
gint width, height; |
|
1311 |
||
1312 |
pango_layout_get_pixel_size(PANGO_LAYOUT(self->obj), &width, &height); |
|
1313 |
||
1314 |
return Py_BuildValue("(ii)", width, height); |
|
1315 |
}
|
|
1316 |
%%
|
|
448
by jamesh
2002-04-10 James Henstridge <james@daa.com.au> |
1317 |
override pango_parse_markup kwargs |
1318 |
static PyObject * |
|
1319 |
_wrap_pango_parse_markup(PyObject *self, PyObject *args, PyObject *kwargs) |
|
1320 |
{
|
|
1321 |
static char *kwlist[] = { "markup_text", "accel_marker", NULL }; |
|
1322 |
char *markup_text, *text = NULL; |
|
2502
by gjc
Bug 337368 â Make PyGTK work with Python 2.5 and 64-bit |
1323 |
Py_ssize_t length; |
2156
by johan
* pango.override: |
1324 |
Py_UNICODE *py_accel_marker = NULL, py_accel_char; |
2502
by gjc
Bug 337368 â Make PyGTK work with Python 2.5 and 64-bit |
1325 |
Py_ssize_t py_accel_marker_len; |
448
by jamesh
2002-04-10 James Henstridge <james@daa.com.au> |
1326 |
gunichar accel_marker, accel_char = 0; |
1327 |
PangoAttrList *attr_list = NULL; |
|
1328 |
GError *error = NULL; |
|
1329 |
gboolean ret; |
|
1330 |
PyObject *py_ret; |
|
1331 |
||
2156
by johan
* pango.override: |
1332 |
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#|u#:pango.parse_markup", |
448
by jamesh
2002-04-10 James Henstridge <james@daa.com.au> |
1333 |
kwlist, &markup_text, &length, |
1334 |
&py_accel_marker, &py_accel_marker_len)) |
|
1335 |
return NULL; |
|
2156
by johan
* pango.override: |
1336 |
if (py_accel_marker != NULL) { |
1337 |
if (py_accel_marker_len != 1) { |
|
1338 |
PyErr_SetString(PyExc_TypeError, "accel_mark must be one character"); |
|
1339 |
return NULL; |
|
1340 |
}
|
|
1341 |
accel_marker = py_accel_marker[0]; |
|
1342 |
} else |
|
1343 |
accel_marker = 0; |
|
1344 |
||
448
by jamesh
2002-04-10 James Henstridge <james@daa.com.au> |
1345 |
ret = pango_parse_markup(markup_text, length, accel_marker, |
1346 |
&attr_list, &text, &accel_char, &error); |
|
1347 |
if (pyg_error_check(&error)) |
|
1348 |
return NULL; |
|
1349 |
||
1350 |
#if !defined(Py_UNICODE_SIZE) || Py_UNICODE_SIZE == 2
|
|
1351 |
if (accel_char >= 0xffff) { |
|
1352 |
PyErr_SetString(PyExc_ValueError, "unicode character is too big to fit in a 16-bit unicode character"); |
|
1353 |
return NULL; |
|
1354 |
}
|
|
1355 |
#endif
|
|
1356 |
py_accel_char = (Py_UNICODE)accel_char; |
|
1357 |
||
1358 |
py_ret = Py_BuildValue("(Nsu#)", pyg_boxed_new(PANGO_TYPE_ATTR_LIST, |
|
1359 |
attr_list, FALSE, TRUE), |
|
2502
by gjc
Bug 337368 â Make PyGTK work with Python 2.5 and 64-bit |
1360 |
text, &py_accel_char, (Py_ssize_t) 1); |
448
by jamesh
2002-04-10 James Henstridge <james@daa.com.au> |
1361 |
g_free(text); |
1362 |
return py_ret; |
|
1363 |
}
|
|
1364 |
%%
|
|
440
by jamesh
2002-03-18 James Henstridge <james@daa.com.au> |
1365 |
override pango_tab_array_get_tab kwargs |
1366 |
static PyObject * |
|
1367 |
_wrap_pango_tab_array_get_tab(PyObject *self, PyObject *args, PyObject *kwargs) |
|
1368 |
{
|
|
1369 |
static char *kwlist[] = { "tab_index", NULL }; |
|
1370 |
gint tab_index, location; |
|
1371 |
PangoTabAlign alignment; |
|
1372 |
||
1373 |
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:PangoTabArray.get_tab", |
|
1374 |
kwlist, &tab_index)) |
|
1375 |
return NULL; |
|
1376 |
||
1377 |
pango_tab_array_get_tab(pyg_boxed_get(self, PangoTabArray), |
|
1378 |
tab_index, &alignment, &location); |
|
1379 |
return Py_BuildValue("(ii)", (int)alignment, location); |
|
1380 |
}
|
|
1381 |
%%
|
|
1382 |
override pango_tab_array_get_tabs noargs |
|
1383 |
static PyObject * |
|
1384 |
_wrap_pango_tab_array_get_tabs(PyObject *self) |
|
1385 |
{
|
|
1386 |
PangoTabAlign *alignments; |
|
1387 |
gint *locations, length, i; |
|
1388 |
PyObject *ret; |
|
1389 |
||
1390 |
length = pango_tab_array_get_size(pyg_boxed_get(self, PangoTabArray)); |
|
1391 |
pango_tab_array_get_tabs(pyg_boxed_get(self, PangoTabArray), |
|
1392 |
&alignments, &locations); |
|
1393 |
ret = PyTuple_New(length); |
|
1394 |
for (i = 0; i < length; i++) { |
|
1395 |
PyObject *item; |
|
1396 |
||
1397 |
item = Py_BuildValue("(ii)", (int)alignments[i], locations[i]); |
|
1398 |
PyTuple_SetItem(ret, i, item); |
|
1399 |
}
|
|
2243
by johan
* pango.override (_wrap_pango_tab_array_get_tabs): Fix two |
1400 |
g_free(alignments); |
1401 |
g_free(locations); |
|
440
by jamesh
2002-03-18 James Henstridge <james@daa.com.au> |
1402 |
return ret; |
1403 |
}
|
|
673
by zilch
* gtk/gdk.defs (invalidate_rect): Null is okay here. |
1404 |
%%
|
1405 |
override pango_layout_set_text kwargs |
|
1406 |
static PyObject * |
|
1407 |
_wrap_pango_layout_set_text(PyGObject *self, PyObject *args, PyObject *kwargs) |
|
1408 |
{
|
|
1409 |
static char *kwlist[] = { "text", NULL }; |
|
1410 |
char *text; |
|
2502
by gjc
Bug 337368 â Make PyGTK work with Python 2.5 and 64-bit |
1411 |
Py_ssize_t length; |
673
by zilch
* gtk/gdk.defs (invalidate_rect): Null is okay here. |
1412 |
|
1413 |
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#:PangoLayout.set_text", |
|
1414 |
kwlist, &text, &length)) |
|
1415 |
return NULL; |
|
1416 |
pango_layout_set_text(PANGO_LAYOUT(self->obj), text, length); |
|
1417 |
Py_INCREF(Py_None); |
|
1418 |
return Py_None; |
|
1419 |
}
|
|
755
by finlay
* pango.defs (pango_color_parse) Make this a constructor for |
1420 |
%%
|
1421 |
override pango_color_parse kwargs |
|
1422 |
static int |
|
1423 |
_wrap_pango_color_parse(PyGBoxed *self, PyObject *args, PyObject *kwargs) |
|
1424 |
{
|
|
1425 |
static char *kwlist[] = { "spec", NULL }; |
|
1426 |
char *spec; |
|
1427 |
PangoColor color; |
|
1428 |
||
1429 |
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s:PangoColor.__init__", |
|
1430 |
kwlist, &spec)) |
|
1431 |
return -1; |
|
1432 |
||
1433 |
self->gtype = PANGO_TYPE_COLOR; |
|
1434 |
self->free_on_dealloc = FALSE; |
|
1435 |
||
1436 |
if (pango_color_parse(&color, spec) != TRUE |
|
1437 |
|| !(self->boxed = pango_color_copy(&color))) { |
|
1438 |
PyErr_SetString(PyExc_RuntimeError, |
|
1439 |
"could not create PangoColor object"); |
|
1440 |
return -1; |
|
1441 |
}
|
|
1442 |
||
1443 |
self->free_on_dealloc = TRUE; |
|
1444 |
||
1445 |
return 0; |
|
1446 |
}
|
|
758
by finlay
* pango.override (PangoAttrIterator) Add this type and its methods. |
1447 |
%%
|
1448 |
override pango_attr_list_get_iterator noargs |
|
1449 |
static PyObject * |
|
1450 |
_wrap_pango_attr_list_get_iterator(PyGBoxed *self) |
|
1451 |
{
|
|
1452 |
PangoAttrList *list = pyg_boxed_get(self, PangoAttrList); |
|
1453 |
PangoAttrIterator *iter = pango_attr_list_get_iterator(list); |
|
1454 |
||
1455 |
return pypango_attr_iterator_new(iter); |
|
1456 |
}
|
|
759
by finlay
* pango.override (_wrap_PANGO_ASCENT, _wrap_PANGO_DESCENT) |
1457 |
%%
|
1458 |
override PANGO_ASCENT kwargs |
|
1459 |
static PyObject * |
|
1460 |
_wrap_PANGO_ASCENT(PyObject *self, PyObject *args, PyObject *kwargs) |
|
1461 |
{
|
|
1462 |
static char *kwlist[] = { "rect", NULL }; |
|
1463 |
int ret; |
|
1464 |
PangoRectangle rect; |
|
1465 |
PyObject *py_rect; |
|
1466 |
||
1467 |
if (PyArg_ParseTupleAndKeywords(args, kwargs, "O!:ASCENT", |
|
1468 |
kwlist, &PyTuple_Type, &py_rect) |
|
1469 |
&& PyArg_ParseTuple(py_rect, "iiii:ASCENT", &rect.x, &rect.y, |
|
1470 |
&rect.width, &rect.height)) { |
|
1471 |
ret = PANGO_ASCENT(rect); |
|
1472 |
return PyInt_FromLong(ret); |
|
1473 |
}
|
|
1474 |
PyErr_Clear(); |
|
1475 |
PyErr_SetString(PyExc_ValueError, "rect must be a 4-tuple of integers"); |
|
1476 |
return NULL; |
|
1477 |
}
|
|
1478 |
%%
|
|
1479 |
override PANGO_DESCENT kwargs |
|
1480 |
static PyObject * |
|
1481 |
_wrap_PANGO_DESCENT(PyObject *self, PyObject *args, PyObject *kwargs) |
|
1482 |
{
|
|
1483 |
static char *kwlist[] = { "rect", NULL }; |
|
1484 |
int ret; |
|
1485 |
PangoRectangle rect; |
|
1486 |
PyObject *py_rect; |
|
1487 |
||
1488 |
if (PyArg_ParseTupleAndKeywords(args, kwargs, "O!:DESCENT", |
|
1489 |
kwlist, &PyTuple_Type, &py_rect) |
|
1490 |
&& PyArg_ParseTuple(py_rect, "iiii:DESCENT", &rect.x, &rect.y, |
|
1491 |
&rect.width, &rect.height)) { |
|
1492 |
ret = PANGO_DESCENT(rect); |
|
1493 |
return PyInt_FromLong(ret); |
|
1494 |
}
|
|
1495 |
PyErr_Clear(); |
|
1496 |
PyErr_SetString(PyExc_ValueError, "rect must be a 4-tuple of integers"); |
|
1497 |
return NULL; |
|
1498 |
}
|
|
1499 |
%%
|
|
1500 |
override PANGO_LBEARING kwargs |
|
1501 |
static PyObject * |
|
1502 |
_wrap_PANGO_LBEARING(PyObject *self, PyObject *args, PyObject *kwargs) |
|
1503 |
{
|
|
1504 |
static char *kwlist[] = { "rect", NULL }; |
|
1505 |
int ret; |
|
1506 |
PangoRectangle rect; |
|
1507 |
PyObject *py_rect; |
|
1508 |
||
1509 |
if (PyArg_ParseTupleAndKeywords(args, kwargs, "O!:LBEARING", |
|
1510 |
kwlist, &PyTuple_Type, &py_rect) |
|
1511 |
&& PyArg_ParseTuple(py_rect, "iiii:LBEARING", &rect.x, &rect.y, |
|
1512 |
&rect.width, &rect.height)) { |
|
1513 |
ret = PANGO_LBEARING(rect); |
|
1514 |
return PyInt_FromLong(ret); |
|
1515 |
}
|
|
1516 |
PyErr_Clear(); |
|
1517 |
PyErr_SetString(PyExc_ValueError, "rect must be a 4-tuple of integers"); |
|
1518 |
return NULL; |
|
1519 |
}
|
|
1520 |
%%
|
|
1521 |
override PANGO_RBEARING kwargs |
|
1522 |
static PyObject * |
|
1523 |
_wrap_PANGO_RBEARING(PyObject *self, PyObject *args, PyObject *kwargs) |
|
1524 |
{
|
|
1525 |
static char *kwlist[] = { "rect", NULL }; |
|
1526 |
int ret; |
|
1527 |
PangoRectangle rect; |
|
1528 |
PyObject *py_rect; |
|
1529 |
||
1530 |
if (PyArg_ParseTupleAndKeywords(args, kwargs, "O!:RBEARING", |
|
1531 |
kwlist, &PyTuple_Type, &py_rect) |
|
1532 |
&& PyArg_ParseTuple(py_rect, "iiii:RBEARING", &rect.x, &rect.y, |
|
1533 |
&rect.width, &rect.height)) { |
|
1534 |
ret = PANGO_RBEARING(rect); |
|
1535 |
return PyInt_FromLong(ret); |
|
1536 |
}
|
|
1537 |
PyErr_Clear(); |
|
1538 |
PyErr_SetString(PyExc_ValueError, "rect must be a 4-tuple of integers"); |
|
1539 |
return NULL; |
|
1540 |
}
|
|
1155
by finlay
* pango.defs (pango_attr_fallback_new) Add definition for AttrFallback. |
1541 |
%%
|
1542 |
override pango_attr_fallback_new kwargs |
|
1543 |
static PyObject * |
|
1544 |
_wrap_pango_attr_fallback_new(PyObject *self, PyObject *args, PyObject *kwargs) |
|
1545 |
{
|
|
1546 |
static char *kwlist[] = { "fallback", "start_index", "end_index", NULL }; |
|
1547 |
gboolean fallback; |
|
1548 |
guint start = 0, end = 1; |
|
1549 |
||
1550 |
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i|ii:PangoAttrFallback", |
|
1551 |
kwlist, &fallback, &start, &end)) |
|
1552 |
return NULL; |
|
1553 |
||
1554 |
return pypango_attr_new(pango_attr_fallback_new(fallback), |
|
1555 |
start, end); |
|
1556 |
}
|
|
1159
by finlay
* pango.override (_wrap_pango_attr_list_filter) Add. |
1557 |
%%
|
1558 |
override pango_attr_list_filter kwargs |
|
1559 |
static gboolean |
|
1560 |
pypango_attr_list_filter_cb(PangoAttribute *attr, gpointer data) |
|
1561 |
{
|
|
1544
by johan
* gobject/gobjectmodule.c (initgobject): Call |
1562 |
PyGILState_STATE state; |
1159
by finlay
* pango.override (_wrap_pango_attr_list_filter) Add. |
1563 |
PyGtkCustomNotify *cunote = data; |
1564 |
PyObject *retobj, *py_attr; |
|
1565 |
gboolean ret = FALSE; |
|
1566 |
||
1559
by gcarneiro
make threading runtime optional |
1567 |
state = pyg_gil_state_ensure(); |
1159
by finlay
* pango.override (_wrap_pango_attr_list_filter) Add. |
1568 |
|
1569 |
py_attr = pypango_attr_new(pango_attribute_copy(attr), |
|
1570 |
attr->start_index, attr->end_index); |
|
1571 |
||
1572 |
if (cunote->data) |
|
1573 |
retobj = PyObject_CallFunction(cunote->func, "NO", py_attr, |
|
1574 |
cunote->data); |
|
1575 |
else
|
|
1576 |
retobj = PyObject_CallFunction(cunote->func, "N", py_attr); |
|
1577 |
||
1578 |
if (retobj != NULL) { |
|
1579 |
ret = PyObject_IsTrue(retobj); |
|
1580 |
Py_DECREF(retobj); |
|
1581 |
} else { |
|
1582 |
PyErr_Print(); |
|
1583 |
}
|
|
1584 |
||
1559
by gcarneiro
make threading runtime optional |
1585 |
pyg_gil_state_release(state); |
1159
by finlay
* pango.override (_wrap_pango_attr_list_filter) Add. |
1586 |
return ret; |
1587 |
}
|
|
1588 |
static PyObject * |
|
1589 |
_wrap_pango_attr_list_filter(PyGBoxed *self, PyObject *args, PyObject *kwargs) |
|
1590 |
{
|
|
1591 |
static char *kwlist[] = { "func", "data", NULL }; |
|
1592 |
PyObject *py_func, *py_data = NULL; |
|
1593 |
PangoAttrList *attr_list, *filtered_list; |
|
1594 |
PyGtkCustomNotify cunote; |
|
1595 |
||
1596 |
if (!PyArg_ParseTupleAndKeywords(args, kwargs, |
|
1597 |
"O|O:pango.AttrList.filter", |
|
1598 |
kwlist, &py_func, &py_data)) |
|
1599 |
return NULL; |
|
1600 |
||
1601 |
if (!PyCallable_Check(py_func)) { |
|
1602 |
PyErr_SetString(PyExc_TypeError, "func must be callable"); |
|
1603 |
return NULL; |
|
1604 |
}
|
|
1605 |
||
1606 |
cunote.func = py_func; |
|
1607 |
cunote.data = py_data; |
|
1608 |
Py_INCREF(cunote.func); |
|
1609 |
Py_XINCREF(cunote.data); |
|
1610 |
||
1611 |
attr_list = (PangoAttrList *)pyg_boxed_get(self, PangoAttrList); |
|
1612 |
filtered_list = pango_attr_list_filter(attr_list, |
|
1613 |
pypango_attr_list_filter_cb, |
|
1614 |
(gpointer)&cunote); |
|
1615 |
||
1616 |
Py_DECREF(cunote.func); |
|
1617 |
Py_XDECREF(cunote.data); |
|
1618 |
||
1619 |
if (filtered_list) |
|
1620 |
return pyg_boxed_new(PANGO_TYPE_ATTR_LIST, filtered_list, FALSE, TRUE); |
|
1621 |
||
1622 |
Py_INCREF(Py_None); |
|
1623 |
return Py_None; |
|
1624 |
}
|
|
1162
by finlay
* pango.defs (pango_font_face_list_sizes) Add definition. |
1625 |
%%
|
1626 |
override pango_font_face_list_sizes noargs |
|
1627 |
static PyObject * |
|
1628 |
_wrap_pango_font_face_list_sizes(PyGObject *self) |
|
1629 |
{
|
|
1630 |
PyObject *py_sizes; |
|
1631 |
int *sizes, n_sizes, i; |
|
1632 |
||
1633 |
pango_font_face_list_sizes(PANGO_FONT_FACE(self->obj), &sizes, &n_sizes); |
|
1634 |
||
1635 |
||
1636 |
if (!sizes) { |
|
1637 |
Py_INCREF(Py_None); |
|
1638 |
return Py_None; |
|
1639 |
}
|
|
1640 |
||
1641 |
py_sizes = PyTuple_New(n_sizes); |
|
1642 |
||
1643 |
for (i = 0; i < n_sizes; i++) |
|
1644 |
PyTuple_SetItem(py_sizes, i, PyInt_FromLong(sizes[i])); |
|
1645 |
||
1646 |
g_free(sizes); |
|
1647 |
||
1648 |
return py_sizes; |
|
1649 |
}
|
|
1167
by finlay
* pango.defs (pango_fontset_foreach) Add definition. |
1650 |
%%
|
1651 |
override pango_fontset_foreach kwargs |
|
1652 |
static gboolean |
|
1653 |
pypango_fontset_foreach_cb(PangoFontset *fontset, PangoFont *font, |
|
1654 |
gpointer data) |
|
1655 |
{
|
|
1544
by johan
* gobject/gobjectmodule.c (initgobject): Call |
1656 |
PyGILState_STATE state; |
1167
by finlay
* pango.defs (pango_fontset_foreach) Add definition. |
1657 |
PyGtkCustomNotify *cunote = data; |
1658 |
PyObject *retobj, *py_font, *py_fontset; |
|
1659 |
gboolean ret = FALSE; |
|
1660 |
||
1559
by gcarneiro
make threading runtime optional |
1661 |
state = pyg_gil_state_ensure(); |
1167
by finlay
* pango.defs (pango_fontset_foreach) Add definition. |
1662 |
|
1663 |
py_fontset = pygobject_new((GObject *)fontset); |
|
1664 |
py_font = pygobject_new((GObject *)font); |
|
1665 |
||
1666 |
if (cunote->data) |
|
1667 |
retobj = PyObject_CallFunction(cunote->func, "NNO", py_fontset, |
|
1668 |
py_font, cunote->data); |
|
1669 |
else
|
|
1670 |
retobj = PyObject_CallFunction(cunote->func, "NN", py_fontset, |
|
1671 |
py_font); |
|
1672 |
||
1673 |
if (retobj != NULL) { |
|
1674 |
ret = PyObject_IsTrue(retobj); |
|
1675 |
Py_DECREF(retobj); |
|
1676 |
} else { |
|
1677 |
PyErr_Print(); |
|
1678 |
}
|
|
1679 |
||
1559
by gcarneiro
make threading runtime optional |
1680 |
pyg_gil_state_release(state); |
1167
by finlay
* pango.defs (pango_fontset_foreach) Add definition. |
1681 |
return ret; |
1682 |
}
|
|
1683 |
static PyObject * |
|
1684 |
_wrap_pango_fontset_foreach(PyGObject *self, PyObject *args, PyObject *kwargs) |
|
1685 |
{
|
|
1686 |
static char *kwlist[] = { "func", "data", NULL }; |
|
1687 |
PyObject *py_func, *py_data = NULL; |
|
1688 |
PyGtkCustomNotify cunote; |
|
1689 |
||
1690 |
if (!PyArg_ParseTupleAndKeywords(args, kwargs, |
|
1691 |
"O|O:pango.Fontset.fforeach", |
|
1692 |
kwlist, &py_func, &py_data)) |
|
1693 |
return NULL; |
|
1694 |
||
1695 |
if (!PyCallable_Check(py_func)) { |
|
1696 |
PyErr_SetString(PyExc_TypeError, "func must be callable"); |
|
1697 |
return NULL; |
|
1698 |
}
|
|
1699 |
||
1700 |
cunote.func = py_func; |
|
1701 |
cunote.data = py_data; |
|
1702 |
Py_INCREF(cunote.func); |
|
1703 |
Py_XINCREF(cunote.data); |
|
1704 |
||
1705 |
pango_fontset_foreach(PANGO_FONTSET(self->obj), |
|
1706 |
pypango_fontset_foreach_cb, |
|
1707 |
(gpointer)&cunote); |
|
1708 |
||
1709 |
Py_DECREF(cunote.func); |
|
1710 |
Py_XDECREF(cunote.data); |
|
1711 |
||
1712 |
Py_INCREF(Py_None); |
|
1713 |
return Py_None; |
|
1714 |
}
|
|
1171
by finlay
* pango.defs (pango_language_from_string) Rework as a constructor |
1715 |
%%
|
1716 |
override pango_language_from_string1 kwargs |
|
1717 |
static PyObject * |
|
1718 |
_wrap_pango_language_from_string1(PyGObject *self, PyObject *args, |
|
1719 |
PyObject *kwargs) |
|
1720 |
{
|
|
1721 |
static char *kwlist[] = { "language", NULL }; |
|
1722 |
char *language; |
|
1723 |
PangoLanguage *ret; |
|
1724 |
||
1725 |
if (!PyArg_ParseTupleAndKeywords(args, kwargs, |
|
1726 |
"s:pango_language_from_string", |
|
1727 |
kwlist, &language)) |
|
1728 |
return NULL; |
|
1729 |
if (PyErr_Warn(PyExc_DeprecationWarning, |
|
1730 |
"use pango.Language instead") < 0) |
|
1731 |
return NULL; |
|
1732 |
||
1733 |
ret = pango_language_from_string(language); |
|
1734 |
/* pyg_boxed_new handles NULL checking */ |
|
1735 |
return pyg_boxed_new(PANGO_TYPE_LANGUAGE, ret, TRUE, TRUE); |
|
1736 |
}
|
|
1737 |
||
1738 |
%%
|
|
1739 |
override pango_language_matches1 kwargs |
|
1740 |
static PyObject * |
|
1741 |
_wrap_pango_language_matches1(PyGObject *self, PyObject *args, |
|
1742 |
PyObject *kwargs) |
|
1743 |
{
|
|
1744 |
static char *kwlist[] = { "language", "range_list", NULL }; |
|
1551
by johan
* codegen/argtypes.py: |
1745 |
PyObject *py_language = Py_None; |
1171
by finlay
* pango.defs (pango_language_from_string) Rework as a constructor |
1746 |
char *range_list; |
1747 |
PangoLanguage *language = NULL; |
|
1748 |
||
1749 |
if (!PyArg_ParseTupleAndKeywords(args, kwargs, |
|
1750 |
"Os:pango_language_matches", |
|
1751 |
kwlist, &py_language, &range_list)) |
|
1752 |
return NULL; |
|
1753 |
if (PyErr_Warn(PyExc_DeprecationWarning, |
|
1754 |
"use pango.Language.matches instead") < 0) |
|
1755 |
return NULL; |
|
1756 |
||
1757 |
if (pyg_boxed_check(py_language, PANGO_TYPE_LANGUAGE)) |
|
1758 |
language = pyg_boxed_get(py_language, PangoLanguage); |
|
1759 |
else if (py_language != Py_None) { |
|
1760 |
PyErr_SetString(PyExc_TypeError, |
|
1761 |
"language should be a PangoLanguage or None"); |
|
1762 |
return NULL; |
|
1763 |
}
|
|
1764 |
||
1551
by johan
* codegen/argtypes.py: |
1765 |
return PyBool_FromLong(pango_language_matches(language, range_list)); |
1171
by finlay
* pango.defs (pango_language_from_string) Rework as a constructor |
1766 |
}
|
1735
by finlay
* pango-types.defs (LayoutIter): Add. |
1767 |
%%
|
1768 |
override pango_layout_iter_get_char_extents noargs |
|
1769 |
static PyObject * |
|
1770 |
_wrap_pango_layout_iter_get_char_extents(PyGObject *self) |
|
1771 |
{
|
|
1772 |
PangoRectangle logical_rect; |
|
1773 |
||
1774 |
pango_layout_iter_get_char_extents(pyg_boxed_get(self, PangoLayoutIter), |
|
1775 |
&logical_rect); |
|
1776 |
return Py_BuildValue("(iiii)", |
|
1777 |
logical_rect.x, logical_rect.y, |
|
1778 |
logical_rect.width, logical_rect.height); |
|
1779 |
}
|
|
1780 |
%%
|
|
1781 |
override pango_layout_iter_get_cluster_extents noargs |
|
1782 |
static PyObject * |
|
1783 |
_wrap_pango_layout_iter_get_cluster_extents(PyGObject *self) |
|
1784 |
{
|
|
1785 |
PangoRectangle ink_rect, logical_rect; |
|
1786 |
||
1787 |
pango_layout_iter_get_cluster_extents(pyg_boxed_get(self, PangoLayoutIter), |
|
1788 |
&ink_rect, &logical_rect); |
|
1789 |
return Py_BuildValue("((iiii)(iiii))", |
|
1790 |
ink_rect.x, ink_rect.y, |
|
1791 |
ink_rect.width, ink_rect.height, |
|
1792 |
logical_rect.x, logical_rect.y, |
|
1793 |
logical_rect.width, logical_rect.height); |
|
1794 |
}
|
|
1795 |
%%
|
|
1796 |
override pango_layout_iter_get_line_extents noargs |
|
1797 |
static PyObject * |
|
1798 |
_wrap_pango_layout_iter_get_line_extents(PyGObject *self) |
|
1799 |
{
|
|
1800 |
PangoRectangle ink_rect, logical_rect; |
|
1801 |
||
1802 |
pango_layout_iter_get_line_extents(pyg_boxed_get(self, PangoLayoutIter), |
|
1803 |
&ink_rect, &logical_rect); |
|
1804 |
return Py_BuildValue("((iiii)(iiii))", |
|
1805 |
ink_rect.x, ink_rect.y, |
|
1806 |
ink_rect.width, ink_rect.height, |
|
1807 |
logical_rect.x, logical_rect.y, |
|
1808 |
logical_rect.width, logical_rect.height); |
|
1809 |
}
|
|
1810 |
%%
|
|
1811 |
override pango_layout_iter_get_run_extents noargs |
|
1812 |
static PyObject * |
|
1813 |
_wrap_pango_layout_iter_get_run_extents(PyGObject *self) |
|
1814 |
{
|
|
1815 |
PangoRectangle ink_rect, logical_rect; |
|
1816 |
||
1817 |
pango_layout_iter_get_run_extents(pyg_boxed_get(self, PangoLayoutIter), |
|
1818 |
&ink_rect, &logical_rect); |
|
1819 |
return Py_BuildValue("((iiii)(iiii))", |
|
1820 |
ink_rect.x, ink_rect.y, |
|
1821 |
ink_rect.width, ink_rect.height, |
|
1822 |
logical_rect.x, logical_rect.y, |
|
1823 |
logical_rect.width, logical_rect.height); |
|
1824 |
}
|
|
1825 |
%%
|
|
1826 |
override pango_layout_iter_get_layout_extents noargs |
|
1827 |
static PyObject * |
|
1828 |
_wrap_pango_layout_iter_get_layout_extents(PyGObject *self) |
|
1829 |
{
|
|
1830 |
PangoRectangle ink_rect, logical_rect; |
|
1831 |
||
1832 |
pango_layout_iter_get_layout_extents(pyg_boxed_get(self, PangoLayoutIter), |
|
1833 |
&ink_rect, &logical_rect); |
|
1834 |
return Py_BuildValue("((iiii)(iiii))", |
|
1835 |
ink_rect.x, ink_rect.y, |
|
1836 |
ink_rect.width, ink_rect.height, |
|
1837 |
logical_rect.x, logical_rect.y, |
|
1838 |
logical_rect.width, logical_rect.height); |
|
1839 |
}
|
|
1840 |
%%
|
|
1841 |
override pango_layout_iter_get_line_yrange noargs |
|
1842 |
static PyObject * |
|
1843 |
_wrap_pango_layout_iter_get_line_yrange(PyGObject *self) |
|
1844 |
{
|
|
1845 |
int start, end; |
|
1846 |
||
1847 |
pango_layout_iter_get_line_yrange(pyg_boxed_get(self, PangoLayoutIter), |
|
1848 |
&start, &end); |
|
1849 |
return Py_BuildValue("(ii)", start, end); |
|
1850 |
}
|
|
1912
by gjc
some more pango apis |
1851 |
%%
|
1852 |
override pango_layout_line_x_to_index kwargs |
|
1853 |
static PyObject * |
|
1854 |
_wrap_pango_layout_line_x_to_index(PyObject *self, PyObject *args, |
|
1855 |
PyObject *kwargs) |
|
1856 |
{
|
|
1857 |
static char *kwlist[] = { "x_pos", NULL }; |
|
1858 |
gboolean inside; |
|
1859 |
int x_pos, index, trailing; |
|
1860 |
||
1861 |
if (!PyArg_ParseTupleAndKeywords(args, kwargs, |
|
1862 |
"i:PangoLayoutLine.x_to_index", |
|
1863 |
kwlist, &x_pos)) |
|
1864 |
return NULL; |
|
1865 |
||
1866 |
inside = pango_layout_line_x_to_index(pyg_boxed_get(self, PangoLayoutLine), |
|
1867 |
x_pos, &index, &trailing); |
|
1868 |
return Py_BuildValue("Nii", PyBool_FromLong(inside), index, trailing); |
|
1869 |
}
|
|
1870 |
%%
|
|
1871 |
override pango_layout_line_index_to_x kwargs |
|
1872 |
static PyObject * |
|
1873 |
_wrap_pango_layout_line_index_to_x(PyObject *self, PyObject *args, |
|
1874 |
PyObject *kwargs) |
|
1875 |
{
|
|
2161
by gjc
Bug 316581 â pango.LayoutLine.index_to_x() keyword is wrong |
1876 |
static char *kwlist[] = { "index", "trailing", NULL }; |
1912
by gjc
some more pango apis |
1877 |
int x_pos, index; |
1878 |
PyObject *trailing; |
|
1879 |
||
1880 |
if (!PyArg_ParseTupleAndKeywords(args, kwargs, |
|
1881 |
"iO:PangoLayoutLine.index_to_x", |
|
1882 |
kwlist, &index, &trailing)) |
|
1883 |
return NULL; |
|
1884 |
pango_layout_line_index_to_x(pyg_boxed_get(self, PangoLayoutLine), |
|
1885 |
index, PyObject_IsTrue(trailing), |
|
1886 |
&x_pos); |
|
1887 |
return PyInt_FromLong(x_pos); |
|
1888 |
}
|
|
1889 |
%%
|
|
1890 |
override pango_layout_line_get_extents noargs |
|
1891 |
static PyObject * |
|
1892 |
_wrap_pango_layout_line_get_extents(PyGObject *self) |
|
1893 |
{
|
|
1894 |
PangoRectangle ink_rect, logical_rect; |
|
1895 |
||
1896 |
pango_layout_line_get_extents(pyg_boxed_get(self, PangoLayoutLine), |
|
1897 |
&ink_rect, &logical_rect); |
|
1898 |
||
1899 |
return Py_BuildValue("((iiii)(iiii))", |
|
1900 |
ink_rect.x, ink_rect.y, |
|
1901 |
ink_rect.width, ink_rect.height, |
|
1902 |
logical_rect.x, logical_rect.y, |
|
1903 |
logical_rect.width, logical_rect.height); |
|
1904 |
}
|
|
1905 |
%%
|
|
1906 |
override pango_layout_line_get_pixel_extents noargs |
|
1907 |
static PyObject * |
|
1908 |
_wrap_pango_layout_line_get_pixel_extents(PyGObject *self) |
|
1909 |
{
|
|
1910 |
PangoRectangle ink_rect, logical_rect; |
|
1911 |
||
1912 |
pango_layout_line_get_pixel_extents(pyg_boxed_get(self, PangoLayoutLine), |
|
1913 |
&ink_rect, &logical_rect); |
|
1914 |
||
1915 |
return Py_BuildValue("((iiii)(iiii))", |
|
1916 |
ink_rect.x, ink_rect.y, |
|
1917 |
ink_rect.width, ink_rect.height, |
|
1918 |
logical_rect.x, logical_rect.y, |
|
1919 |
logical_rect.width, logical_rect.height); |
|
1920 |
}
|
|
1921 |
||
1919
by gjc
wrap more pango stuff |
1922 |
%%
|
1923 |
override-attr PangoLayoutLine.runs |
|
1924 |
||
1925 |
static inline PyObject * |
|
1926 |
pypango_glyph_item_new(PangoGlyphItem *gitem) |
|
1927 |
{
|
|
1928 |
return Py_BuildValue("NN", pyg_boxed_new(PANGO_TYPE_ITEM, gitem->item, TRUE, TRUE), |
|
1929 |
pyg_boxed_new(PANGO_TYPE_GLYPH_STRING, gitem->glyphs, TRUE, TRUE)); |
|
1930 |
}
|
|
1931 |
||
1932 |
static PyObject * |
|
1933 |
_wrap_pango_layout_line__get_runs(PyGObject *self, void *closure) |
|
1934 |
{
|
|
1935 |
PangoLayoutLine *line = pyg_boxed_get(self, PangoLayoutLine); |
|
1936 |
PyObject *list, *item; |
|
1937 |
GSList *l; |
|
1938 |
||
1939 |
list = PyList_New(0); |
|
1940 |
for (l = line->runs; l; l = l->next) { |
|
1941 |
item = pypango_glyph_item_new((PangoGlyphItem *) l->data); |
|
1942 |
PyList_Append(list, item); |
|
1943 |
Py_DECREF(item); |
|
1944 |
}
|
|
1945 |
return list; |
|
1946 |
}
|
|
2345
by finlay
* pango.override (_wrap_pango_attr_underline_color_new) |
1947 |
%%
|
1948 |
override pango_attr_underline_color_new kwargs |
|
1949 |
static PyObject * |
|
1950 |
_wrap_pango_attr_underline_color_new(PyObject *self, PyObject *args, |
|
1951 |
PyObject *kwargs) |
|
1952 |
{
|
|
1953 |
static char *kwlist[] = { "red", "green", "blue", "start_index", |
|
1954 |
"end_index", NULL }; |
|
1955 |
guint16 red, green, blue; |
|
1956 |
guint start = 0, end = 1; |
|
1957 |
||
1958 |
if (!PyArg_ParseTupleAndKeywords(args, kwargs, |
|
1959 |
"HHH|ii:PangoAttrUnderlineColor", |
|
1960 |
kwlist, &red, &green, &blue, |
|
1961 |
&start, &end)) |
|
1962 |
return NULL; |
|
1963 |
||
1964 |
return pypango_attr_new(pango_attr_underline_color_new(red, green, blue), |
|
1965 |
start, end); |
|
1966 |
}
|
|
1967 |
%%
|
|
1968 |
override pango_attr_strikethrough_color_new kwargs |
|
1969 |
static PyObject * |
|
1970 |
_wrap_pango_attr_strikethrough_color_new(PyObject *self, PyObject *args, |
|
1971 |
PyObject *kwargs) |
|
1972 |
{
|
|
1973 |
static char *kwlist[] = { "red", "green", "blue", "start_index", |
|
1974 |
"end_index", NULL }; |
|
1975 |
guint16 red, green, blue; |
|
1976 |
guint start = 0, end = 1; |
|
1977 |
||
1978 |
if (!PyArg_ParseTupleAndKeywords(args, kwargs, |
|
1979 |
"HHH|ii:PangoAttrStrikethroughColor", |
|
1980 |
kwlist, &red, &green, &blue, |
|
1981 |
&start, &end)) |
|
1982 |
return NULL; |
|
1983 |
||
1984 |
return pypango_attr_new(pango_attr_strikethrough_color_new(red, green, blue), |
|
1985 |
start, end); |
|
1986 |
}
|
|
1987 |
%%
|
|
1988 |
override pango_attr_size_new_absolute kwargs |
|
1989 |
static PyObject * |
|
1990 |
_wrap_pango_attr_size_new_absolute(PyObject *self, PyObject *args, |
|
1991 |
PyObject *kwargs) |
|
1992 |
{
|
|
1993 |
static char *kwlist[] = { "size", "start_index", "end_index", NULL }; |
|
1994 |
int size; |
|
1995 |
guint start = 0, end = 1; |
|
1996 |
||
1997 |
if (!PyArg_ParseTupleAndKeywords(args, kwargs, |
|
1998 |
"i|ii:PangoAttrSizeAbsolute", |
|
1999 |
kwlist, &size, &start, &end)) |
|
2000 |
return NULL; |
|
2001 |
||
2002 |
return pypango_attr_new(pango_attr_size_new_absolute(size), start, end); |
|
2003 |
}
|
|
2004 |
%%
|
|
2005 |
override pango_attr_letter_spacing_new kwargs |
|
2006 |
static PyObject * |
|
2007 |
_wrap_pango_attr_letter_spacing_new(PyObject *self, PyObject *args, |
|
2008 |
PyObject *kwargs) |
|
2009 |
{
|
|
2010 |
static char *kwlist[] = { "letter_spacing", "start_index", "end_index", |
|
2011 |
NULL }; |
|
2012 |
int spacing; |
|
2013 |
guint start = 0, end = 1; |
|
2014 |
||
2015 |
if (!PyArg_ParseTupleAndKeywords(args, kwargs, |
|
2016 |
"i|ii:PangoAttrLetterSpacing", |
|
2017 |
kwlist, &spacing, &start, &end)) |
|
2018 |
return NULL; |
|
2019 |
||
2020 |
return pypango_attr_new(pango_attr_letter_spacing_new(spacing), |
|
2021 |
start, end); |
|
2022 |
}
|
|
2600
by johan
2007-08-29 Johan Dahlin <jdahlin@async.com.br> |
2023 |
%%
|
2024 |
override-slot PangoColor.tp_str |
|
2025 |
static PyObject * |
|
2026 |
_wrap_pango_color_tp_str(PyObject *self) |
|
2027 |
{
|
|
2028 |
return _wrap_pango_color_to_string(self); |
|
2029 |
}
|
|
2030 |
%%
|
|
2031 |
override-slot PangoFontDescription.tp_str |
|
2032 |
static PyObject * |
|
2033 |
_wrap_pango_font_description_tp_str(PyObject *self) |
|
2034 |
{
|
|
2035 |
return _wrap_pango_font_description_to_string(self); |
|
2036 |
}
|
|
2037 |
%%
|
|
2038 |
override-slot PangoFontDescription.tp_hash |
|
2601
by johan
Fix bug in hash() implementation and test it properly |
2039 |
static int |
2600
by johan
2007-08-29 Johan Dahlin <jdahlin@async.com.br> |
2040 |
_wrap_pango_font_description_tp_hash(PyObject *self) |
2041 |
{
|
|
2601
by johan
Fix bug in hash() implementation and test it properly |
2042 |
return pango_font_description_hash(pyg_boxed_get(self, PangoFontDescription)); |
2600
by johan
2007-08-29 Johan Dahlin <jdahlin@async.com.br> |
2043 |
}
|
2044 |
%%
|
|
2045 |
override-slot PangoFontDescription.tp_compare |
|
2046 |
static int |
|
2047 |
_wrap_pango_font_description_tp_compare(PyObject *self, PyObject *other) |
|
2048 |
{
|
|
2049 |
PangoFontDescription *font1, *font2; |
|
2050 |
||
2051 |
if (!pyg_boxed_check(other, PANGO_TYPE_FONT_DESCRIPTION)) |
|
2052 |
return -1; |
|
2053 |
||
2054 |
font1 = pyg_boxed_get(self, PangoFontDescription); |
|
2055 |
font2 = pyg_boxed_get(other, PangoFontDescription); |
|
2056 |
||
2057 |
if (pango_font_description_equal(font1, font2)) |
|
2058 |
return 0; |
|
2059 |
||
2060 |
return -1; |
|
2061 |
}
|
|
2062 |
%%
|
|
2063 |
override-slot PangoLanguage.tp_str |
|
2064 |
static PyObject * |
|
2065 |
_wrap_pango_language_tp_str(PyObject *self) |
|
2066 |
{
|
|
2067 |
return _wrap_pango_language_to_string(self); |
|
2068 |
}
|
|
2604
by gjc
Bug 472908 – Make pango.Context non-instantiable |
2069 |
%%
|
2070 |
override pango_context_new kwargs |
|
2071 |
static int |
|
2072 |
_wrap_pango_context_new(PyObject *self, PyObject *args, PyObject *kwargs) |
|
2073 |
{
|
|
2074 |
PyErr_SetString(PyExc_TypeError, "pango.Context cannot be instantiated directly"); |
|
2075 |
return -1; |
|
2076 |
}
|