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
ConstructorsConstructorDescriptionConstructs a default style database with no graphics configuration.Constructs a style database for the given graphics configuration. -
Method Summary
Modifier and TypeMethodDescriptionprotected floatThis method is used to normalize sizes to a 595pt width.intGives 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.floatGets the height of the device, expressed in its natural unit.floatGets the width of the device, expressed in its natural unit.Get a font that was loaded by a @font-face rule.floatgetFontSizeFromIdentifier(String familyName, String fontSizeIdentifier) Gets the font size from the given size identifier (small, medium, etc.), expressed in typographic points.protected GraphicsConfigurationGets the GraphicsConfiguration for this style database.shortGets the identifier of the device's natural unit.floatgetWidthSize(String widthIdentifier, float fontSize) Gets the size corresponding to the given identifier (thin, thick, medium), in typographic points.booleanisFontFaceName(String requestedFamily) IsrequestedFamilyan available font family loaded by a font face rule?protected booleanisFontFamilyAvailable(String fontFamily) protected booleanloadFontFace(String familyName, AbstractStyleDatabase.FontFormat format, InputStream is, CSSFontFaceRule rule) voidsetDefaultHeight(float defaultHeight) voidsetDefaultWidth(float defaultWidth) voidsetGraphicsConfiguration(GraphicsConfiguration configuration) Methods inherited from class io.sf.carte.doc.style.css.om.AbstractStyleDatabase
fontFormatFromContentType, fontFormatFromRule, getDefaultGenericFontFamily, getInitialColor, getUsedFontFamily, isFontFamilyAvailable, loadFontFaceRule, setInitialColorMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:
isFontFamilyAvailablein classAbstractStyleDatabase
-
isFontFaceName
Description copied from interface:StyleDatabaseIsrequestedFamilyan available font family loaded by a font face rule?- Parameters:
requestedFamily- the font family name in lower case.- Returns:
trueif is an available font family,falseotherwise.
-
loadFontFace
protected boolean loadFontFace(String familyName, AbstractStyleDatabase.FontFormat format, InputStream is, CSSFontFaceRule rule) throws IOException - Overrides:
loadFontFacein 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
nullif 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:StyleDatabaseGets 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:StyleDatabaseGets the size corresponding to the given identifier (thin, thick, medium), in typographic points.See CSSWG issue #7254.
- 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:StyleDatabaseGets the identifier of the device's natural unit.- Returns:
- the unit identifier as in
CSSUnit.
-
getDeviceHeight
public float getDeviceHeight()Description copied from interface:StyleDatabaseGets 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:StyleDatabaseGets 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:StyleDatabaseGives 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.
-