Mercurial > hg > xemacs-beta
comparison src/objects.c @ 3659:98af8a976fc3
[xemacs-hg @ 2006-11-05 22:31:31 by aidan]
Support specifying fonts for particular character sets in Mule; support
translation to ISO 10646-1 for Mule character sets without an otherwise
matching font; move to a vector of X11-charset-X11-registry instead of a
regex for the charset-registry property.
author | aidan |
---|---|
date | Sun, 05 Nov 2006 22:31:46 +0000 |
parents | ad2f4ae9895b |
children | 515b91f904c1 |
comparison
equal
deleted
inserted
replaced
3658:0db1aaedbbef | 3659:98af8a976fc3 |
---|---|
321 if (print_readably) | 321 if (print_readably) |
322 printing_unreadable_object ("#<font-instance 0x%x>", f->header.uid); | 322 printing_unreadable_object ("#<font-instance 0x%x>", f->header.uid); |
323 write_fmt_string_lisp (printcharfun, "#<font-instance %S", 1, f->name); | 323 write_fmt_string_lisp (printcharfun, "#<font-instance %S", 1, f->name); |
324 write_fmt_string_lisp (printcharfun, " on %s", 1, f->device); | 324 write_fmt_string_lisp (printcharfun, " on %s", 1, f->device); |
325 if (!NILP (f->device)) | 325 if (!NILP (f->device)) |
326 MAYBE_DEVMETH (XDEVICE (f->device), print_font_instance, | 326 { |
327 (f, printcharfun, escapeflag)); | 327 MAYBE_DEVMETH (XDEVICE (f->device), print_font_instance, |
328 (f, printcharfun, escapeflag)); | |
329 | |
330 } | |
328 write_fmt_string (printcharfun, " 0x%x>", f->header.uid); | 331 write_fmt_string (printcharfun, " 0x%x>", f->header.uid); |
329 } | 332 } |
330 | 333 |
331 static void | 334 static void |
332 finalize_font_instance (void *header, int for_disksave) | 335 finalize_font_instance (void *header, int for_disksave) |
774 | 777 |
775 static int | 778 static int |
776 font_spec_matches_charset (struct device *d, Lisp_Object charset, | 779 font_spec_matches_charset (struct device *d, Lisp_Object charset, |
777 const Ibyte *nonreloc, Lisp_Object reloc, | 780 const Ibyte *nonreloc, Lisp_Object reloc, |
778 Bytecount offset, Bytecount length, | 781 Bytecount offset, Bytecount length, |
779 int stage) | 782 enum font_specifier_matchspec_stages stage) |
780 { | 783 { |
781 return DEVMETH_OR_GIVEN (d, font_spec_matches_charset, | 784 return DEVMETH_OR_GIVEN (d, font_spec_matches_charset, |
782 (d, charset, nonreloc, reloc, offset, length, | 785 (d, charset, nonreloc, reloc, offset, length, |
783 stage), | 786 stage), |
784 1); | 787 1); |
787 static void | 790 static void |
788 font_validate_matchspec (Lisp_Object matchspec) | 791 font_validate_matchspec (Lisp_Object matchspec) |
789 { | 792 { |
790 CHECK_CONS (matchspec); | 793 CHECK_CONS (matchspec); |
791 Fget_charset (XCAR (matchspec)); | 794 Fget_charset (XCAR (matchspec)); |
795 | |
796 do | |
797 { | |
798 if (EQ(XCDR(matchspec), Qinitial)) | |
799 { | |
800 break; | |
801 } | |
802 if (EQ(XCDR(matchspec), Qfinal)) | |
803 { | |
804 break; | |
805 } | |
806 | |
807 invalid_argument("Invalid font matchspec stage", | |
808 XCDR(matchspec)); | |
809 } while (0); | |
792 } | 810 } |
793 | 811 |
794 void | 812 void |
795 initialize_charset_font_caches (struct device *d) | 813 initialize_charset_font_caches (struct device *d) |
796 { | 814 { |
834 Lisp_Object device = DOMAIN_DEVICE (domain); | 852 Lisp_Object device = DOMAIN_DEVICE (domain); |
835 struct device *d = XDEVICE (device); | 853 struct device *d = XDEVICE (device); |
836 Lisp_Object instance; | 854 Lisp_Object instance; |
837 Lisp_Object charset = Qnil; | 855 Lisp_Object charset = Qnil; |
838 #ifdef MULE | 856 #ifdef MULE |
839 int stage = 0; | 857 enum font_specifier_matchspec_stages stage = initial; |
840 | 858 |
841 if (!UNBOUNDP (matchspec)) | 859 if (!UNBOUNDP (matchspec)) |
842 { | 860 { |
843 charset = Fget_charset (XCAR (matchspec)); | 861 charset = Fget_charset (XCAR (matchspec)); |
844 stage = NILP (XCDR (matchspec)) ? 0 : 1; | 862 |
863 #define FROB(new_stage) if (EQ(Q##new_stage, XCDR(matchspec))) \ | |
864 { \ | |
865 stage = new_stage; \ | |
866 } | |
867 | |
868 FROB(initial) | |
869 else FROB(final) | |
870 else assert(0); | |
871 | |
872 #undef FROB | |
873 | |
845 } | 874 } |
846 #endif | 875 #endif |
847 | 876 |
848 if (FONT_INSTANCEP (instantiator)) | 877 if (FONT_INSTANCEP (instantiator)) |
849 { | 878 { |
862 } | 891 } |
863 | 892 |
864 if (STRINGP (instantiator)) | 893 if (STRINGP (instantiator)) |
865 { | 894 { |
866 #ifdef MULE | 895 #ifdef MULE |
896 /* #### rename these caches. */ | |
867 Lisp_Object cache = stage ? d->charset_font_cache_stage_2 : | 897 Lisp_Object cache = stage ? d->charset_font_cache_stage_2 : |
868 d->charset_font_cache_stage_1; | 898 d->charset_font_cache_stage_1; |
869 #else | 899 #else |
870 Lisp_Object cache = d->font_instance_cache; | 900 Lisp_Object cache = d->font_instance_cache; |
871 #endif | 901 #endif |
919 | 949 |
920 return NILP (instance) ? Qunbound : instance; | 950 return NILP (instance) ? Qunbound : instance; |
921 } | 951 } |
922 else if (VECTORP (instantiator)) | 952 else if (VECTORP (instantiator)) |
923 { | 953 { |
954 Lisp_Object match_inst = Qunbound; | |
924 assert (XVECTOR_LENGTH (instantiator) == 1); | 955 assert (XVECTOR_LENGTH (instantiator) == 1); |
925 return (face_property_matching_instance | 956 |
926 (Fget_face (XVECTOR_DATA (instantiator)[0]), Qfont, | 957 match_inst = face_property_matching_instance |
927 charset, domain, ERROR_ME, 0, depth)); | 958 (Fget_face (XVECTOR_DATA (instantiator)[0]), Qfont, |
959 charset, domain, ERROR_ME, 0, depth, initial); | |
960 | |
961 if (UNBOUNDP(match_inst)) | |
962 { | |
963 match_inst = face_property_matching_instance | |
964 (Fget_face (XVECTOR_DATA (instantiator)[0]), Qfont, | |
965 charset, domain, ERROR_ME, 0, depth, final); | |
966 } | |
967 | |
968 return match_inst; | |
969 | |
928 } | 970 } |
929 else if (NILP (instantiator)) | 971 else if (NILP (instantiator)) |
930 return Qunbound; | 972 return Qunbound; |
931 else | 973 else |
932 ABORT (); /* Eh? */ | 974 ABORT (); /* Eh? */ |