- All Known Implementing Classes:
AbstractStyleDatabase
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.
-
Method Summary
Modifier and TypeMethodDescriptionint
Gives the number of bits allocated to colors (excluding the alpha channel) in the output device.Gets the real name of the default font.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
Gets the height of the device, expressed in its natural unit.float
Gets the width of the device, expressed in its natural unit.float
getExSizeInPt
(String familyName, float size) Gives the size of the 'ex' unit, expressed in 'pt' (typographic points) unit.float
getFontSizeFromIdentifier
(String familyName, String fontSizeIdentifier) Gets the font size from the given size identifier (small, medium, etc.), expressed in typographic points.Gives the initial (default) value for the 'color' property on this device.short
Gets the identifier of the device's natural unit.getSystemFontDeclaration
(String systemFontName) Gives the style declaration adequate to provide the given system font.getUsedFontFamily
(CSSComputedProperties computedStyle) Gets the used font family name according to the given style.float
getWidthSize
(String widthIdentifier, float fontSize) Gets the size corresponding to the given identifier (thin, thick, medium), in typographic points.boolean
isFontFaceName
(String requestedFamily) IsrequestedFamily
an available font family loaded by a font face rule?void
Try to load the font family according to the given font face rule, and make it available to this object.void
setInitialColor
(String initialColor) Sets the initial (default) value for the 'color' property on this device.boolean
Does this medium support the given property-value pair?
-
Method Details
-
getInitialColor
CSSPrimitiveValue getInitialColor()Gives the initial (default) value for the 'color' property on this device.- Returns:
- the default color value.
-
setInitialColor
Sets the initial (default) value for the 'color' property on this device.- Parameters:
initialColor
- the String representing default color value.
-
getDefaultGenericFontFamily
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.
-
getUsedFontFamily
Gets the used font family name according to the given style.- Parameters:
computedStyle
- the computed style.- Returns:
- the name of the used font family.
-
getFontSizeFromIdentifier
Gets the font size from the given size identifier (small, medium, etc.), expressed in typographic points.- Parameters:
familyName
- the font family name. Could be null.fontSizeIdentifier
- the font size identifier.- Returns:
- the font size.
- Throws:
DOMException
- if the identifier is unknown.
-
getSystemFontDeclaration
Gives the style declaration adequate to provide the given system font.- Parameters:
systemFontName
- the system font name.- Returns:
- the style declaration, or null if the system font name was not recognized.
-
isFontFaceName
IsrequestedFamily
an available font family loaded by a font face rule?- Parameters:
requestedFamily
- the font family name in lower case.- Returns:
true
if is an available font family,false
otherwise.
-
loadFontFaceRule
Try to load the font family according to the given font face rule, and make it available to this object.- Parameters:
rule
- the font face rule.
-
getNaturalUnit
short getNaturalUnit()Gets the identifier of the device's natural unit.- Returns:
- the unit identifier as in
CSSPrimitiveValue
.
-
getExSizeInPt
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.- Parameters:
familyName
- the font family name.size
- the font size in 'pt' units.- Returns:
- the size of the 'ex' unit, in units of 'pt'.
-
getWidthSize
Gets the size corresponding to the given identifier (thin, thick, medium), in typographic points.- Parameters:
widthIdentifier
- the CSS width identifier.fontSize
- the font size used by the box, in typographic points.- Returns:
- the size.
- Throws:
DOMException
- if the identifier is unknown.
-
getColorDepth
int getColorDepth()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.
- Returns:
- the number of bits allocated to colors, or zero if the output device does not support colors.
-
getDeviceHeight
float getDeviceHeight()Gets the height of the device, expressed in its natural unit.- Returns:
- the height of the rendering device.
-
getDeviceWidth
float getDeviceWidth()Gets the width of the device, expressed in its natural unit.- Returns:
- the width of the rendering device.
-
supports
Does this medium support the given property-value pair?- Parameters:
property
- 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.
-