Mercurial > hg > xemacs-beta
comparison src/objects.c @ 70:131b0175ea99 r20-0b30
Import from CVS: tag r20-0b30
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:02:59 +0200 |
parents | 859a2309aef8 |
children | 8eaf7971accc |
comparison
equal
deleted
inserted
replaced
69:804d1389bcd6 | 70:131b0175ea99 |
---|---|
674 ((markobj) (FONT_SPECIFIER_FACE_PROPERTY (font))); | 674 ((markobj) (FONT_SPECIFIER_FACE_PROPERTY (font))); |
675 } | 675 } |
676 | 676 |
677 /* No equal or hash methods; ignore the face the font is based off | 677 /* No equal or hash methods; ignore the face the font is based off |
678 of for `equal' */ | 678 of for `equal' */ |
679 | |
680 #ifdef MULE | |
681 | |
682 int | |
683 font_spec_matches_charset (struct device *d, Lisp_Object charset, | |
684 CONST Bufbyte *nonreloc, Lisp_Object reloc, | |
685 Bytecount offset, Bytecount length) | |
686 { | |
687 return DEVMETH_OR_GIVEN (d, font_spec_matches_charset, | |
688 (d, charset, nonreloc, reloc, offset, length), | |
689 1); | |
690 } | |
691 | |
692 static void | |
693 font_validate_matchspec (Lisp_Object matchspec) | |
694 { | |
695 Fget_charset (matchspec); | |
696 } | |
697 | |
698 #endif /* MULE */ | |
699 | |
700 | |
679 static Lisp_Object | 701 static Lisp_Object |
680 font_instantiate (Lisp_Object specifier, Lisp_Object matchspec, | 702 font_instantiate (Lisp_Object specifier, Lisp_Object matchspec, |
681 Lisp_Object domain, Lisp_Object instantiator, | 703 Lisp_Object domain, Lisp_Object instantiator, |
682 Lisp_Object depth) | 704 Lisp_Object depth) |
683 { | 705 { |
685 so we can freely error. */ | 707 so we can freely error. */ |
686 Lisp_Object device = DFW_DEVICE (domain); | 708 Lisp_Object device = DFW_DEVICE (domain); |
687 struct device *d = XDEVICE (device); | 709 struct device *d = XDEVICE (device); |
688 Lisp_Object instance; | 710 Lisp_Object instance; |
689 | 711 |
712 #ifdef MULE | |
713 if (!UNBOUNDP (matchspec)) | |
714 matchspec = Fget_charset (matchspec); | |
715 #endif | |
716 | |
690 if (FONT_INSTANCEP (instantiator)) | 717 if (FONT_INSTANCEP (instantiator)) |
691 { | 718 { |
692 if (NILP (device) /* Vthe_null_color_instance */ | 719 if (NILP (device) |
693 || EQ (device, XFONT_INSTANCE (instantiator)->device)) | 720 || EQ (device, XFONT_INSTANCE (instantiator)->device)) |
694 { | 721 { |
722 #ifdef MULE | |
723 if (font_spec_matches_charset (d, matchspec, 0, | |
724 Ffont_instance_truename | |
725 (instantiator), | |
726 0, -1)) | |
727 return instantiator; | |
728 #else | |
695 return instantiator; | 729 return instantiator; |
730 #endif | |
696 } | 731 } |
697 instantiator = Ffont_instance_name (instantiator); | 732 instantiator = Ffont_instance_name (instantiator); |
698 } | 733 } |
699 | 734 |
700 if (STRINGP (instantiator)) | 735 if (STRINGP (instantiator)) |
701 { | 736 { |
737 #ifdef MULE | |
738 if (!UNBOUNDP (matchspec)) | |
739 { | |
740 /* The instantiator is a font spec that could match many | |
741 different fonts. We need to find one of those fonts | |
742 whose registry matches the registry of the charset in | |
743 MATCHSPEC. This is potentially a very slow operation, | |
744 as it involves doing an XListFonts() or equivalent to | |
745 iterate over all possible fonts, and a regexp match | |
746 on each one. So we cache the results. */ | |
747 Lisp_Object matching_font = Qunbound; | |
748 Lisp_Object hashtab = Fgethash (matchspec, d->charset_font_cache, | |
749 Qunbound); | |
750 if (UNBOUNDP (hashtab)) | |
751 { | |
752 /* need to make a sub hash table. */ | |
753 hashtab = make_lisp_hashtable (20, HASHTABLE_KEY_WEAK, | |
754 HASHTABLE_EQUAL); | |
755 Fputhash (matchspec, hashtab, d->charset_font_cache); | |
756 } | |
757 else | |
758 matching_font = Fgethash (instantiator, hashtab, Qunbound); | |
759 | |
760 if (UNBOUNDP (matching_font)) | |
761 { | |
762 /* make sure we cache the failures, too. */ | |
763 matching_font = | |
764 DEVMETH_OR_GIVEN (d, find_charset_font, | |
765 (device, instantiator, matchspec), | |
766 instantiator); | |
767 Fputhash (instantiator, matching_font, hashtab); | |
768 } | |
769 if (NILP (matching_font)) | |
770 return Qunbound; | |
771 instantiator = matching_font; | |
772 } | |
773 #endif /* MULE */ | |
774 | |
702 /* First, look to see if we can retrieve a cached value. */ | 775 /* First, look to see if we can retrieve a cached value. */ |
703 instance = Fgethash (instantiator, d->font_instance_cache, Qunbound); | 776 instance = Fgethash (instantiator, d->font_instance_cache, Qunbound); |
704 /* Otherwise, make a new one. */ | 777 /* Otherwise, make a new one. */ |
705 if (UNBOUNDP (instance)) | 778 if (UNBOUNDP (instance)) |
706 { | 779 { |
988 SPECIFIER_HAS_METHOD (face_boolean, mark); | 1061 SPECIFIER_HAS_METHOD (face_boolean, mark); |
989 | 1062 |
990 SPECIFIER_HAS_METHOD (color, after_change); | 1063 SPECIFIER_HAS_METHOD (color, after_change); |
991 SPECIFIER_HAS_METHOD (font, after_change); | 1064 SPECIFIER_HAS_METHOD (font, after_change); |
992 SPECIFIER_HAS_METHOD (face_boolean, after_change); | 1065 SPECIFIER_HAS_METHOD (face_boolean, after_change); |
1066 | |
1067 #ifdef MULE | |
1068 SPECIFIER_HAS_METHOD (font, validate_matchspec); | |
1069 #endif | |
993 } | 1070 } |
994 | 1071 |
995 void | 1072 void |
996 vars_of_objects (void) | 1073 vars_of_objects (void) |
997 { | 1074 { |