FontDescription.st
changeset 7561 a9ba31e29ade
parent 7443 e2d05b756727
child 7566 e15d5734e788
equal deleted inserted replaced
7560:086e2f28082c 7561:a9ba31e29ade
       
     1 "{ Encoding: utf8 }"
       
     2 
     1 "
     3 "
     2  COPYRIGHT (c) 1994 by Claus Gittinger
     4  COPYRIGHT (c) 1994 by Claus Gittinger
     3 	      All Rights Reserved
     5 	      All Rights Reserved
     4 
     6 
     5  This software is furnished under a license and may be used
     7  This software is furnished under a license and may be used
     7  inclusion of the above copyright notice.   This software may not
     9  inclusion of the above copyright notice.   This software may not
     8  be provided or otherwise made available to, or used by, any
    10  be provided or otherwise made available to, or used by, any
     9  other person.  No title to or ownership of the software is
    11  other person.  No title to or ownership of the software is
    10  hereby transferred.
    12  hereby transferred.
    11 "
    13 "
    12 'From Smalltalk/X, Version:7.1.0.0 on 20-07-2016 at 15:21:49'                   !
       
    13 
       
    14 "{ Package: 'stx:libview' }"
    14 "{ Package: 'stx:libview' }"
    15 
    15 
    16 "{ NameSpace: Smalltalk }"
    16 "{ NameSpace: Smalltalk }"
    17 
    17 
    18 Object subclass:#FontDescription
    18 Object subclass:#FontDescription
   928 
   928 
   929 = aFont
   929 = aFont
   930     "two fonts are considered equal, if the font-name components are;
   930     "two fonts are considered equal, if the font-name components are;
   931      independent of the device, the font is on"
   931      independent of the device, the font is on"
   932 
   932 
   933     (aFont species == self species) ifFalse:[^ false].
   933     (aFont species ~~ self species) ifTrue:[^ false].
   934     (size == aFont size) ifFalse:[^ false].  
   934     (size ~~ aFont size) ifTrue:[^ false].  
   935     (family = aFont family) ifFalse:[^ false].  
   935     (family ~= aFont family) ifTrue:[^ false].  
   936     (face = aFont face) ifFalse:[^ false].  
   936     (face ~= aFont face) ifTrue:[^ false].  
   937     (style = aFont style) ifFalse:[^ false].  
   937     (style ~= aFont style) ifTrue:[^ false].  
   938     (encoding == aFont encoding) ifFalse:[^ false].  
   938     (encoding ~~ aFont encoding) ifTrue:[^ false].  
   939     (sizeUnit == aFont sizeUnit) ifFalse:[^ false].
   939     (sizeUnit ~~ aFont sizeUnit) ifTrue:[^ false].
   940     sizeUnit == #px ifTrue:[
   940     sizeUnit == #px ifTrue:[
   941         (pixelSize == aFont pixelSize) ifFalse:[^ false].  
   941         (pixelSize ~~ aFont pixelSize) ifTrue:[^ false].  
       
   942     ] ifFalse:[
       
   943         (size ~~ aFont size) ifTrue:[^ false].  
   942     ].
   944     ].
   943     ^ true
   945     ^ true
   944 
   946 
   945     "Modified: / 20-05-2014 / 11:18:31 / gg"
   947     "Modified: / 20-05-2014 / 11:18:31 / gg"
   946 !
   948 !
   956     "Created: / 19.6.1998 / 04:19:06 / cg"
   958     "Created: / 19.6.1998 / 04:19:06 / cg"
   957     "Modified: / 20.6.1998 / 17:04:00 / cg"
   959     "Modified: / 20.6.1998 / 17:04:00 / cg"
   958 !
   960 !
   959 
   961 
   960 sameDeviceFontAs:aFont
   962 sameDeviceFontAs:aFont
   961     aFont species == self species ifFalse:[^ false].
   963     aFont species ~~ self species ifTrue:[^ false].
   962 
   964 
   963     (family = aFont family) ifFalse:[ ^ false ].
   965     (family ~= aFont family) ifTrue:[ ^ false ].
   964     (face = aFont face) ifFalse:[ ^ false ].
   966     (face ~= aFont face) ifTrue:[ ^ false ].
   965     ((style = aFont style) 
   967     ((style = aFont style) 
   966       or:[ (style = 'italic' and:[aFont style = 'oblique'])
   968       or:[ (style = 'italic' and:[aFont style = 'oblique'])
   967       or:[ style = 'oblique' and:[aFont style = 'italic']]]) ifFalse:[ ^ false ].
   969       or:[ style = 'oblique' and:[aFont style = 'italic']]]) ifFalse:[ ^ false ].
   968 
   970 
   969     (encoding isNil or:[encoding = aFont encoding]) ifFalse:[ ^ false ].
   971     (encoding isNil or:[encoding = aFont encoding]) ifFalse:[ ^ false ].
   970     (sizeUnit ? #pt) = aFont sizeUnit ifFalse:[ ^ false ].
   972     (sizeUnit ? #pt) ~= aFont sizeUnit ifTrue:[ ^ false ].
   971     (sizeUnit ? #pt) == #pt ifTrue:[
   973     (sizeUnit ? #pt) == #pt ifTrue:[
   972         (size = aFont size) ifFalse:[ ^ false ].
   974         (size ~= aFont size) ifTrue:[ ^ false ].
   973     ] ifFalse:[
   975     ] ifFalse:[
   974         (pixelSize = aFont pixelSize) ifFalse:[ ^ false ].
   976         (pixelSize ~= aFont pixelSize) ifTrue:[ ^ false ].
   975     ].
   977     ].
   976     ^ true
   978     ^ true
   977 ! !
   979 ! !
   978 
   980 
   979 !FontDescription methodsFor:'converting'!
   981 !FontDescription methodsFor:'converting'!