Mercurial > hg > xemacs-beta
diff src/objects-xlike-inc.c @ 4758:75975fd0b7fc
Implement more of the fontconfig API.
Improve implementation, avoiding nonsyntactic macros and compiler warnings.
Clean up some documentation.
Guard against freeing NULL pointers returned from fonconfig.
author | Stephen J. Turnbull <stephen@xemacs.org> |
---|---|
date | Wed, 18 Nov 2009 22:44:28 +0900 |
parents | a23ac8f90a49 |
children | 0d3ccd5a2509 |
line wrap: on
line diff
--- a/src/objects-xlike-inc.c Wed Nov 18 15:25:00 2009 +0900 +++ b/src/objects-xlike-inc.c Wed Nov 18 22:44:28 2009 +0900 @@ -328,7 +328,8 @@ Lisp_Object *charset; /* This is a debug facility, require ASCII. */ Extbyte *language; /* ASCII, please */ - /* Technically this is FcChar8, but fsckin' GCC 4 bitches. */ + /* Technically this is FcChar8, but fsckin' GCC 4 bitches. + RFC 3066 is a combination of ISO 639 and ISO 3166. */ Extbyte *rfc3066; /* ASCII, please */ }; @@ -416,9 +417,7 @@ failure, but that looks like a bug. We check for it with FcGetCurrentConfig(), which *can* fail. */ - if (!FcConfigGetCurrent()) /* #### We should expose FcInit* interfaces - to LISP and decide when to reinitialize - intelligently. */ + if (!FcConfigGetCurrent()) stderr_out ("Failed fontconfig initialization\n"); else { @@ -470,14 +469,14 @@ */ { FcPattern *p = FcFontRenderPrepare (fcc, fontxft, fontxft); - FcChar8 *name; + Extbyte *name; /* full name, including language coverage and repertoire */ - name = FcNameUnparse (p); + name = (Extbyte *) FcNameUnparse (p); eicpy_ext (eistr_fullname, - (Extbyte *) (name ? name : "NOT FOUND"), + (name ? name : "NOT FOUND"), Qfc_font_name_encoding); - free (name); + if (name) free (name); /* long name, omitting coverage and repertoire, plus a number of rarely useful properties */ @@ -494,11 +493,11 @@ FcPatternDel (p, FC_INDEX); FcPatternDel (p, FC_SCALE); FcPatternDel (p, FC_FONTVERSION); - name = FcNameUnparse (p); + name = (Extbyte *) FcNameUnparse (p); eicpy_ext (eistr_longname, - (Extbyte *) (name ? name : "NOT FOUND"), + (name ? name : "NOT FOUND"), Qfc_font_name_encoding); - free (name); + if (name) free (name); /* nickname, just family and size, but "family" names usually have style, slant, and weight */ @@ -510,11 +509,11 @@ FcPatternDel (p, FC_OUTLINE); FcPatternDel (p, FC_SCALABLE); FcPatternDel (p, FC_DPI); - name = FcNameUnparse (p); + name = (Extbyte *) FcNameUnparse (p); eicpy_ext (eistr_shortname, - (Extbyte *) (name ? name : "NOT FOUND"), + (name ? name : "NOT FOUND"), Qfc_font_name_encoding); - free (name); + if (name) free (name); FcPatternDestroy (p); }