diff options
| author | Pip Cet | 2020-10-22 13:40:34 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2020-10-22 13:40:34 +0200 |
| commit | 954a4decfcc8e41084789516773b22d0adc11d91 (patch) | |
| tree | d8d016462af3a663562220b5b28ba4a76b587fe4 /src | |
| parent | 701ed2e4edd470f8b45de7671becde30b3786989 (diff) | |
| download | emacs-954a4decfcc8e41084789516773b22d0adc11d91.tar.gz emacs-954a4decfcc8e41084789516773b22d0adc11d91.zip | |
Handle Cairo errors in ftcrfont_open
* src/ftcrfont.c (ftcrfont_open): Handle Cairo errors (bug#41627).
Diffstat (limited to 'src')
| -rw-r--r-- | src/ftcrfont.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/ftcrfont.c b/src/ftcrfont.c index 4892a34a3ab..a10308c62ee 100644 --- a/src/ftcrfont.c +++ b/src/ftcrfont.c | |||
| @@ -139,7 +139,8 @@ ftcrfont_open (struct frame *f, Lisp_Object entity, int pixel_size) | |||
| 139 | 139 | ||
| 140 | FcPatternDestroy (pat); | 140 | FcPatternDestroy (pat); |
| 141 | font_face = cairo_ft_font_face_create_for_pattern (match); | 141 | font_face = cairo_ft_font_face_create_for_pattern (match); |
| 142 | if (!font_face) | 142 | if (!font_face |
| 143 | || cairo_font_face_status (font_face) != CAIRO_STATUS_SUCCESS) | ||
| 143 | { | 144 | { |
| 144 | unblock_input (); | 145 | unblock_input (); |
| 145 | FcPatternDestroy (match); | 146 | FcPatternDestroy (match); |
| @@ -154,6 +155,18 @@ ftcrfont_open (struct frame *f, Lisp_Object entity, int pixel_size) | |||
| 154 | cairo_font_face_destroy (font_face); | 155 | cairo_font_face_destroy (font_face); |
| 155 | cairo_font_options_destroy (options); | 156 | cairo_font_options_destroy (options); |
| 156 | unblock_input (); | 157 | unblock_input (); |
| 158 | if (!scaled_font | ||
| 159 | || cairo_scaled_font_status (scaled_font) != CAIRO_STATUS_SUCCESS) | ||
| 160 | { | ||
| 161 | FcPatternDestroy (match); | ||
| 162 | return Qnil; | ||
| 163 | } | ||
| 164 | ft_face = cairo_ft_scaled_font_lock_face (scaled_font); | ||
| 165 | if (!ft_face) | ||
| 166 | { | ||
| 167 | FcPatternDestroy (match); | ||
| 168 | return Qnil; | ||
| 169 | } | ||
| 157 | 170 | ||
| 158 | font_object = font_build_object (VECSIZE (struct font_info), | 171 | font_object = font_build_object (VECSIZE (struct font_info), |
| 159 | AREF (entity, FONT_TYPE_INDEX), | 172 | AREF (entity, FONT_TYPE_INDEX), |
| @@ -234,7 +247,6 @@ ftcrfont_open (struct frame *f, Lisp_Object entity, int pixel_size) | |||
| 234 | font->descent = font->height - font->ascent; | 247 | font->descent = font->height - font->ascent; |
| 235 | } | 248 | } |
| 236 | 249 | ||
| 237 | ft_face = cairo_ft_scaled_font_lock_face (scaled_font); | ||
| 238 | if (XFIXNUM (AREF (entity, FONT_SIZE_INDEX)) == 0) | 250 | if (XFIXNUM (AREF (entity, FONT_SIZE_INDEX)) == 0) |
| 239 | { | 251 | { |
| 240 | int upEM = ft_face->units_per_EM; | 252 | int upEM = ft_face->units_per_EM; |