- All Known Subinterfaces:
CSSCanvas
- All Known Implementing Classes:
AbstractCSSCanvas
public interface CSSCanvas
CSS canvas interface.
-
Method Summary
Modifier and TypeMethodDescriptiondefault float
Get the cap-height of the first available font, in typographic points.Gets the document to which this canvas applies.getFeatureValue
(String feature) Provide the value of the requested media feature.Gets the style database for this canvas.default Viewport
Gets the viewport of this canvas.default boolean
isActivePseudoClass
(CSSElement element, String pseudoclassName) Is the provided pseudo-class active in this canvas?boolean
matchesFeature
(String featureName, CSSTypedValue value) Does this canvas support the given media feature?default void
Reload any possible style state/caching that this canvas may have.default int
stringWidth
(String text, CSSComputedProperties style) Gives the width, in typographic points, for showing the given text with the given style.
-
Method Details
-
getStyleDatabase
StyleDatabase getStyleDatabase()Gets the style database for this canvas.- Returns:
- the StyleDatabase.
-
isActivePseudoClass
Is the provided pseudo-class active in this canvas?- Parameters:
element
- the element to which the pseudo-class applies.pseudoclassName
- the pseudo-class name.- Returns:
true
id the pseudo-class is active,false
otherwise.
-
getFeatureValue
Provide the value of the requested media feature.- Parameters:
feature
- the media feature.- Returns:
- the value of the requested media feature, or
null
if the feature is not known or not supported.
-
matchesFeature
Does this canvas support the given media feature?- Parameters:
featureName
- the media feature name.value
- the optional feature value to be tested against.- Returns:
true
if the feature (with the given value, if any) is supported,false
otherwise.
-
reloadStyleState
default void reloadStyleState()Reload any possible style state/caching that this canvas may have. -
getViewport
Gets the viewport of this canvas.- Returns:
- the viewport, or null if this canvas does not have a viewport.
-
stringWidth
Gives the width, in typographic points, for showing the given text with the given style.- Parameters:
text
- the text to measure.style
- the style that applies.- Returns:
- the advance width for showing the text with the given font.
-
getCapHeight
Get the cap-height of the first available font, in typographic points.If the cap-height is not available, the font's ascent must be used.
- Parameters:
style
- the style that applies.- Returns:
- the cap-height of the first available font.
-
getDocument
CSSDocument getDocument()Gets the document to which this canvas applies.- Returns:
- the document.
-