… | |
… | |
45 | #define G_DISABLE_CAST_CHECKS |
45 | #define G_DISABLE_CAST_CHECKS |
46 | |
46 | |
47 | #include <glib/gmacros.h> |
47 | #include <glib/gmacros.h> |
48 | |
48 | |
49 | #include <pango/pango.h> |
49 | #include <pango/pango.h> |
|
|
50 | |
|
|
51 | #if !(defined (PANGO_VERSION_CHECK) && PANGO_VERSION_CHECK (1, 15, 2)) |
|
|
52 | # define pango_layout_get_line_readonly pango_layout_get_line_readonly |
|
|
53 | # define pango_layout_get_lines_readonly pango_layout_get_lines_readonly |
|
|
54 | # define pango_layout_iter_get_line_readonly pango_layout_iter_get_line_readonly |
|
|
55 | # define pango_layout_iter_get_run_readonly pango_layout_iter_get_run_readonly |
|
|
56 | #endif |
50 | |
57 | |
51 | #ifndef _WIN32 |
58 | #ifndef _WIN32 |
52 | # include <sys/types.h> |
59 | # include <sys/types.h> |
53 | # include <sys/socket.h> |
60 | # include <sys/socket.h> |
54 | # include <netinet/in.h> |
61 | # include <netinet/in.h> |
… | |
… | |
659 | CODE: |
666 | CODE: |
660 | { |
667 | { |
661 | opengl_fontmap = pango_opengl_font_map_new (); |
668 | opengl_fontmap = pango_opengl_font_map_new (); |
662 | pango_opengl_font_map_set_default_substitute ((PangoOpenGLFontMap *)opengl_fontmap, substitute_func, 0, 0); |
669 | pango_opengl_font_map_set_default_substitute ((PangoOpenGLFontMap *)opengl_fontmap, substitute_func, 0, 0); |
663 | opengl_context = pango_opengl_font_map_create_context ((PangoOpenGLFontMap *)opengl_fontmap); |
670 | opengl_context = pango_opengl_font_map_create_context ((PangoOpenGLFontMap *)opengl_fontmap); |
|
|
671 | #if defined (PANGO_VERSION_CHECK) && PANGO_VERSION_CHECK (1, 15, 2) |
|
|
672 | pango_context_set_language (opengl_context, pango_language_from_string ("en")); |
|
|
673 | pango_context_set_base_dir (opengl_context, PANGO_DIRECTION_WEAK_LTR); |
|
|
674 | #endif |
664 | } |
675 | } |
665 | |
676 | |
666 | char * |
677 | char * |
667 | SDL_GetError () |
678 | SDL_GetError () |
668 | |
679 | |
… | |
… | |
1165 | { |
1176 | { |
1166 | PangoLayoutIter *iter = pango_layout_get_iter (self->pl); |
1177 | PangoLayoutIter *iter = pango_layout_get_iter (self->pl); |
1167 | |
1178 | |
1168 | do |
1179 | do |
1169 | { |
1180 | { |
1170 | PangoLayoutRun *run = pango_layout_iter_get_run (iter); |
1181 | PangoLayoutRun *run = pango_layout_iter_get_run_readonly (iter); |
1171 | |
1182 | |
1172 | if (run && shape_attr_p (run)) |
1183 | if (run && shape_attr_p (run)) |
1173 | { |
1184 | { |
1174 | PangoRectangle extents; |
1185 | PangoRectangle extents; |
1175 | pango_layout_iter_get_run_extents (iter, 0, &extents); |
1186 | pango_layout_iter_get_run_extents (iter, 0, &extents); |
… | |
… | |
1279 | int |
1290 | int |
1280 | descent (DC::Layout self) |
1291 | descent (DC::Layout self) |
1281 | CODE: |
1292 | CODE: |
1282 | { |
1293 | { |
1283 | PangoRectangle rect; |
1294 | PangoRectangle rect; |
1284 | PangoLayoutLine *line = pango_layout_get_line (self->pl, 0); |
1295 | PangoLayoutLine *line = pango_layout_get_line_readonly (self->pl, 0); |
1285 | pango_layout_line_get_pixel_extents (line, 0, &rect); |
1296 | pango_layout_line_get_pixel_extents (line, 0, &rect); |
1286 | RETVAL = PANGO_DESCENT (rect); |
1297 | RETVAL = PANGO_DESCENT (rect); |
1287 | } |
1298 | } |
1288 | OUTPUT: |
1299 | OUTPUT: |
1289 | RETVAL |
1300 | RETVAL |
… | |
… | |
1336 | int index, trailing; |
1347 | int index, trailing; |
1337 | |
1348 | |
1338 | if (line < 0) |
1349 | if (line < 0) |
1339 | XSRETURN_EMPTY; |
1350 | XSRETURN_EMPTY; |
1340 | |
1351 | |
1341 | if (!(lp = pango_layout_get_line (self->pl, line))) |
1352 | if (!(lp = pango_layout_get_line_readonly (self->pl, line))) |
1342 | XSRETURN_EMPTY; /* do better */ |
1353 | XSRETURN_EMPTY; /* do better */ |
1343 | |
1354 | |
1344 | pango_layout_line_x_to_index (lp, x * PANGO_SCALE, &index, &trailing); |
1355 | pango_layout_line_x_to_index (lp, x * PANGO_SCALE, &index, &trailing); |
1345 | |
1356 | |
1346 | EXTEND (SP, 2); |
1357 | EXTEND (SP, 2); |