ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/Client.xs
(Generate patch)

Comparing deliantra/Deliantra-Client/Client.xs (file contents):
Revision 1.15 by root, Tue Apr 11 13:14:36 2006 UTC vs.
Revision 1.16 by root, Tue Apr 11 13:27:48 2006 UTC

25} *CFClient__Layout; 25} *CFClient__Layout;
26 26
27static void 27static void
28layout_get_pixel_size (CFClient__Layout self, int *w, int *h) 28layout_get_pixel_size (CFClient__Layout self, int *w, int *h)
29{ 29{
30 PangoFontDescription *font = pango_context_get_font_description (context);
31 pango_font_description_set_absolute_size (font, self->base_height * PANGO_SCALE);
32
30 pango_layout_get_pixel_size (self->pl, w, h); 33 pango_layout_get_pixel_size (self->pl, w, h);
31 34
32 *w = (*w + 3) & ~3; 35 *w = (*w + 3) & ~3;
33 if (!*w) *w = 1; 36 if (!*w) *w = 1;
34 if (!*h) *h = 1; 37 if (!*h) *h = 1;
106 109
107 pango_layout_set_markup (self->pl, text, textlen); 110 pango_layout_set_markup (self->pl, text, textlen);
108} 111}
109 112
110void 113void
114set_height (CFClient::Layout self, int base_height)
115 CODE:
116 self->base_height = base_height;
117
118void
111set_width (CFClient::Layout self, int max_width = -1) 119set_width (CFClient::Layout self, int max_width = -1)
112 CODE: 120 CODE:
113 pango_layout_set_width (self->pl, max_width < 0 ? max_width : max_width * PANGO_SCALE); 121 pango_layout_set_width (self->pl, max_width < 0 ? max_width : max_width * PANGO_SCALE);
114 122
115void 123void
116size (CFClient::Layout self) 124size (CFClient::Layout self)
117 PPCODE: 125 PPCODE:
118{ 126{
119 int w, h; 127 int w, h;
120
121 PangoFontDescription *font = pango_context_get_font_description (context);
122 pango_font_description_set_absolute_size (font, self->base_height * PANGO_SCALE);
123 128
124 layout_get_pixel_size (self, &w, &h); 129 layout_get_pixel_size (self, &w, &h);
125 130
126 EXTEND (SP, 2); 131 EXTEND (SP, 2);
127 PUSHs (sv_2mortal (newSViv (w))); 132 PUSHs (sv_2mortal (newSViv (w)));

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines