694 !Font methodsFor:'queries'! |
694 !Font methodsFor:'queries'! |
695 |
695 |
696 ascentOn:aDevice |
696 ascentOn:aDevice |
697 "return the fonts ascent (average), if used on aDevice." |
697 "return the fonts ascent (average), if used on aDevice." |
698 |
698 |
|
699 replacementFont notNil ifTrue:[ |
|
700 ^ replacementFont ascentOn:aDevice |
|
701 ]. |
699 device == aDevice ifTrue:[ |
702 device == aDevice ifTrue:[ |
700 ^ ascent |
703 ^ ascent |
701 ]. |
704 ]. |
702 ^ (self on:aDevice) ascent |
705 ^ (self on:aDevice) ascent |
703 |
706 |
704 "Created: 30.4.1996 / 16:41:32 / cg" |
707 "Created: / 30.4.1996 / 16:41:32 / cg" |
705 "Modified: 30.4.1996 / 16:44:49 / cg" |
708 "Modified: / 10.9.1998 / 12:09:06 / cg" |
706 ! |
709 ! |
707 |
710 |
708 descentOn:aDevice |
711 descentOn:aDevice |
709 "return the fonts descent (average), if used on aDevice." |
712 "return the fonts descent (average), if used on aDevice." |
710 |
713 |
|
714 replacementFont notNil ifTrue:[ |
|
715 ^ replacementFont descentOn:aDevice |
|
716 ]. |
711 device == aDevice ifTrue:[ |
717 device == aDevice ifTrue:[ |
712 ^ descent |
718 ^ descent |
713 ]. |
719 ]. |
714 replacementFont notNil ifTrue:[ |
|
715 ^ replacementFont descentOn:aDevice |
|
716 ]. |
|
717 ^ (self on:aDevice) descent |
720 ^ (self on:aDevice) descent |
718 |
721 |
719 "Created: 30.4.1996 / 16:41:43 / cg" |
722 "Created: / 30.4.1996 / 16:41:43 / cg" |
720 "Modified: 18.6.1997 / 10:11:02 / cg" |
723 "Modified: / 10.9.1998 / 12:09:30 / cg" |
721 ! |
724 ! |
722 |
725 |
723 existsOn:aDevice |
726 existsOn:aDevice |
724 "return true, if the recevier is available on aDevice; |
727 "return true, if the recevier is available on aDevice; |
725 false otherwise. This is a kludge method; its better to |
728 false otherwise. This is a kludge method; its better to |
732 |
735 |
733 heightOf:aString on:aDevice |
736 heightOf:aString on:aDevice |
734 "return the height of aString, if displayed on aDevice. |
737 "return the height of aString, if displayed on aDevice. |
735 The argument must be a string-like object." |
738 The argument must be a string-like object." |
736 |
739 |
|
740 replacementFont notNil ifTrue:[ |
|
741 ^ replacementFont heightOf:aString on:aDevice |
|
742 ]. |
737 device == aDevice ifTrue:[ |
743 device == aDevice ifTrue:[ |
738 ^ self heightOf:aString |
744 ^ self heightOf:aString |
739 ]. |
745 ]. |
740 replacementFont notNil ifTrue:[ |
|
741 ^ replacementFont heightOf:aString on:aDevice |
|
742 ]. |
|
743 ^ (self on:aDevice) heightOf:aString |
746 ^ (self on:aDevice) heightOf:aString |
744 |
747 |
745 "Created: 30.4.1996 / 17:14:18 / cg" |
748 "Created: / 30.4.1996 / 17:14:18 / cg" |
746 "Modified: 18.6.1997 / 10:10:15 / cg" |
749 "Modified: / 10.9.1998 / 12:09:47 / cg" |
747 ! |
750 ! |
748 |
751 |
749 heightOn:aDevice |
752 heightOn:aDevice |
750 "return the fonts height (average), if used on aDevice." |
753 "return the fonts height (average), if used on aDevice." |
751 |
754 |
|
755 replacementFont notNil ifTrue:[ |
|
756 ^ replacementFont heightOn:aDevice |
|
757 ]. |
752 device == aDevice ifTrue:[ |
758 device == aDevice ifTrue:[ |
753 ^ descent + ascent |
759 ^ descent + ascent |
754 ]. |
760 ]. |
755 replacementFont notNil ifTrue:[ |
|
756 ^ replacementFont heightOn:aDevice |
|
757 ]. |
|
758 ^ (self on:aDevice) height |
761 ^ (self on:aDevice) height |
759 |
762 |
760 "Created: 30.4.1996 / 16:41:59 / cg" |
763 "Created: / 30.4.1996 / 16:41:59 / cg" |
761 "Modified: 18.6.1997 / 10:09:46 / cg" |
764 "Modified: / 10.9.1998 / 12:08:18 / cg" |
762 ! |
765 ! |
763 |
766 |
764 widthOf:aString from:startIndex to:endIndex on:aDevice |
767 widthOf:aString from:startIndex to:endIndex on:aDevice |
765 "return the width of substring, if displayed on aDevice. |
768 "return the width of substring, if displayed on aDevice. |
766 The argument may be a Character, String or some Text; |
769 The argument may be a Character, String or some Text; |
767 in the last case the width of the longest line in the text is returned." |
770 in the last case the width of the longest line in the text is returned." |
768 |
771 |
|
772 replacementFont notNil ifTrue:[ |
|
773 ^ replacementFont widthOf:aString from:startIndex to:endIndex on:aDevice |
|
774 ]. |
769 device == aDevice ifTrue:[ |
775 device == aDevice ifTrue:[ |
770 ^ self widthOf:aString from:startIndex to:endIndex |
776 ^ self widthOf:aString from:startIndex to:endIndex |
771 ]. |
777 ]. |
772 replacementFont notNil ifTrue:[ |
|
773 ^ replacementFont widthOf:aString from:startIndex to:endIndex on:aDevice |
|
774 ]. |
|
775 ^ (self on:aDevice) widthOf:aString from:startIndex to:endIndex |
778 ^ (self on:aDevice) widthOf:aString from:startIndex to:endIndex |
776 |
779 |
777 "Created: 30.4.1996 / 17:15:20 / cg" |
780 "Created: / 30.4.1996 / 17:15:20 / cg" |
778 "Modified: 18.6.1997 / 10:11:22 / cg" |
781 "Modified: / 10.9.1998 / 12:10:11 / cg" |
779 ! |
782 ! |
780 |
783 |
781 widthOf:aString on:aDevice |
784 widthOf:aString on:aDevice |
782 "return the width of aString, if displayed on aDevice. |
785 "return the width of aString, if displayed on aDevice. |
783 The argument may be a Character, String or some Text; |
786 The argument may be a Character, String or some Text; |
784 in the last case the width of the longest line in the text is returned." |
787 in the last case the width of the longest line in the text is returned." |
785 |
788 |
|
789 replacementFont notNil ifTrue:[ |
|
790 ^ replacementFont widthOf:aString on:aDevice |
|
791 ]. |
786 device == aDevice ifTrue:[ |
792 device == aDevice ifTrue:[ |
787 ^ self widthOf:aString |
793 ^ self widthOf:aString |
788 ]. |
794 ]. |
789 replacementFont notNil ifTrue:[ |
|
790 ^ replacementFont widthOf:aString on:aDevice |
|
791 ]. |
|
792 ^ (self on:aDevice) widthOf:aString |
795 ^ (self on:aDevice) widthOf:aString |
793 |
796 |
794 "Created: 30.4.1996 / 17:14:18 / cg" |
797 "Created: / 30.4.1996 / 17:14:18 / cg" |
795 "Modified: 18.6.1997 / 10:11:39 / cg" |
798 "Modified: / 10.9.1998 / 12:10:26 / cg" |
796 ! |
799 ! |
797 |
800 |
798 widthOn:aDevice |
801 widthOn:aDevice |
799 "return the fonts width, if used on aDevice. |
802 "return the fonts width, if used on aDevice. |
800 For variable pitch fonts, the width of the space character is returned. |
803 For variable pitch fonts, the width of the space character is returned. |
801 For fixed fonts, this is the same as minWidth or maxWidth (or any character)." |
804 For fixed fonts, this is the same as minWidth or maxWidth (or any character)." |
802 |
805 |
|
806 replacementFont notNil ifTrue:[ |
|
807 ^ replacementFont widthOn:aDevice |
|
808 ]. |
803 device == aDevice ifTrue:[ |
809 device == aDevice ifTrue:[ |
804 ^ self width |
810 ^ self width |
805 ]. |
811 ]. |
806 replacementFont notNil ifTrue:[ |
|
807 ^ replacementFont widthOn:aDevice |
|
808 ]. |
|
809 ^ (self on:aDevice) width |
812 ^ (self on:aDevice) width |
810 |
813 |
811 "Created: 30.4.1996 / 16:42:28 / cg" |
814 "Created: / 30.4.1996 / 16:42:28 / cg" |
812 "Modified: 18.6.1997 / 10:11:54 / cg" |
815 "Modified: / 10.9.1998 / 12:11:33 / cg" |
813 ! ! |
816 ! ! |
814 |
817 |
815 !Font methodsFor:'queries-deviceFonts'! |
818 !Font methodsFor:'queries-deviceFonts'! |
816 |
819 |
817 ascent |
820 ascent |