Mercurial > hg > xemacs-beta
comparison src/font-mgr.c @ 5818:15b0715c204d
Avoid passing patterns to with charset property to FcNameUnparse.
Prevents crash reported by Raymond Toy.
author | Stephen J. Turnbull <stephen@xemacs.org> |
---|---|
date | Sat, 18 Oct 2014 21:20:42 +0900 |
parents | 23dc211f4d2f |
children | 6928877dbc26 |
comparison
equal
deleted
inserted
replaced
5817:a58070ee1f31 | 5818:15b0715c204d |
---|---|
253 | 253 |
254 /* #### Ga-a-ack! Xft's similar function is actually a different API. | 254 /* #### Ga-a-ack! Xft's similar function is actually a different API. |
255 We provide both. */ | 255 We provide both. */ |
256 DEFUN ("fc-name-unparse", Ffc_name_unparse, 1, 1, 0, /* | 256 DEFUN ("fc-name-unparse", Ffc_name_unparse, 1, 1, 0, /* |
257 Unparse an fc pattern object to a string. | 257 Unparse an fc pattern object to a string. |
258 To work around a bug in fontconfig (at least 2.11.1), the 'charset' property | |
259 is removed before passing to FcNameUnparse. To extract the 'charset' property, | |
260 use `\(fc-pattern-get PATTERN "charset")'. | |
258 */ | 261 */ |
259 (pattern)) | 262 (pattern)) |
260 { | 263 { |
261 FcChar8 *name; | 264 FcChar8 *name; |
262 Lisp_Object result; | 265 Lisp_Object result; |
266 | |
263 CHECK_FC_PATTERN (pattern); | 267 CHECK_FC_PATTERN (pattern); |
268 /* #### Could use multiple values here to extract and return charset? */ | |
269 FcPatternDel (XFC_PATTERN_PTR (pattern), FC_CHARSET); | |
270 | |
264 name = FcNameUnparse (XFC_PATTERN_PTR (pattern)); | 271 name = FcNameUnparse (XFC_PATTERN_PTR (pattern)); |
265 result = build_fcapi_string (name); | 272 result = build_fcapi_string (name); |
266 xfree (name); | 273 xfree (name); |
267 return result; | 274 return result; |
268 } | 275 } |
335 return res ? Qt : Qnil; | 342 return res ? Qt : Qnil; |
336 } | 343 } |
337 | 344 |
338 /* Generic interface to FcPatternGet() | 345 /* Generic interface to FcPatternGet() |
339 * Don't support the losing symbol-for-property interface. | 346 * Don't support the losing symbol-for-property interface. |
347 * To support that interface properly, we should have `fc-register-property' | |
348 * so that only registered symbols could be used. Then it would serve to | |
349 * provide the same kind of check that the C-level FC_* macros do. | |
340 */ | 350 */ |
341 DEFUN ("fc-pattern-get", Ffc_pattern_get, 2, 4, 0, /* | 351 DEFUN ("fc-pattern-get", Ffc_pattern_get, 2, 4, 0, /* |
342 From PATTERN, extract PROPERTY for the ID'th member, of type TYPE. | 352 From PATTERN, extract PROPERTY for the ID'th member, of type TYPE. |
343 | 353 |
344 PATTERN is an Xft (fontconfig) pattern object. | 354 PATTERN is an Xft (fontconfig) pattern object. |