Class AWTStyleDatabase

All Implemented Interfaces:
StyleDatabase, Serializable

public class AWTStyleDatabase extends AbstractStyleDatabase
CSS style database for use with AWT objects.

See Also:
  • Constructor Details

    • AWTStyleDatabase

      public AWTStyleDatabase()
      Constructs a default style database with no graphics configuration.
    • AWTStyleDatabase

      public AWTStyleDatabase(GraphicsConfiguration gConf)
      Constructs a style database for the given graphics configuration.
      gConf - the graphics configuration.
  • Method Details

    • getDefaultGenericFontFamily

      public String getDefaultGenericFontFamily(String genericFamily)
      Gets the name of the default font used when a generic font family (serif, sans-serif, monospace, cursive, fantasy) is specified.

      This class attempts to map the generic name to a "logical font" name.

      As, in Java, logical font names are internally mapped to physical fonts by the Java runtime environment, the name of the corresponding "logical font" is returned, and no further mapping is attempted.

      genericFamily - the name of the logical font.
      the name of the associated logical font, or null if none.
    • isFontFamilyAvailable

      protected boolean isFontFamilyAvailable(String fontFamily)
      Specified by:
      isFontFamilyAvailable in class AbstractStyleDatabase
    • isFontFaceName

      public boolean isFontFaceName(String requestedFamily)
      Description copied from interface: StyleDatabase
      Is requestedFamily an available font family loaded by a font face rule?
      requestedFamily - the font family name in lower case.
      true if is an available font family, false otherwise.
    • loadFontFace

      protected boolean loadFontFace(String familyName, AbstractStyleDatabase.FontFormat format, InputStream is, CSSFontFaceRule rule) throws IOException
      loadFontFace in class AbstractStyleDatabase
    • getFont

      public Font getFont(String lcFamilyName)
      Get a font that was loaded by a @font-face rule.
      lcFamilyName - the family name in lowercase.
      the font, or null if no font with that family name (in lowercase) has been loaded from a @font-face rule.
    • getGraphicsConfiguration

      protected GraphicsConfiguration getGraphicsConfiguration()
      Gets the GraphicsConfiguration for this style database.
      the GraphicsConfiguration object previously set, the default one if none was set, or null if the graphics environment is headless.
    • setGraphicsConfiguration

      public void setGraphicsConfiguration(GraphicsConfiguration configuration)
    • deviceResolutionFactor

      protected float deviceResolutionFactor()
      This method is used to normalize sizes to a 595pt width.
      the factor by which screensize-dependent quantities can be multiplied to be normalized.
    • getFontSizeFromIdentifier

      public float getFontSizeFromIdentifier(String familyName, String fontSizeIdentifier) throws DOMException
      Description copied from interface: StyleDatabase
      Gets the font size from the given size identifier (small, medium, etc.), expressed in typographic points.
      familyName - the font family name. Could be null.
      fontSizeIdentifier - the font size identifier.
      the font size.
      DOMException - if the identifier is unknown.
    • getWidthSize

      public float getWidthSize(String widthIdentifier, float fontSize) throws DOMException
      Description copied from interface: StyleDatabase
      Gets the size corresponding to the given identifier (thin, thick, medium), in typographic points.
      widthIdentifier - the CSS width identifier.
      fontSize - the font size used by the box, in typographic points.
      the size.
      DOMException - if the identifier is unknown.
    • getNaturalUnit

      public short getNaturalUnit()
      Description copied from interface: StyleDatabase
      Gets the identifier of the device's natural unit.
      the unit identifier as in CSSUnit.
    • getDeviceHeight

      public float getDeviceHeight()
      Description copied from interface: StyleDatabase
      Gets the height of the device, expressed in its natural unit.
      the height of the rendering device.
    • getDeviceWidth

      public float getDeviceWidth()
      Description copied from interface: StyleDatabase
      Gets the width of the device, expressed in its natural unit.
      the width of the rendering device.
    • setDefaultWidth

      public void setDefaultWidth(float defaultWidth)
    • setDefaultHeight

      public void setDefaultHeight(float defaultHeight)
    • getColorDepth

      public int getColorDepth()
      Description copied from interface: StyleDatabase
      Gives the number of bits allocated to colors (excluding the alpha channel) in the output device.

      If the device is not a color device, the value is zero.

      From W3C's Screen interface.

      the number of bits allocated to colors, or zero if the output device does not support colors.