info.informatica.doc.style.css
Interface StyleDatabase

All Known Implementing Classes:
AbstractStyleDatabase, HeadlessStyleDatabase, Java2DStyleDatabase, PDFStyleDatabase

public interface StyleDatabase

CSS Style database.

To use CSS in practice, you need to have information about the target rendering device: available fonts, page sizes, etc. This information is supplied by an instance of the StyleDatabase interface.

The appropriate implementation must be supplied to the style declaration, through the StyleDatabaseAware interface.

This interface is a work in progress.

Author:
Carlos Amengual (amengual at informatica.info)
See Also:
StyleDatabaseAware

Method Summary
 float floatValueConversion(float initialValue, short initialUnitType)
          Makes an unit conversion to the natural unit of this device.
 float floatValueConversion(float initialValue, short initialUnitType, short destUnitType)
          Makes an unit conversion (for the units known to this device).
 String getDefaultGenericFontFamily()
          Gets the real name of the default font.
 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.
 float getDocumentHeight()
          Gets the height of the document (or screen viewport) in the natural unit for the device.
 float getDocumentWidth()
          Gets the width of the document (or screen viewport) in the natural unit for the device.
 int getExSizeInPt(String familyName, int size)
          Gives the size of the 'ex' unit, expressed in 'pt' (typographic points) unit.
 int getFontSizeFromIdentifier(String familyName, String fontSizeIdentifier)
          Gets the font size from the given size identifier (small, medium, etc.), expressed in typographic points.
 org.w3c.dom.css.CSSPrimitiveValue getInitialColor()
          Gives the initial (default) value for the 'color' property on this device.
 short getNaturalUnit()
          Gets the identifier of the device's natural unit.
 float getScrollbarWidth()
          Gets the width of the scrollbar that appears when a box overflows with scroll.
 float getWidthSize(String widthIdentifier)
          Gets the size corresponging to the given identifier (thin, thick, medium).
 boolean isFontFamilyAvailable(String fontFamily)
          Checks if a font family is available.
 void setInitialColor(String initialColor)
          Sets the initial (default) value for the 'color' property on this device.
 

Method Detail

getInitialColor

org.w3c.dom.css.CSSPrimitiveValue getInitialColor()
Gives the initial (default) value for the 'color' property on this device.

Returns:
the default color value.

setInitialColor

void setInitialColor(String initialColor)
Sets the initial (default) value for the 'color' property on this device.

Parameters:
initialColor - the String representing default color value.

getDefaultGenericFontFamily

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.

Parameters:
genericFamily - the name of the logical font.
Returns:
the name of the real font to which the generic name is mapped to, or null if none.

getDefaultGenericFontFamily

String getDefaultGenericFontFamily()
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").

Returns:
the name of the default real font.

isFontFamilyAvailable

boolean isFontFamilyAvailable(String fontFamily)
Checks if a font family is available.

Parameters:
fontFamily - the font family name.
Returns:
true if the font is available, false otherwise.

getFontSizeFromIdentifier

int getFontSizeFromIdentifier(String familyName,
                              String fontSizeIdentifier)
                              throws DOMException
Gets the font size from the given size identifier (small, medium, etc.), expressed in typographic points.

Parameters:
familyName - the font family name.
fontSizeIdentifier - the font size identifier.
Returns:
the font size.
Throws:
DOMException

getNaturalUnit

short getNaturalUnit()
Gets the identifier of the device's natural unit.

Returns:
the unit identifier as in CSSPrimitiveValue.

floatValueConversion

float floatValueConversion(float initialValue,
                           short initialUnitType,
                           short destUnitType)
                           throws DOMException
Makes an unit conversion (for the units known to this device).

Parameters:
initialValue - the value to be converted, expressed in the initial unit.
initialUnitType - the initial unit type.
destUnitType - the destination unit type.
Returns:
the value, expressed in units of destUnitType.
Throws:
DOMException

floatValueConversion

float floatValueConversion(float initialValue,
                           short initialUnitType)
                           throws DOMException
Makes an unit conversion to the natural unit of this device.

Parameters:
initialValue - the value to be converted, expressed in the initial unit.
initialUnitType - the initial unit type.
Returns:
the value, expressed in units of destUnitType.
Throws:
DOMException

getExSizeInPt

int getExSizeInPt(String familyName,
                  int size)
Gives the size of the 'ex' unit, expressed in 'pt' (typographic points) unit.

Parameters:
familyName - the font family name.
size - the font size.
Returns:
the size of the 'ex' unit, in units of 'pt'.

getWidthSize

float getWidthSize(String widthIdentifier)
                   throws DOMException
Gets the size corresponging to the given identifier (thin, thick, medium).

Parameters:
widthIdentifier - the CSS width identifier.
Returns:
the size.
Throws:
DOMException

getDocumentHeight

float getDocumentHeight()
Gets the height of the document (or screen viewport) in the natural unit for the device.

Returns:
the height of the document.

getDocumentWidth

float getDocumentWidth()
Gets the width of the document (or screen viewport) in the natural unit for the device.

Returns:
the width of the document.

getScrollbarWidth

float getScrollbarWidth()
Gets the width of the scrollbar that appears when a box overflows with scroll.

Returns:
the width of the scrollbar.


Copyright © 2011 informatica.info. All Rights Reserved.