Mercurial > hg > xemacs-beta
changeset 4757:a23ac8f90a49
Improve warning and error messages from Xft.
Default debug-level messages off.
Cast away Xft warnings from C compiler.
author | Stephen J. Turnbull <stephen@xemacs.org> |
---|---|
date | Wed, 18 Nov 2009 15:25:00 +0900 |
parents | 5d67242595a8 |
children | 75975fd0b7fc |
files | src/ChangeLog src/font-mgr.c src/font-mgr.h src/objects-x.c src/objects-xlike-inc.c src/objects.c |
diffstat | 6 files changed, 51 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog Wed Nov 18 11:28:58 2009 +0900 +++ b/src/ChangeLog Wed Nov 18 15:25:00 2009 +0900 @@ -1,3 +1,17 @@ +2009-10-18 Stephen J. Turnbull <stephen@xemacs.org> + + * font-mgr.h (PRINT_XFT_PATTERN): + Cast away some warnings. + + * font-mgr.h (PRINT_XFT_PATTERN): + * objects-x.c (x_font_instance_truename): + * objects-xlike-inc.c (xft_find_charset_font): + * objects.c (font_instance_truename_internal): + Improve error checking and reporting for Xft fonts. + + * font-mgr.c (vars_of_font_mgr): + Set xft-debug-level to 0. + 2008-07-23 Stephen J. Turnbull <stephen@xemacs.org> * objects-xlike-inc.c (charset_table): Add names and ISO 639 codes
--- a/src/font-mgr.c Wed Nov 18 11:28:58 2009 +0900 +++ b/src/font-mgr.c Wed Nov 18 15:25:00 2009 +0900 @@ -1264,7 +1264,7 @@ Default is 1 to ensure a minimum of debugging output at initialization. Higher levels give even more information. */ ); - debug_xft = 1; + debug_xft = 0; DEFVAR_CONST_INT("xft-version", &xft_version /* The major version number of the Xft library being used.
--- a/src/font-mgr.h Wed Nov 18 11:28:58 2009 +0900 +++ b/src/font-mgr.h Wed Nov 18 15:25:00 2009 +0900 @@ -146,9 +146,11 @@ #define PRINT_XFT_PATTERN(level,format,pattern) \ do { \ DECLARE_EISTRING (eistrpxft_name); \ - FcChar8 *name = FcNameUnparse (pattern); \ + Extbyte *name = (Extbyte *) FcNameUnparse (pattern); \ \ - eicpy_ext(eistrpxft_name, name, Qfc_font_name_encoding); \ + eicpy_ext(eistrpxft_name, \ + name ? name : "FONT WITH NULL NAME", \ + Qfc_font_name_encoding); \ DEBUG_XFT1 (level, format, eidata(eistrpxft_name)); \ free (name); \ } while (0)
--- a/src/objects-x.c Wed Nov 18 11:28:58 2009 +0900 +++ b/src/objects-x.c Wed Nov 18 15:25:00 2009 +0900 @@ -758,6 +758,12 @@ { /* The font is already open, we just unparse. */ FcChar8 *res = FcNameUnparse (FONT_INSTANCE_X_XFTFONT (f)->pattern); + if (! FONT_INSTANCE_X_XFTFONT (f)->pattern) + { + maybe_signal_error (Qgui_error, + "Xft font present but lacks pattern", + wrap_font_instance(f), Qfont, errb); + } if (res) { FONT_INSTANCE_TRUENAME (f) = @@ -769,7 +775,7 @@ { maybe_signal_error (Qgui_error, "Couldn't unparse Xft font to truename", - Qnil, Qfont, errb); + wrap_font_instance(f), Qfont, errb); /* used to return Qnil here */ } }
--- a/src/objects-xlike-inc.c Wed Nov 18 11:28:58 2009 +0900 +++ b/src/objects-xlike-inc.c Wed Nov 18 15:25:00 2009 +0900 @@ -447,8 +447,18 @@ PRINT_XFT_PATTERN (3, "FcDefaultSubstitute'ed name is %s\n", p); /* #### check fcresult of following match? */ fontxft = FcFontMatch (fcc, p, &fcresult); - /* this prints the long fontconfig name */ - PRINT_XFT_PATTERN (1, "FcFontMatch'ed name is %s\n", fontxft); + switch (fcresult) + { + /* case FcResultOutOfMemory: */ + case FcResultNoMatch: + case FcResultTypeMismatch: + case FcResultNoId: + break; + case FcResultMatch: + /* this prints the long fontconfig name */ + PRINT_XFT_PATTERN (1, "FcFontMatch'ed name is %s\n", fontxft); + break; + } FcPatternDestroy (p); } @@ -464,7 +474,9 @@ /* full name, including language coverage and repertoire */ name = FcNameUnparse (p); - eicpy_ext (eistr_fullname, (Extbyte *) name, Qfc_font_name_encoding); + eicpy_ext (eistr_fullname, + (Extbyte *) (name ? name : "NOT FOUND"), + Qfc_font_name_encoding); free (name); /* long name, omitting coverage and repertoire, plus a number @@ -483,7 +495,9 @@ FcPatternDel (p, FC_SCALE); FcPatternDel (p, FC_FONTVERSION); name = FcNameUnparse (p); - eicpy_ext (eistr_longname, (Extbyte *) name, Qfc_font_name_encoding); + eicpy_ext (eistr_longname, + (Extbyte *) (name ? name : "NOT FOUND"), + Qfc_font_name_encoding); free (name); /* nickname, just family and size, but @@ -497,7 +511,9 @@ FcPatternDel (p, FC_SCALABLE); FcPatternDel (p, FC_DPI); name = FcNameUnparse (p); - eicpy_ext (eistr_shortname, (Extbyte *) name, Qfc_font_name_encoding); + eicpy_ext (eistr_shortname, + (Extbyte *) (name ? name : "NOT FOUND"), + Qfc_font_name_encoding); free (name); FcPatternDestroy (p);
--- a/src/objects.c Wed Nov 18 11:28:58 2009 +0900 +++ b/src/objects.c Wed Nov 18 15:25:00 2009 +0900 @@ -497,8 +497,10 @@ if (NILP (f->device)) { - maybe_signal_error (Qgui_error, "Couldn't determine font truename", - font_instance, Qfont, errb); + maybe_signal_error (Qgui_error, + "can't determine truename: " + "no device for font instance", + font_instance, Qfont, errb); return Qnil; }