forked from gtkforphp/pango
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pango.c
221 lines (191 loc) · 6.33 KB
/
pango.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2008 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| [email protected] so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Michael Maclean <[email protected]> |
+----------------------------------------------------------------------+
*/
/* $Id: $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "php.h"
#include "php_ini.h"
#include "ext/standard/info.h"
#include "php_pango.h"
/* If you declare any globals in php_pango.h uncomment this:
ZEND_DECLARE_MODULE_GLOBALS(pango)
*/
zend_class_entry *pango_ce_pango;
zend_object_handlers pango_std_object_handlers;
/* proto int pango_version(void) {{{
returns the Pango version */
PHP_FUNCTION(pango_version)
{
if(zend_parse_parameters_none() == FAILURE) {
return;
}
RETURN_LONG(pango_version());
}
/* }}} */
/* proto int pango_version_string(void) {{{
returns the Pango version as a string */
PHP_FUNCTION(pango_version_string)
{
if(zend_parse_parameters_none() == FAILURE) {
return;
}
RETURN_STRING((char *)pango_version_string(), 1);
}
/* }}} */
/* {{{ pango_functions[]
*
* Every user visible function must have an entry in pango_functions[].
*/
const zend_function_entry pango_functions[] = {
PHP_FE(pango_version, NULL)
PHP_FE(pango_version_string, NULL)
PHP_FE(pango_layout_new, NULL)
PHP_FE(pango_cairo_update_layout, NULL)
PHP_FE(pango_cairo_show_layout, NULL)
PHP_FE(pango_layout_get_context, NULL)
PHP_FE(pango_layout_set_text, NULL)
PHP_FE(pango_layout_get_text, NULL)
PHP_FE(pango_layout_set_markup, NULL)
PHP_FE(pango_layout_get_width, NULL)
PHP_FE(pango_layout_get_height, NULL)
PHP_FE(pango_layout_get_size, NULL)
PHP_FE(pango_layout_get_pixel_size, NULL)
PHP_FE(pango_layout_get_extents, NULL)
PHP_FE(pango_layout_get_pixel_extents, NULL)
PHP_FE(pango_layout_set_width, NULL)
PHP_FE(pango_layout_set_height, NULL)
PHP_FE(pango_layout_set_font_description, NULL)
PHP_FE(pango_layout_set_alignment, NULL)
PHP_FE(pango_layout_get_alignment, NULL)
PHP_FE(pango_layout_set_justify, NULL)
PHP_FE(pango_layout_get_justify, NULL)
PHP_FE(pango_layout_set_wrap, NULL)
PHP_FE(pango_layout_get_wrap, NULL)
PHP_FE(pango_layout_is_wrapped, NULL)
PHP_FE(pango_layout_set_indent, NULL)
PHP_FE(pango_layout_get_indent, NULL)
PHP_FE(pango_layout_set_spacing, NULL)
PHP_FE(pango_layout_get_spacing, NULL)
PHP_FE(pango_layout_set_ellipsize, NULL)
PHP_FE(pango_layout_get_ellipsize, NULL)
PHP_FE(pango_layout_is_ellipsized, NULL)
PHP_FE(pango_layout_get_lines, NULL)
PHP_FE(pango_layout_get_line, NULL)
PHP_FE(pango_layout_get_line_count, NULL)
PHP_FE(pango_layout_context_changed, NULL)
/* PangoLayoutLine functions */
PHP_FE(pango_layout_line_get_extents, NULL)
PHP_FE(pango_layout_line_get_pixel_extents, NULL)
PHP_FE(pango_cairo_show_layout_line, NULL)
/* PangoFontDescription functions */
PHP_FE(pango_font_description_new, NULL)
PHP_FE(pango_font_description_get_variant, NULL)
PHP_FE(pango_font_description_set_variant, NULL)
/* PHP_FE(pango_font_description_new, NULL) */
{NULL, NULL, NULL}
};
/* }}} */
const zend_function_entry pango_methods[] = {
PHP_ME_MAPPING(version, pango_version, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
PHP_ME_MAPPING(versionString, pango_version_string, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
{NULL, NULL, NULL}
};
/* {{{ pango_module_entry
*/
zend_module_entry pango_module_entry = {
#if ZEND_MODULE_API_NO >= 20010901
STANDARD_MODULE_HEADER,
#endif
"pango",
pango_functions,
PHP_MINIT(pango),
PHP_MSHUTDOWN(pango),
NULL,
NULL,
PHP_MINFO(pango),
#if ZEND_MODULE_API_NO >= 20010901
PHP_PANGO_VERSION,
#endif
STANDARD_MODULE_PROPERTIES
};
/* }}} */
#ifdef COMPILE_DL_PANGO
ZEND_GET_MODULE(pango)
#endif
/* {{{ PHP_MINIT_FUNCTION
*/
PHP_MINIT_FUNCTION(pango)
{
zend_class_entry pango_ce;
memcpy(&pango_std_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
pango_std_object_handlers.clone_obj = NULL;
INIT_CLASS_ENTRY(pango_ce, "Pango", pango_methods);
pango_ce_pango = zend_register_internal_class(&pango_ce TSRMLS_CC);
pango_ce_pango->ce_flags |= ZEND_ACC_EXPLICIT_ABSTRACT_CLASS | ZEND_ACC_FINAL_CLASS;
#define REGISTER_PANGO_LONG_CONST(const_name, value) \
zend_declare_class_constant_long(pango_ce_pango, const_name, sizeof(const_name)-1, (long)value TSRMLS_CC); \
REGISTER_LONG_CONSTANT(#value, value, CONST_CS | CONST_PERSISTENT);
REGISTER_PANGO_LONG_CONST("SCALE", PANGO_SCALE);
PHP_MINIT(pango_error)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(pango_context)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(pango_layout)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(pango_font)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(pango_line)(INIT_FUNC_ARGS_PASSTHRU);
return SUCCESS;
}
/* }}} */
/* {{{ PHP_MSHUTDOWN_FUNCTION
*/
PHP_MSHUTDOWN_FUNCTION(pango)
{
/* uncomment this line if you have INI entries
UNREGISTER_INI_ENTRIES();
*/
return SUCCESS;
}
/* }}} */
/* {{{ PHP_MINFO_FUNCTION
*/
PHP_MINFO_FUNCTION(pango)
{
php_info_print_table_start();
php_info_print_table_header(2, "Pango text rendering support", "enabled");
php_info_print_table_colspan_header(2,
#ifdef COMPILE_DL_PANGO
"compiled as dynamic module"
#else
"compiled as static module"
#endif
);
php_info_print_table_row(2, "Pango version", PANGO_VERSION_STRING);
php_info_print_table_row(2, "Extension version", PHP_PANGO_VERSION);
php_info_print_table_end();
/* Remove comments if you have entries in php.ini
DISPLAY_INI_ENTRIES();
*/
}
/* }}} */
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: noet sw=4 ts=4 fdm=marker
* vim<600: noet sw=4 ts=4
*/