… | |
… | |
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) |