OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright © 2012,2013 Mozilla Foundation. | 2 * Copyright © 2012,2013 Mozilla Foundation. |
3 * Copyright © 2012,2013 Google, Inc. | 3 * Copyright © 2012,2013 Google, Inc. |
4 * | 4 * |
5 * This is part of HarfBuzz, a text shaping library. | 5 * This is part of HarfBuzz, a text shaping library. |
6 * | 6 * |
7 * Permission is hereby granted, without written agreement and without | 7 * Permission is hereby granted, without written agreement and without |
8 * license or royalty fees, to use, copy, modify, and distribute this | 8 * license or royalty fees, to use, copy, modify, and distribute this |
9 * software and its documentation for any purpose, provided that the | 9 * software and its documentation for any purpose, provided that the |
10 * above copyright notice and the following two paragraphs appear in | 10 * above copyright notice and the following two paragraphs appear in |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
138 } | 138 } |
139 | 139 |
140 static CTFontRef | 140 static CTFontRef |
141 create_ct_font (CGFontRef cg_font, CGFloat font_size) | 141 create_ct_font (CGFontRef cg_font, CGFloat font_size) |
142 { | 142 { |
143 CTFontRef ct_font = CTFontCreateWithGraphicsFont (cg_font, font_size, NULL, NU LL); | 143 CTFontRef ct_font = CTFontCreateWithGraphicsFont (cg_font, font_size, NULL, NU LL); |
144 if (unlikely (!ct_font)) { | 144 if (unlikely (!ct_font)) { |
145 DEBUG_MSG (CORETEXT, cg_font, "Font CTFontCreateWithGraphicsFont() failed"); | 145 DEBUG_MSG (CORETEXT, cg_font, "Font CTFontCreateWithGraphicsFont() failed"); |
146 return NULL; | 146 return NULL; |
147 } | 147 } |
148 | |
149 /* crbug.com/576941 and crbug.com/625902 and the investigation in the latter | |
150 * bug indicate that the cascade list reconfiguration occasionally causes | |
151 * crashes in CoreText on OS X 10.9, thus let's skip this step on older | |
152 * operating system versions. */ | |
153 if (&CTGetCoreTextVersion != NULL && CTGetCoreTextVersion() <= kCTVersionNumbe r10_9) | |
Robert Sesek
2016/07/22 15:56:11
This still crashes for me, so I added some logging
| |
154 return ct_font; | |
155 | |
148 CFURLRef original_url = (CFURLRef)CTFontCopyAttribute(ct_font, kCTFontURLAttri bute); | 156 CFURLRef original_url = (CFURLRef)CTFontCopyAttribute(ct_font, kCTFontURLAttri bute); |
149 | 157 |
150 /* Create font copy with cascade list that has LastResort first; this speeds u p CoreText | 158 /* Create font copy with cascade list that has LastResort first; this speeds u p CoreText |
151 * font fallback which we don't need anyway. */ | 159 * font fallback which we don't need anyway. */ |
152 { | 160 { |
153 CTFontDescriptorRef last_resort_font_desc = get_last_resort_font_desc (); | 161 CTFontDescriptorRef last_resort_font_desc = get_last_resort_font_desc (); |
154 CTFontRef new_ct_font = CTFontCreateCopyWithAttributes (ct_font, 0.0, NULL, last_resort_font_desc); | 162 CTFontRef new_ct_font = CTFontCreateCopyWithAttributes (ct_font, 0.0, NULL, last_resort_font_desc); |
155 CFRelease (last_resort_font_desc); | 163 CFRelease (last_resort_font_desc); |
156 if (new_ct_font) | 164 if (new_ct_font) |
157 { | 165 { |
(...skipping 1123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1281 | 1289 |
1282 hb_bool_t | 1290 hb_bool_t |
1283 _hb_coretext_aat_shape (hb_shape_plan_t *shape_plan, | 1291 _hb_coretext_aat_shape (hb_shape_plan_t *shape_plan, |
1284 hb_font_t *font, | 1292 hb_font_t *font, |
1285 hb_buffer_t *buffer, | 1293 hb_buffer_t *buffer, |
1286 const hb_feature_t *features, | 1294 const hb_feature_t *features, |
1287 unsigned int num_features) | 1295 unsigned int num_features) |
1288 { | 1296 { |
1289 return _hb_coretext_shape (shape_plan, font, buffer, features, num_features); | 1297 return _hb_coretext_shape (shape_plan, font, buffer, features, num_features); |
1290 } | 1298 } |
OLD | NEW |