~ember/vte/ubuntu

« back to all changes in this revision

Viewing changes to debian/patches/92_pangocairo_full_bold_fonts.patch

  • Committer: Pedro Fragoso
  • Date: 2009-03-17 03:19:40 UTC
  • Revision ID: ember@ubuntu.com-20090317031940-w7ux0yn41fjl2fy4
vte (1:0.20.0-0ubuntu1) jaunty; urgency=low

* New upstream release (LP: #344049)
  - Support using a real bold font instead of pseudo-bolding
  - Respond to fontconfig configuration changes
  - Bugs fixed in this release:
  - Bug 54926 – Should try bold version of font before 
    pseudo-bolding
  - Bug 570208 – vte fails to build outside source tree
  - Bug 548272 – Fix output of CSI 13,14, 18-21 (LP: #208837)
  - Bug 565688 – [gnome-pty-helper] using openpty in a bad way
  - Bug 566795 – VTE fails to build in trunk
  - Bug 524170 – Support initc terminfo capability and 
    change-cursor-color
  - Bug 566730 – vte_terminal_set_color_cursor() calls invalidate_all but
    it doesn't have to
  - Bug 565679 – alloca is discouraged
  - Bug 565675 – typo in configure.in cause ncurses checking fail
  - Bug 565663 – compile failure because use static function in another .h
    file
  - Bug 575398 – configure warns about term.h under OpenSolaris
  - Bug 574616 – "real" transparency not working from python bindings
  - Bug 574025 – Crash in _vte_terminal_insert_char
* debian/patches/92_pangocairo_full_bold_fonts.patch:
  - Dropped, merged upstream
* debian/patches/90_autoreconf.patch:
  - Refreshed for the new release
* debian/patches/94_hardcode_gtkdoc_rebase.patch:
  - Temp workaround to prevent FTBFS

 -- Pedro Fragoso <ember@ubuntu.com>Mon, 16 Mar 2009 15:21:59 +0000

vte (1:0.19.4-0ubuntu5) jaunty; urgency=low

* Rebuild against libgtk-directfb-2.0-0 2.15.4-0ubuntu4, to correct a 
  wrong dependency in libvte9-udeb.

 -- Steve Langasek <steve.langasek@ubuntu.com>Wed, 25 Feb 2009 01:41:15 +0000

vte (1:0.19.4-0ubuntu4) jaunty; urgency=low

* Rebuild for python2.6, fix installation path.

 -- Matthias Klose <doko@ubuntu.com>Sun, 22 Feb 2009 14:29:33 +0100

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
Upstream: http://bugzilla.gnome.org/show_bug.cgi?id=54926
2
 
Description: Fix bold font handling.
3
 
 
4
 
diff -Nur -x '*.orig' -x '*~' vte-0.19.4/src/vte.c vte-0.19.4.new/src/vte.c
5
 
--- vte-0.19.4/src/vte.c        2008-12-13 14:49:02.000000000 -0800
6
 
+++ vte-0.19.4.new/src/vte.c    2009-02-10 16:14:36.000000000 -0800
7
 
@@ -724,7 +724,7 @@
8
 
                                        _vte_draw_get_char_width (
9
 
                                                terminal->pvt->draw,
10
 
                                                cell->c,
11
 
-                                               columns) >
12
 
+                                               columns, cell->attr.bold) >
13
 
                                        terminal->char_width * columns) {
14
 
                                columns++;
15
 
                        }
16
 
@@ -781,7 +781,7 @@
17
 
                                        _vte_draw_get_char_width (
18
 
                                                terminal->pvt->draw,
19
 
                                                cell->c,
20
 
-                                               columns) >
21
 
+                                               columns, cell->attr.bold) >
22
 
                            terminal->char_width * columns) {
23
 
                                columns++;
24
 
                        }
25
 
@@ -8853,7 +8853,7 @@
26
 
 vte_terminal_unichar_is_local_graphic(VteTerminal *terminal, vteunistr c)
27
 
 {
28
 
        return vte_unichar_is_local_graphic (c) &&
29
 
-               !_vte_draw_has_char (terminal->pvt->draw, c);
30
 
+               !_vte_draw_has_char (terminal->pvt->draw, c, FALSE);
31
 
 }
32
 
 
33
 
 static void
34
 
@@ -8968,7 +8968,7 @@
35
 
        }
36
 
 
37
 
        if (_vte_draw_char(terminal->pvt->draw, &request,
38
 
-                          &color, VTE_DRAW_OPAQUE)) {
39
 
+                          &color, VTE_DRAW_OPAQUE, FALSE)) {
40
 
                /* We were able to draw with actual fonts. */
41
 
                return TRUE;
42
 
        }
43
 
@@ -9761,15 +9761,16 @@
44
 
        color.green = fg->green;
45
 
        _vte_draw_text(terminal->pvt->draw,
46
 
                        items, n,
47
 
-                       &color, VTE_DRAW_OPAQUE);
48
 
-       if (bold) {
49
 
+                       &color, VTE_DRAW_OPAQUE, bold);
50
 
+       /* handle fonts that lack a bold face by double-striking */
51
 
+       if (bold && !_vte_draw_has_bold(terminal->pvt->draw)) {
52
 
                /* Take a step to the right. */
53
 
                for (i = 0; i < n; i++) {
54
 
                        items[i].x++;
55
 
                }
56
 
                _vte_draw_text(terminal->pvt->draw,
57
 
                                items, n,
58
 
-                               &color, VTE_DRAW_OPAQUE);
59
 
+                               &color, VTE_DRAW_OPAQUE, FALSE);
60
 
                /* Now take a step back. */
61
 
                for (i = 0; i < n; i++) {
62
 
                        items[i].x--;
63
 
@@ -10634,7 +10635,7 @@
64
 
        cursor_width = item.columns * width;
65
 
        if (cell && cell->c != 0) {
66
 
                gint cw = _vte_draw_get_char_width (terminal->pvt->draw,
67
 
-                               cell->c, cell->attr.columns);
68
 
+                               cell->c, cell->attr.columns, cell->attr.bold);
69
 
                cursor_width = MAX(cursor_width, cw);
70
 
                cursor_width += cell->attr.bold; /* for pseudo-bolding */
71
 
        }
72
 
diff -Nur -x '*.orig' -x '*~' vte-0.19.4/src/vtedraw.c vte-0.19.4.new/src/vtedraw.c
73
 
--- vte-0.19.4/src/vtedraw.c    2008-12-11 19:31:52.000000000 -0800
74
 
+++ vte-0.19.4.new/src/vtedraw.c        2009-02-10 16:14:36.000000000 -0800
75
 
@@ -312,12 +312,13 @@
76
 
 }
77
 
 
78
 
 int
79
 
-_vte_draw_get_char_width (struct _vte_draw *draw, vteunistr c, int columns)
80
 
+_vte_draw_get_char_width (struct _vte_draw *draw, vteunistr c, int columns,
81
 
+                         gboolean bold)
82
 
 {
83
 
        int width = 0;
84
 
 
85
 
        if (draw->impl->get_char_width)
86
 
-               width = draw->impl->get_char_width (draw, c, columns);
87
 
+               width = draw->impl->get_char_width (draw, c, columns, bold);
88
 
 
89
 
        if (width == 0)
90
 
                _vte_draw_get_text_metrics (draw, &width, NULL, NULL);
91
 
@@ -325,10 +326,19 @@
92
 
        return width;
93
 
 }
94
 
 
95
 
+gboolean
96
 
+_vte_draw_has_bold (struct _vte_draw *draw)
97
 
+{
98
 
+       if (draw->impl->has_bold)
99
 
+               return draw->impl->has_bold (draw);
100
 
+
101
 
+       return FALSE;
102
 
+}
103
 
+
104
 
 void
105
 
 _vte_draw_text (struct _vte_draw *draw,
106
 
               struct _vte_draw_text_request *requests, gsize n_requests,
107
 
-              GdkColor *color, guchar alpha)
108
 
+              GdkColor *color, guchar alpha, gboolean bold)
109
 
 {
110
 
        g_return_if_fail (draw->started == TRUE);
111
 
        g_return_if_fail (draw->impl->draw_text != NULL);
112
 
@@ -341,43 +351,44 @@
113
 
                        g_string_append_unichar (string, requests[n].c);
114
 
                }
115
 
                str = g_string_free (string, FALSE);
116
 
-               g_printerr ("draw_text (\"%s\", len=%"G_GSIZE_FORMAT", color=(%d,%d,%d,%d))\n",
117
 
+               g_printerr ("draw_text (\"%s\", len=%"G_GSIZE_FORMAT", color=(%d,%d,%d,%d), %s)\n",
118
 
                                str, n_requests, color->red, color->green, color->blue,
119
 
-                               alpha);
120
 
+                               alpha, bold ? "bold" : "normal");
121
 
                g_free (str);
122
 
        }
123
 
 
124
 
-       draw->impl->draw_text (draw, requests, n_requests, color, alpha);
125
 
+       draw->impl->draw_text (draw, requests, n_requests, color, alpha, bold);
126
 
 }
127
 
 
128
 
 gboolean
129
 
 _vte_draw_char (struct _vte_draw *draw,
130
 
               struct _vte_draw_text_request *request,
131
 
-              GdkColor *color, guchar alpha)
132
 
+              GdkColor *color, guchar alpha, gboolean bold)
133
 
 {
134
 
        gboolean has_char;
135
 
 
136
 
        _vte_debug_print (VTE_DEBUG_DRAW,
137
 
-                       "draw_char ('%c', color=(%d,%d,%d,%d))\n",
138
 
+                       "draw_char ('%c', color=(%d,%d,%d,%d), %s)\n",
139
 
                        request->c,
140
 
                        color->red, color->green, color->blue,
141
 
-                       alpha);
142
 
+                       alpha, bold ? "bold" : "normal");
143
 
 
144
 
-       has_char =_vte_draw_has_char (draw, request->c);
145
 
+       has_char =_vte_draw_has_char (draw, request->c, bold);
146
 
        if (has_char)
147
 
-               _vte_draw_text (draw, request, 1, color, alpha);
148
 
+               _vte_draw_text (draw, request, 1, color, alpha, bold);
149
 
 
150
 
        return has_char;
151
 
 }
152
 
 gboolean
153
 
-_vte_draw_has_char (struct _vte_draw *draw, vteunistr c)
154
 
+_vte_draw_has_char (struct _vte_draw *draw, vteunistr c, gboolean bold)
155
 
 {
156
 
        gboolean has_char = TRUE;
157
 
 
158
 
-       _vte_debug_print (VTE_DEBUG_DRAW, "draw_has_char ('0x%04X')\n", c);
159
 
+       _vte_debug_print (VTE_DEBUG_DRAW, "draw_has_char ('0x%04X', %s)\n", c,
160
 
+                         bold ? "bold" : "normal");
161
 
 
162
 
        if (draw->impl->has_char)
163
 
-               has_char = draw->impl->has_char (draw, c);
164
 
+               has_char = draw->impl->has_char (draw, c, bold);
165
 
 
166
 
        return has_char;
167
 
 }
168
 
diff -Nur -x '*.orig' -x '*~' vte-0.19.4/src/vtedraw.h vte-0.19.4.new/src/vtedraw.h
169
 
--- vte-0.19.4/src/vtedraw.h    2008-12-11 19:30:57.000000000 -0800
170
 
+++ vte-0.19.4.new/src/vtedraw.h        2009-02-10 16:14:36.000000000 -0800
171
 
@@ -87,11 +87,13 @@
172
 
                              const PangoFontDescription *,
173
 
                              VteTerminalAntiAlias);
174
 
        void (*get_text_metrics)(struct _vte_draw *, gint *, gint *, gint *);
175
 
-       int (*get_char_width)(struct _vte_draw *, vteunistr c, int columns);
176
 
+       int (*get_char_width)(struct _vte_draw *, vteunistr c, int columns,
177
 
+                             gboolean);
178
 
+       gboolean (*has_bold)(struct _vte_draw *);
179
 
        void (*draw_text)(struct _vte_draw *,
180
 
-                         struct _vte_draw_text_request *, gsize,
181
 
-                         GdkColor *, guchar);
182
 
-       gboolean (*has_char)(struct _vte_draw *, vteunistr);
183
 
+                                         struct _vte_draw_text_request *, gsize,
184
 
+                                         GdkColor *, guchar, gboolean);
185
 
+       gboolean (*has_char)(struct _vte_draw *, vteunistr, gboolean);
186
 
        void (*draw_rectangle)(struct _vte_draw *,
187
 
                               gint, gint, gint, gint,
188
 
                               GdkColor *, guchar);
189
 
@@ -151,15 +153,18 @@
190
 
                             VteTerminalAntiAlias anti_alias);
191
 
 void _vte_draw_get_text_metrics(struct _vte_draw *draw,
192
 
                                gint *width, gint *height, gint *ascent);
193
 
-int _vte_draw_get_char_width(struct _vte_draw *draw, vteunistr c, int columns);
194
 
+int _vte_draw_get_char_width(struct _vte_draw *draw, vteunistr c, int columns,
195
 
+                            gboolean bold);
196
 
 
197
 
 void _vte_draw_text(struct _vte_draw *draw,
198
 
                    struct _vte_draw_text_request *requests, gsize n_requests,
199
 
-                   GdkColor *color, guchar alpha);
200
 
+                   GdkColor *color, guchar alpha, gboolean);
201
 
 gboolean _vte_draw_char(struct _vte_draw *draw,
202
 
                        struct _vte_draw_text_request *request,
203
 
-                       GdkColor *color, guchar alpha);
204
 
-gboolean _vte_draw_has_char(struct _vte_draw *draw, vteunistr c);
205
 
+                       GdkColor *color, guchar alpha, gboolean bold);
206
 
+gboolean _vte_draw_has_char(struct _vte_draw *draw, vteunistr c, gboolean bold);
207
 
+gboolean _vte_draw_has_bold(struct _vte_draw *draw);
208
 
+
209
 
 
210
 
 void _vte_draw_fill_rectangle(struct _vte_draw *draw,
211
 
                              gint x, gint y, gint width, gint height,
212
 
diff -Nur -x '*.orig' -x '*~' vte-0.19.4/src/vtepangocairo.c vte-0.19.4.new/src/vtepangocairo.c
213
 
--- vte-0.19.4/src/vtepangocairo.c      2008-12-11 19:47:29.000000000 -0800
214
 
+++ vte-0.19.4.new/src/vtepangocairo.c  2009-02-10 16:16:58.000000000 -0800
215
 
@@ -755,6 +755,7 @@
216
 
 
217
 
 struct _vte_pangocairo_data {
218
 
        struct font_info *font;
219
 
+       struct font_info *font_bold;
220
 
        cairo_pattern_t *bg_pattern;
221
 
 
222
 
        cairo_t *cr;
223
 
@@ -914,9 +915,35 @@
224
 
                               VteTerminalAntiAlias antialias)
225
 
 {
226
 
        struct _vte_pangocairo_data *data = draw->impl_data;
227
 
+       PangoFontDescription *bolddesc = NULL;
228
 
 
229
 
+       if (data->font_bold != data->font)
230
 
+               font_info_destroy (data->font_bold);
231
 
        font_info_destroy (data->font);
232
 
        data->font = font_info_create_for_widget (draw->widget, fontdesc, antialias);
233
 
+
234
 
+       /* calculate bold font desc */
235
 
+       bolddesc = pango_font_description_copy (fontdesc);
236
 
+       if (bolddesc) {
237
 
+               pango_font_description_set_weight (bolddesc, PANGO_WEIGHT_BOLD);
238
 
+
239
 
+               data->font_bold = font_info_create_for_widget (draw->widget, bolddesc, antialias);
240
 
+               pango_font_description_free (bolddesc);
241
 
+
242
 
+               /* Decide if we should keep this bold font face, per bug 54926:
243
 
+                *  - reject bold font if it is not within 10% of normal font width
244
 
+                */
245
 
+               if ( abs((data->font_bold->width * 100 / data->font->width) - 100) > 10 ) {
246
 
+                       g_warning(_("bold font too wide (%d not within 10%% of normal width %d), falling back to double-strike"),
247
 
+                               data->font_bold->width, data->font->width);
248
 
+                       font_info_destroy (data->font_bold);
249
 
+                       data->font_bold = data->font;
250
 
+               }
251
 
+       }
252
 
+       else {
253
 
+               g_warning(_("can not create bold font"));
254
 
+               data->font_bold = data->font;
255
 
+       }
256
 
 }
257
 
 
258
 
 static void
259
 
@@ -934,17 +961,26 @@
260
 
 
261
 
 
262
 
 static int
263
 
-_vte_pangocairo_get_char_width (struct _vte_draw *draw, vteunistr c, int columns)
264
 
+_vte_pangocairo_get_char_width (struct _vte_draw *draw, vteunistr c, int columns,
265
 
+                               gboolean bold)
266
 
 {
267
 
        struct _vte_pangocairo_data *data = draw->impl_data;
268
 
        struct unistr_info *uinfo;
269
 
 
270
 
        g_return_val_if_fail (data->font != NULL, 0);
271
 
 
272
 
-       uinfo = font_info_get_unistr_info (data->font, c);
273
 
+       uinfo = font_info_get_unistr_info (bold ? data->font_bold : data->font, c);
274
 
        return uinfo->width;
275
 
 }
276
 
 
277
 
+static gboolean
278
 
+_vte_pangocairo_has_bold (struct _vte_draw *draw)
279
 
+{
280
 
+       struct _vte_pangocairo_data *data = draw->impl_data;
281
 
+
282
 
+       return (data->font != data->font_bold);
283
 
+}
284
 
+
285
 
 static void
286
 
 set_source_color_alpha (cairo_t        *cr,
287
 
                        const GdkColor *color,
288
 
@@ -960,15 +996,16 @@
289
 
 static void
290
 
 _vte_pangocairo_draw_text (struct _vte_draw *draw,
291
 
                           struct _vte_draw_text_request *requests, gsize n_requests,
292
 
-                          GdkColor *color, guchar alpha)
293
 
+                          GdkColor *color, guchar alpha, gboolean bold)
294
 
 {
295
 
        struct _vte_pangocairo_data *data = draw->impl_data;
296
 
        gsize i;
297
 
        cairo_scaled_font_t *last_scaled_font = NULL;
298
 
        int n_cr_glyphs = 0;
299
 
        cairo_glyph_t cr_glyphs[MAX_RUN_LENGTH];
300
 
+       struct font_info *font = bold ? data->font_bold : data->font;
301
 
 
302
 
-       g_return_if_fail (data->font != NULL);
303
 
+       g_return_if_fail (font != NULL);
304
 
 
305
 
        set_source_color_alpha (data->cr, color, alpha);
306
 
        cairo_set_operator (data->cr, CAIRO_OPERATOR_OVER);
307
 
@@ -976,8 +1013,8 @@
308
 
        for (i = 0; i < n_requests; i++) {
309
 
                vteunistr c = requests[i].c;
310
 
                int x = requests[i].x;
311
 
-               int y = requests[i].y + data->font->ascent;
312
 
-               struct unistr_info *uinfo = font_info_get_unistr_info (data->font, c);
313
 
+               int y = requests[i].y + font->ascent;
314
 
+               struct unistr_info *uinfo = font_info_get_unistr_info (font, c);
315
 
                union unistr_font_info *ufi = &uinfo->ufi;
316
 
 
317
 
                switch (uinfo->coverage) {
318
 
@@ -1024,14 +1061,15 @@
319
 
 }
320
 
 
321
 
 static gboolean
322
 
-_vte_pangocairo_draw_has_char (struct _vte_draw *draw, vteunistr c)
323
 
+_vte_pangocairo_draw_has_char (struct _vte_draw *draw, vteunistr c,
324
 
+                              gboolean bold)
325
 
 {
326
 
        struct _vte_pangocairo_data *data = draw->impl_data;
327
 
        struct unistr_info *uinfo;
328
 
 
329
 
        g_return_val_if_fail (data->font != NULL, FALSE);
330
 
 
331
 
-       uinfo = font_info_get_unistr_info (data->font, c);
332
 
+       uinfo = font_info_get_unistr_info (bold ? data->font_bold : data->font, c);
333
 
        return !uinfo->has_unknown_chars;
334
 
 }
335
 
 
336
 
@@ -1080,6 +1118,7 @@
337
 
        _vte_pangocairo_set_text_font,
338
 
        _vte_pangocairo_get_text_metrics,
339
 
        _vte_pangocairo_get_char_width,
340
 
+       _vte_pangocairo_has_bold,
341
 
        _vte_pangocairo_draw_text,
342
 
        _vte_pangocairo_draw_has_char,
343
 
        _vte_pangocairo_draw_rectangle,