FontDescription.st
changeset 7343 7ec79c481378
parent 7239 fc6eccef933b
child 7364 262ab56176cb
child 7443 e2d05b756727
equal deleted inserted replaced
7342:bb5f94f9aae9 7343:7ec79c481378
    44 documentation
    44 documentation
    45 "
    45 "
    46     FontDescription is just a place-holder for scanned font names.
    46     FontDescription is just a place-holder for scanned font names.
    47 
    47 
    48     [Instance variables:]
    48     [Instance variables:]
    49         family          <String>        the fonts family ('courier', 'helvetica' etc)
    49         family          <String>        the font's family ('courier', 'helvetica' etc)
    50         face            <String>        the fonts face ('bold', 'medium' etc)
    50         face            <String>        the font's face ('bold', 'medium' etc)
    51         style           <String>        the fonts style ('roman', 'italic', 'oblique')
    51         style           <String>        the font's style ('roman', 'italic', 'oblique')
    52         size            <String>        the fonts size (by default, in points, not in pixels; but see sizeUnit) 
    52         size            <String>        the font's size (by default, in points, not in pixels; but see sizeUnit) 
    53         encoding        <Symbol>        the fonts encoding (usually #iso8859-1)
    53         encoding        <Symbol>        the font's encoding (usually #iso8859-1)
    54 
    54 
    55         manufacturer    <nil|String|Array>
    55         manufacturer    <nil|String|Array>
    56                                         the fonts origin - if known
    56                                         the font's origin - if known
    57         name            <nil|String|Array>
    57         name            <nil|String|Array>
    58                                         the platform specific name
    58                                         the platform specific name
    59 
    59 
    60         flags           <SmallInteger>  holds serif/italic etc. as flag bits
    60         flags           <SmallInteger>  holds serif/italic etc. as flag bits
    61         masks           <SmallInteger>  currently dummy; to allow ST-80 compatible subclassing
    61         masks           <SmallInteger>  currently dummy; to allow ST-80 compatible subclassing
   645     self obsoleteMethodWarning:'use #graphicsDevice'.
   645     self obsoleteMethodWarning:'use #graphicsDevice'.
   646     ^ self graphicsDevice
   646     ^ self graphicsDevice
   647 !
   647 !
   648 
   648 
   649 encoding
   649 encoding
   650     "return the fonts encoding, as a symbol
   650     "return the font's encoding, as a symbol
   651      such as #'iso8859', #'jis0208.1983' or #ascii.
   651      such as #'iso8859', #'jis0208.1983' or #ascii.
   652      If the fonts encoding is not known, return nil; 
   652      If the encoding is not known, return nil; 
   653      You should assume ascii-encoding then."
   653      You should assume ascii/iso8859-encoding then."
   654 
   654 
   655     ^ encoding
   655     ^ encoding
   656 
   656 
   657     "Modified: 20.4.1996 / 23:14:36 / cg"
   657     "Modified: 20.4.1996 / 23:14:36 / cg"
   658 !
   658 !
  1562 
  1562 
  1563     self subclassResponsibility
  1563     self subclassResponsibility
  1564 !
  1564 !
  1565 
  1565 
  1566 maxAscent
  1566 maxAscent
  1567     "return the fonts maximum-ascent (i.e. the maximum of all characters);
  1567     "return the font's maximum-ascent (i.e. the maximum of all characters);
  1568      That is the number of units (usually pixels) above the baseline."
  1568      That is the number of units (usually pixels) above the baseline."
  1569 
  1569 
  1570     ^ self subclassResponsibility
  1570     ^ self subclassResponsibility
  1571 
       
  1572 !
  1571 !
  1573 
  1572 
  1574 maxCode
  1573 maxCode
  1575     "return the biggest UCS code in font.
  1574     "return the biggest UCS code in font.
  1576      Dummy for now"
  1575      Dummy for now"
  1577 
  1576 
  1578     ^ 16rFFFF
  1577     ^ 16rFFFF
  1579 !
  1578 !
  1580 
  1579 
  1581 maxDescent
  1580 maxDescent
  1582     "return the fonts maximum-descent (i.e. the maximum of all characters);
  1581     "return the font's maximum-descent (i.e. the maximum of all characters);
  1583      That is the number of units (usually pixels) below the baseline."
  1582      That is the number of units (usually pixels) below the baseline."
  1584 
  1583 
  1585     ^ self subclassResponsibility
  1584     ^ self subclassResponsibility
  1586 
       
  1587 !
  1585 !
  1588 
  1586 
  1589 maxHeight
  1587 maxHeight
  1590     "return the fonts characters maximum height;
  1588     "return the font's characters maximum height;
  1591      That is the number of units (usually pixels)."
  1589      That is the number of units (usually pixels)."
  1592 
  1590 
  1593     ^ self maxAscent + self maxDescent
  1591     ^ self maxAscent + self maxDescent
  1594 
       
  1595 !
  1592 !
  1596 
  1593 
  1597 maxWidth
  1594 maxWidth
  1598     "return the fonts maximum-width character (i.e. the maximum of all characters);
  1595     "return the font's maximum-width character (i.e. the maximum of all characters);
  1599      That is a number of units (usually pixels)."
  1596      That is a number of units (usually pixels)."
  1600 
  1597 
  1601     ^ self subclassResponsibility
  1598     ^ self subclassResponsibility
  1602 
       
  1603 !
  1599 !
  1604 
  1600 
  1605 minCode
  1601 minCode
  1606     "return the smallest UCS code in font.
  1602     "return the smallest UCS code in font.
  1607      Dummy for now"
  1603      Dummy for now"
  1608 
  1604 
  1609     ^ 0
  1605     ^ 0
  1610 !
  1606 !
  1611 
  1607 
  1612 width
  1608 width
  1613     "return the fonts characters width;
  1609     "return the font's characters width;
  1614      That is a number of units (usually pixels).
  1610      That is a number of units (usually pixels).
  1615      For variable pitch fonts, the width of the space character is returned.
  1611      For variable pitch fonts, the width of the space character is returned.
  1616      For fixed fonts, this is the same as minWidth or maxWidth (or any character).
  1612      For fixed fonts, this is the same as minWidth or maxWidth (or any character).
  1617      The receiver must be associated to a device, for this query to be legal."
  1613      The receiver must be associated to a device, for this query to be legal."
  1618 
  1614 
  1619     ^ self widthOf:' '
  1615     ^ self widthOf:' '
  1620 
  1616 
  1621     "Modified: 30.4.1996 / 16:43:45 / cg"
  1617     "Modified: 30.4.1996 / 16:43:45 / cg"
  1622 
       
  1623 
       
  1624 !
  1618 !
  1625 
  1619 
  1626 widthOf:aString
  1620 widthOf:aString
  1627     "return the width of a string"
  1621     "return the width of a string"
  1628 
  1622