java.lang.Object
io.sf.carte.doc.style.css.om.AbstractStyleDatabase
io.sf.carte.doc.style.css.awt.AWTStyleDatabase
- All Implemented Interfaces:
StyleDatabase
,Serializable
CSS style database for use with AWT objects.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class io.sf.carte.doc.style.css.om.AbstractStyleDatabase
AbstractStyleDatabase.FontFormat
-
Field Summary
Fields inherited from class io.sf.carte.doc.style.css.om.AbstractStyleDatabase
DEFAULT_GENERIC_FONT_FAMILY
-
Constructor Summary
ConstructorDescriptionConstructs a default style database with no graphics configuration.Constructs a style database for the given graphics configuration. -
Method Summary
Modifier and TypeMethodDescriptionprotected float
This method is used to normalize sizes to a 595pt width.int
Gives the number of bits allocated to colors (excluding the alpha channel) in the output device.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.Get a font that was loaded by a @font-face rule.float
getFontSizeFromIdentifier
(String familyName, String fontSizeIdentifier) Gets the font size from the given size identifier (small, medium, etc.), expressed in typographic points.protected GraphicsConfiguration
Gets the GraphicsConfiguration for this style database.short
Gets the identifier of the device's natural unit.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?protected boolean
isFontFamilyAvailable
(String fontFamily) protected boolean
loadFontFace
(String familyName, AbstractStyleDatabase.FontFormat format, InputStream is, CSSFontFaceRule rule) void
setDefaultHeight
(float defaultHeight) void
setDefaultWidth
(float defaultWidth) void
setGraphicsConfiguration
(GraphicsConfiguration configuration) Methods inherited from class io.sf.carte.doc.style.css.om.AbstractStyleDatabase
fontFormatFromContentType, fontFormatFromRule, getDefaultGenericFontFamily, getInitialColor, getUsedFontFamily, isFontFamilyAvailable, loadFontFaceRule, setInitialColor
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.sf.carte.doc.style.css.StyleDatabase
getEnvValue, getExSizeInPt, getSystemFontDeclaration, supports, supports, supports
-
Constructor Details
-
AWTStyleDatabase
public AWTStyleDatabase()Constructs a default style database with no graphics configuration. -
AWTStyleDatabase
Constructs a style database for the given graphics configuration.- Parameters:
gConf
- the graphics configuration.
-
-
Method Details
-
getDefaultGenericFontFamily
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.
- Parameters:
genericFamily
- the name of the logical font.- Returns:
- the name of the associated logical font, or null if none.
-
isFontFamilyAvailable
- Specified by:
isFontFamilyAvailable
in classAbstractStyleDatabase
-
isFontFaceName
Description copied from interface:StyleDatabase
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.
-
loadFontFace
protected boolean loadFontFace(String familyName, AbstractStyleDatabase.FontFormat format, InputStream is, CSSFontFaceRule rule) throws IOException - Overrides:
loadFontFace
in classAbstractStyleDatabase
- Throws:
IOException
-
getFont
Get a font that was loaded by a @font-face rule.- Parameters:
lcFamilyName
- the family name in lowercase.- Returns:
- the font, or
null
if no font with that family name (in lowercase) has been loaded from a @font-face rule.
-
getGraphicsConfiguration
Gets the GraphicsConfiguration for this style database.- Returns:
- the GraphicsConfiguration object previously set, the default one if none was set, or null if the graphics environment is headless.
-
setGraphicsConfiguration
-
deviceResolutionFactor
protected float deviceResolutionFactor()This method is used to normalize sizes to a 595pt width.- Returns:
- 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.- 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.
-
getWidthSize
Description copied from interface:StyleDatabase
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.
-
getNaturalUnit
public short getNaturalUnit()Description copied from interface:StyleDatabase
Gets the identifier of the device's natural unit.- Returns:
- 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.- Returns:
- 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.- Returns:
- 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.
- Returns:
- the number of bits allocated to colors, or zero if the output device does not support colors.
-