comparison src/objects-xlike-inc.c @ 5015:d95c102a96d3

cleanups for specifier font stages, from ben-unicode-internal (preparation for eliminating shadowed warnings) -------------------- ChangeLog entries follow: -------------------- src/ChangeLog addition: 2010-02-08 Ben Wing <ben@xemacs.org> * faces.c: * faces.c (face_property_matching_instance): * faces.c (ensure_face_cachel_contains_charset): * faces.h (FACE_FONT): * lisp.h: * lisp.h (enum font_specifier_matchspec_stages): * objects-msw.c: * objects-msw.c (mswindows_font_spec_matches_charset): * objects-msw.c (mswindows_find_charset_font): * objects-tty.c: * objects-tty.c (tty_font_spec_matches_charset): * objects-tty.c (tty_find_charset_font): * objects-xlike-inc.c: * objects-xlike-inc.c (XFUN): * objects-xlike-inc.c (xft_find_charset_font): * objects.c: * objects.c (font_instantiate): * objects.c (FROB): * specifier.c: * specifier.c (charset_matches_specifier_tag_set_p): * specifier.c (call_charset_predicate): * specifier.c (define_specifier_tag): * specifier.c (Fdefine_specifier_tag): * specifier.c (setup_charset_initial_specifier_tags): * specifier.c (specifier_instance_from_inst_list): * specifier.c (FROB): * specifier.c (vars_of_specifier): * specifier.h: Rename the specifier-font-matching stages in preparation for eliminating shadowed warnings, some other related fixes from ben-unicode-internal. 1. Rename raw enums: initial -> STAGE_INITIAL final -> STAGE_FINAL impossible -> NUM_MATCHSPEC_STAGES 2. Move `enum font_specifier_matchspec_stages' from specifier.h to lisp.h. 3. Whitespace changes to match coding standards. 4. Eliminate unused second argument STAGE in charset predicates that don't use it -- the code that calls the charset predicates is now smart enough to supply the right number of arguments automatically. 5. Add some long(ish) comments and authorial notices, esp. in objects.c. 6. In specifier.c, change Vcharset_tag_lists from a vector over leading bytes to a hash table over charsets. This change is unnecessary currently but doesn't hurt and will be required when we merge in Unicode-internal. 7. In specifier.c, extract out the code that calls charset predicates into a function call_charset_predicate().
author Ben Wing <ben@xemacs.org>
date Mon, 08 Feb 2010 16:51:25 -0600
parents 4aebb0131297
children
comparison
equal deleted inserted replaced
5014:c2e0c3af5fe3 5015:d95c102a96d3
1 /* Common code between X and GTK -- fonts and colors. 1 /* Common code between X and GTK -- fonts and colors.
2 Copyright (C) 1991-5, 1997 Free Software Foundation, Inc. 2 Copyright (C) 1991-5, 1997 Free Software Foundation, Inc.
3 Copyright (C) 1995 Sun Microsystems, Inc. 3 Copyright (C) 1995 Sun Microsystems, Inc.
4 Copyright (C) 1996, 2001, 2002, 2003 Ben Wing. 4 Copyright (C) 1996, 2001, 2002, 2003, 2010 Ben Wing.
5 5
6 This file is part of XEmacs. 6 This file is part of XEmacs.
7 7
8 XEmacs is free software; you can redistribute it and/or modify it 8 XEmacs is free software; you can redistribute it and/or modify it
9 under the terms of the GNU General Public License as published by the 9 under the terms of the GNU General Public License as published by the
104 the_nonreloc = XSTRING_DATA (reloc); 104 the_nonreloc = XSTRING_DATA (reloc);
105 fixup_internal_substring (nonreloc, reloc, offset, &the_length); 105 fixup_internal_substring (nonreloc, reloc, offset, &the_length);
106 the_nonreloc += offset; 106 the_nonreloc += offset;
107 107
108 #ifdef USE_XFT 108 #ifdef USE_XFT
109 if (stage) 109 if (stage == STAGE_FINAL)
110 { 110 {
111 Display *dpy = DEVICE_X_DISPLAY (d); 111 Display *dpy = DEVICE_X_DISPLAY (d);
112 Extbyte *extname; 112 Extbyte *extname;
113 XftFont *rf; 113 XftFont *rf;
114 const Ibyte *the_nonreloc; 114 const Ibyte *the_nonreloc;
144 && (5 > (count_hyphens(the_nonreloc, the_length, NULL)))) 144 && (5 > (count_hyphens(the_nonreloc, the_length, NULL))))
145 { 145 {
146 return 1; 146 return 1;
147 } 147 }
148 148
149 if (final == stage) 149 if (STAGE_FINAL == stage)
150 { 150 {
151 registries = Qunicode_registries; 151 registries = Qunicode_registries;
152 } 152 }
153 else if (initial == stage) 153 else if (STAGE_INITIAL == stage)
154 { 154 {
155 registries = XCHARSET_REGISTRIES (charset); 155 registries = XCHARSET_REGISTRIES (charset);
156 if (NILP(registries)) 156 if (NILP(registries))
157 { 157 {
158 return 0; 158 return 0;
387 const Extbyte *patternext; 387 const Extbyte *patternext;
388 Lisp_Object result = Qnil; 388 Lisp_Object result = Qnil;
389 389
390 /* #### with Xft need to handle second stage here -- sjt 390 /* #### with Xft need to handle second stage here -- sjt
391 Hm. Or maybe not. That would be cool. :-) */ 391 Hm. Or maybe not. That would be cool. :-) */
392 if (stage) 392 if (stage == STAGE_FINAL)
393 return Qnil; 393 return Qnil;
394 394
395 /* Fontconfig converts all FreeType names to UTF-8 before passing them 395 /* Fontconfig converts all FreeType names to UTF-8 before passing them
396 back to callers---see fcfreetype.c (FcFreeTypeQuery). 396 back to callers---see fcfreetype.c (FcFreeTypeQuery).
397 I don't believe this is documented. */ 397 I don't believe this is documented. */
681 } 681 }
682 #endif 682 #endif
683 683
684 switch (stage) 684 switch (stage)
685 { 685 {
686 case initial: 686 case STAGE_INITIAL:
687 { 687 {
688 if (!(NILP(XCHARSET_REGISTRIES(charset))) 688 if (!(NILP(XCHARSET_REGISTRIES(charset)))
689 && VECTORP(XCHARSET_REGISTRIES(charset))) 689 && VECTORP(XCHARSET_REGISTRIES(charset)))
690 { 690 {
691 registries_len = XVECTOR_LENGTH(XCHARSET_REGISTRIES(charset)); 691 registries_len = XVECTOR_LENGTH(XCHARSET_REGISTRIES(charset));
692 registries = XCHARSET_REGISTRIES(charset); 692 registries = XCHARSET_REGISTRIES(charset);
693 } 693 }
694 break; 694 break;
695 } 695 }
696 case final: 696 case STAGE_FINAL:
697 { 697 {
698 registries_len = 1; 698 registries_len = 1;
699 registries = Qunicode_registries; 699 registries = Qunicode_registries;
700 break; 700 break;
701 } 701 }