… | |
… | |
23 | PangoLayout *pl; |
23 | PangoLayout *pl; |
24 | int base_height; |
24 | int base_height; |
25 | } *CFClient__Layout; |
25 | } *CFClient__Layout; |
26 | |
26 | |
27 | static void |
27 | static void |
|
|
28 | substitute_func (FcPattern *pattern, gpointer data) |
|
|
29 | { |
|
|
30 | FcPatternAddBool (pattern, FC_HINTING , 1); |
|
|
31 | FcPatternAddBool (pattern, FC_AUTOHINT, 1); |
|
|
32 | } |
|
|
33 | |
|
|
34 | static void |
28 | layout_update (CFClient__Layout self) |
35 | layout_update (CFClient__Layout self) |
29 | { |
36 | { |
|
|
37 | /* use a random scale factor to account for unknown descenders, 0.8 works |
|
|
38 | * reasonably well with bitstream vera |
|
|
39 | */ |
30 | PangoFontDescription *font = pango_context_get_font_description (context); |
40 | PangoFontDescription *font = pango_context_get_font_description (context); |
31 | pango_font_description_set_absolute_size (font, self->base_height * PANGO_SCALE); |
41 | pango_font_description_set_absolute_size (font, self->base_height * (PANGO_SCALE * 8 / 10)); |
32 | } |
42 | } |
33 | |
43 | |
34 | static void |
44 | static void |
35 | layout_get_pixel_size (CFClient__Layout self, int *w, int *h) |
45 | layout_get_pixel_size (CFClient__Layout self, int *w, int *h) |
36 | { |
46 | { |
37 | PangoFontDescription *font = pango_context_get_font_description (context); |
47 | layout_update (self); |
38 | pango_font_description_set_absolute_size (font, self->base_height * PANGO_SCALE); |
|
|
39 | |
48 | |
40 | pango_layout_get_pixel_size (self->pl, w, h); |
49 | pango_layout_get_pixel_size (self->pl, w, h); |
41 | |
50 | |
42 | *w = (*w + 3) & ~3; |
51 | *w = (*w + 3) & ~3; |
43 | if (!*w) *w = 1; |
52 | if (!*w) *w = 1; |
… | |
… | |
49 | PROTOTYPES: ENABLE |
58 | PROTOTYPES: ENABLE |
50 | |
59 | |
51 | BOOT: |
60 | BOOT: |
52 | { |
61 | { |
53 | fontmap = pango_ft2_font_map_new (); |
62 | fontmap = pango_ft2_font_map_new (); |
|
|
63 | pango_ft2_font_map_set_default_substitute ((PangoFT2FontMap *)fontmap, substitute_func, 0, 0); |
54 | context = pango_ft2_font_map_create_context ((PangoFT2FontMap *)fontmap); |
64 | context = pango_ft2_font_map_create_context ((PangoFT2FontMap *)fontmap); |
55 | } |
65 | } |
56 | |
66 | |
57 | void |
67 | void |
58 | lowdelay (int fd, int val = 1) |
68 | lowdelay (int fd, int val = 1) |
… | |
… | |
212 | double t = SvNV (*hv_fetch (hv, "t", 1, 1)); |
222 | double t = SvNV (*hv_fetch (hv, "t", 1, 1)); |
213 | int name = SvIV (*hv_fetch (hv, "name", 4, 1)); |
223 | int name = SvIV (*hv_fetch (hv, "name", 4, 1)); |
214 | |
224 | |
215 | if (items < 5) |
225 | if (items < 5) |
216 | { |
226 | { |
217 | w = SvNV (*hv_fetch (hv, "width", 5, 1)); |
227 | w = SvNV (*hv_fetch (hv, "w", 1, 1)); |
218 | h = SvNV (*hv_fetch (hv, "height", 6, 1)); |
228 | h = SvNV (*hv_fetch (hv, "h", 1, 1)); |
219 | } |
229 | } |
220 | |
230 | |
221 | glBindTexture (GL_TEXTURE_2D, name); |
231 | glBindTexture (GL_TEXTURE_2D, name); |
222 | glBegin (GL_QUADS); |
232 | glBegin (GL_QUADS); |
223 | glTexCoord2d (0, 0); glVertex2d (x , y ); |
233 | glTexCoord2d (0, 0); glVertex2d (x , y ); |