Font.st
changeset 4023 b60e9d3335d3
parent 4007 f6f734115906
child 4116 093ce13b682b
equal deleted inserted replaced
4022:b843fb470796 4023:b60e9d3335d3
    12 
    12 
    13 "{ Package: 'stx:libview' }"
    13 "{ Package: 'stx:libview' }"
    14 
    14 
    15 FontDescription subclass:#Font
    15 FontDescription subclass:#Font
    16 	instanceVariableNames:'device fontId replacementFont ascent descent width isFixedWidth
    16 	instanceVariableNames:'device fontId replacementFont ascent descent width isFixedWidth
    17 		minWidth maxWidth maxAscent maxDescent'
    17 		minWidth maxWidth maxAscent maxDescent minCode maxCode direction'
    18 	classVariableNames:'Replacements'
    18 	classVariableNames:'Replacements'
    19 	poolDictionaries:''
    19 	poolDictionaries:''
    20 	category:'Graphics-Support'
    20 	category:'Graphics-Support'
    21 !
    21 !
    22 
    22 
   526 !Font methodsFor:'private'!
   526 !Font methodsFor:'private'!
   527 
   527 
   528 getFontInfos
   528 getFontInfos
   529     "ask the device about all of my actual attributes"
   529     "ask the device about all of my actual attributes"
   530 
   530 
   531     |b info|
   531     |info|
   532 
   532 
   533     replacementFont notNil ifTrue:[
   533     replacementFont notNil ifTrue:[
   534         replacementFont getFontInfos.
   534         replacementFont getFontInfos.
   535         ^ self
   535         ^ self
   536     ].
   536     ].
   537 
   537 
   538     info := device fontMetricsOf:fontId.
   538     info := self getFontMetrics.
       
   539 
       
   540     minCode := info minCode.
       
   541     maxCode := info maxCode.
       
   542     direction := info direction.
       
   543 
   539     encoding := info encoding.
   544     encoding := info encoding.
   540     encoding isNil ifTrue:[
   545     encoding isNil ifTrue:[
   541         encoding := device encodingOf:fontId.
   546         encoding := device encodingOf:fontId.
   542     ].
   547     ].
   543     ascent := info ascent.
   548     ascent := info ascent.
   559 !
   564 !
   560 
   565 
   561 getFontMetrics
   566 getFontMetrics
   562     "ask the device about all of my actual attributes"
   567     "ask the device about all of my actual attributes"
   563 
   568 
   564     |f|
   569     replacementFont notNil ifTrue:[
   565 
   570         ^ replacementFont getFontMetrics
   566     f := fontId.
   571     ].
   567     replacementFont notNil ifTrue:[
   572 
   568         f := replacementFont fontId.
   573     ^ device fontMetricsOf:fontId.
   569     ].
       
   570 
       
   571     ^ device fontMetricsOf:f.
       
   572 !
   574 !
   573 
   575 
   574 getFontResolution
   576 getFontResolution
   575     "ask the device about all of my actual attributes"
   577     "ask the device about all of my actual attributes"
   576 
   578 
  1021 
  1023 
  1022     "Created: / 30.4.1996 / 16:42:28 / cg"
  1024     "Created: / 30.4.1996 / 16:42:28 / cg"
  1023     "Modified: / 10.9.1998 / 12:11:33 / cg"
  1025     "Modified: / 10.9.1998 / 12:11:33 / cg"
  1024 ! !
  1026 ! !
  1025 
  1027 
       
  1028 !Font methodsFor:'queries-misc'!
       
  1029 
       
  1030 direction
       
  1031     device isNil ifTrue:[
       
  1032         self errorNoDevice
       
  1033     ].
       
  1034     replacementFont notNil ifTrue:[
       
  1035         ^ replacementFont direction
       
  1036     ].
       
  1037     ^ direction
       
  1038 !
       
  1039 
       
  1040 maxCode
       
  1041     device isNil ifTrue:[
       
  1042         self errorNoDevice
       
  1043     ].
       
  1044     replacementFont notNil ifTrue:[
       
  1045         ^ replacementFont maxCode
       
  1046     ].
       
  1047     ^ maxCode
       
  1048 !
       
  1049 
       
  1050 minCode 
       
  1051     device isNil ifTrue:[
       
  1052         self errorNoDevice
       
  1053     ].
       
  1054     replacementFont notNil ifTrue:[
       
  1055         ^ replacementFont minCode
       
  1056     ].
       
  1057     ^ minCode
       
  1058 ! !
       
  1059 
  1026 !Font methodsFor:'st-80 queries'!
  1060 !Font methodsFor:'st-80 queries'!
  1027 
  1061 
  1028 fixedWidth
  1062 fixedWidth
  1029     "return true, if this font is a fixed width font -
  1063     "return true, if this font is a fixed width font -
  1030      for st-80 compatibility"
  1064      for st-80 compatibility"
  1084 ! !
  1118 ! !
  1085 
  1119 
  1086 !Font class methodsFor:'documentation'!
  1120 !Font class methodsFor:'documentation'!
  1087 
  1121 
  1088 version
  1122 version
  1089     ^ '$Header: /cvs/stx/stx/libview/Font.st,v 1.90 2004-02-09 14:34:23 cg Exp $'
  1123     ^ '$Header: /cvs/stx/stx/libview/Font.st,v 1.91 2004-02-19 00:16:23 cg Exp $'
  1090 ! !
  1124 ! !
  1091 
  1125 
  1092 Font initialize!
  1126 Font initialize!