… | |
… | |
837 | CODE: |
837 | CODE: |
838 | { |
838 | { |
839 | PangoAttrList *attrs = 0; |
839 | PangoAttrList *attrs = 0; |
840 | const char *text = pango_layout_get_text (self->pl); |
840 | const char *text = pango_layout_get_text (self->pl); |
841 | const char *pos = text; |
841 | const char *pos = text; |
842 | int arg = 2; |
842 | int arg = 4; |
843 | |
843 | |
844 | while (arg < items && (pos = strstr (pos, OBJ_STR))) |
844 | while (arg < items && (pos = strstr (pos, OBJ_STR))) |
845 | { |
845 | { |
846 | PangoRectangle rect; |
846 | PangoRectangle inkrect, rect; |
847 | PangoAttribute *attr; |
847 | PangoAttribute *attr; |
848 | |
848 | |
|
|
849 | int x = SvIV (ST (arg - 3)); |
|
|
850 | int y = SvIV (ST (arg - 2)); |
849 | int w = SvIV (ST (arg - 1)); |
851 | int w = SvIV (ST (arg - 1)); |
850 | int h = SvIV (ST (arg)); |
852 | int h = SvIV (ST (arg )); |
851 | |
853 | |
852 | arg += 2; |
|
|
853 | |
|
|
854 | rect.x = 0; |
854 | inkrect.x = 0; |
|
|
855 | inkrect.y = 0; |
|
|
856 | inkrect.width = 0; |
|
|
857 | inkrect.height = 0; |
|
|
858 | |
|
|
859 | rect.x = x * PANGO_SCALE; |
855 | rect.y = -h * PANGO_SCALE; |
860 | rect.y = y * PANGO_SCALE; |
856 | rect.width = w * PANGO_SCALE; |
861 | rect.width = w * PANGO_SCALE; |
857 | rect.height = h * PANGO_SCALE; |
862 | rect.height = h * PANGO_SCALE; |
858 | |
863 | |
859 | if (!attrs) |
864 | if (!attrs) |
860 | attrs = pango_layout_get_attributes (self->pl); |
865 | attrs = pango_layout_get_attributes (self->pl); |
861 | |
866 | |
862 | attr = pango_attr_shape_new (&rect, &rect); |
867 | attr = pango_attr_shape_new (&inkrect, &rect); |
863 | attr->start_index = pos - text; |
868 | attr->start_index = pos - text; |
864 | attr->end_index = attr->start_index + sizeof (OBJ_STR) - 1; |
869 | attr->end_index = attr->start_index + sizeof (OBJ_STR) - 1; |
865 | pango_attr_list_insert (attrs, attr); |
870 | pango_attr_list_insert (attrs, attr); |
866 | |
871 | |
|
|
872 | arg += 4; |
867 | pos += sizeof (OBJ_STR) - 1; |
873 | pos += sizeof (OBJ_STR) - 1; |
868 | } |
874 | } |
869 | |
875 | |
870 | if (attrs) |
876 | if (attrs) |
871 | pango_layout_set_attributes (self->pl, attrs); |
877 | pango_layout_set_attributes (self->pl, attrs); |
… | |
… | |
984 | |
990 | |
985 | EXTEND (SP, 2); |
991 | EXTEND (SP, 2); |
986 | PUSHs (sv_2mortal (newSViv (w))); |
992 | PUSHs (sv_2mortal (newSViv (w))); |
987 | PUSHs (sv_2mortal (newSViv (h))); |
993 | PUSHs (sv_2mortal (newSViv (h))); |
988 | } |
994 | } |
|
|
995 | |
|
|
996 | int |
|
|
997 | descent (CFClient::Layout self) |
|
|
998 | CODE: |
|
|
999 | { |
|
|
1000 | PangoRectangle rect; |
|
|
1001 | PangoLayoutLine *line = pango_layout_get_line (self->pl, 0); |
|
|
1002 | pango_layout_line_get_pixel_extents (line, 0, &rect); |
|
|
1003 | RETVAL = PANGO_DESCENT (rect); |
|
|
1004 | } |
|
|
1005 | OUTPUT: |
|
|
1006 | RETVAL |
989 | |
1007 | |
990 | int |
1008 | int |
991 | xy_to_index (CFClient::Layout self, int x, int y) |
1009 | xy_to_index (CFClient::Layout self, int x, int y) |
992 | CODE: |
1010 | CODE: |
993 | { |
1011 | { |