Class AbstractStyleDatabase

java.lang.Object
io.sf.carte.doc.style.css.om.AbstractStyleDatabase
All Implemented Interfaces:
StyleDatabase

public abstract class AbstractStyleDatabase extends Object implements StyleDatabase
Abstract base class for CSS Style databases.
  • Field Details

  • Constructor Details

    • AbstractStyleDatabase

      public AbstractStyleDatabase()
  • Method Details

    • getExSizeInPt

      public float getExSizeInPt(String familyName, float size)
      Description copied from interface: StyleDatabase
      Gives the size of the 'ex' unit, expressed in 'pt' (typographic points) unit.

      Although this type of information really belongs to CSSCanvas, having even an approximate value here is helpful.

      Specified by:
      getExSizeInPt in interface StyleDatabase
      Parameters:
      familyName - the font family name.
      size - the font size in 'pt' units.
      Returns:
      the size of the 'ex' unit, in units of 'pt'.
    • getInitialColor

      public CSSPrimitiveValue getInitialColor()
      Description copied from interface: StyleDatabase
      Gives the initial (default) value for the 'color' property on this device.
      Specified by:
      getInitialColor in interface StyleDatabase
      Returns:
      the default color value.
    • setInitialColor

      public void setInitialColor(String initialColor)
      Description copied from interface: StyleDatabase
      Sets the initial (default) value for the 'color' property on this device.
      Specified by:
      setInitialColor in interface StyleDatabase
      Parameters:
      initialColor - the String representing default color value.
    • getDefaultGenericFontFamily

      public String getDefaultGenericFontFamily()
      Description copied from interface: StyleDatabase
      Gets the real name of the default font.

      For example, if the default generic font name is 'serif', this method should return the same as getDefaultGenericFontFamily("serif").

      Specified by:
      getDefaultGenericFontFamily in interface StyleDatabase
      Returns:
      the name of the default real font.
    • getSystemFontDeclaration

      public String getSystemFontDeclaration(String systemFontName)
      Description copied from interface: StyleDatabase
      Gives the style declaration adequate to provide the given system font.
      Specified by:
      getSystemFontDeclaration in interface StyleDatabase
      Parameters:
      systemFontName - the system font name.
      Returns:
      the style declaration, or null if the system font name was not recognized.
    • getUsedFontFamily

      public String getUsedFontFamily(CSSComputedProperties computedStyle)
      Description copied from interface: StyleDatabase
      Gets the used font family name according to the given style.
      Specified by:
      getUsedFontFamily in interface StyleDatabase
      Parameters:
      computedStyle - the computed style.
      Returns:
      the name of the used font family.
    • isFontFamilyAvailable

      protected boolean isFontFamilyAvailable(String requestedFamily, CSSComputedProperties style)
    • loadFontFaceRule

      public void loadFontFaceRule(ExtendedCSSFontFaceRule rule)
      Description copied from interface: StyleDatabase
      Try to load the font family according to the given font face rule, and make it available to this object.
      Specified by:
      loadFontFaceRule in interface StyleDatabase
      Parameters:
      rule - the font face rule.
    • fontFormatFromContentType

      protected AbstractStyleDatabase.FontFormat fontFormatFromContentType(String conType)
    • fontFormatFromRule

      protected AbstractStyleDatabase.FontFormat fontFormatFromRule(String format)
    • loadFontFace

      protected boolean loadFontFace(String familyName, AbstractStyleDatabase.FontFormat fontFormat, InputStream is, ExtendedCSSFontFaceRule rule) throws IOException
      Throws:
      IOException
    • supports

      public boolean supports(String featureName, CSSValue value)
      Description copied from interface: StyleDatabase
      Does this medium support the given property-value pair?
      Specified by:
      supports in interface StyleDatabase
      Parameters:
      featureName - the property name.
      value - the optional property value to be tested against.
      Returns:
      true if the property (with the given value, if any) is supported, false otherwise.
    • isFontFamilyAvailable

      protected abstract boolean isFontFamilyAvailable(String fontFamily)