Interface CSS20FontSet
-
- All Superinterfaces:
java.io.Serializable
- All Known Implementing Classes:
CSS20FontDatabase
public interface CSS20FontSet extends java.io.SerializableThis interface provides access to the methods that a client can use to build a font set that is used by aPDF16RichTextFormatterobject to resolve CSS font specifications into actualFontDataobjects. CSS20FontSet objects implement the Serializable interface. The intent is that CSS20FontSets would generally not be entirely regenerated from scratch. Instead, they would be deserialized.Concurrency
All classes that implement this interface are in general not guaranteed to be threadsafe. Specific implementations may offer tighter guarantees.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddFont(Font font)Adds a font to the set of fonts that are examined for resolving a set of CSS attributes into an actual font during the formatting process inPDF16RichTextFormatter.format(com.adobe.fontengine.inlineformatting.AttributedRun, int, int)orPDF16RichTextFormatter.format(com.adobe.fontengine.inlineformatting.AttributedRun, int, int, boolean).voidaddFont(CSS20FontDescription fontDesc, Font font)Adds a font to the set of fonts that are examined for resolving a set of CSS attributes into an actual font during the formatting process inPDF16RichTextFormatter.format(com.adobe.fontengine.inlineformatting.AttributedRun, int, int)andPDF16RichTextFormatter.format(com.adobe.fontengine.inlineformatting.AttributedRun, int, int, boolean).FontfindFont(CSS20Attribute attributes, ULocale locale)Search for a font using the same search as would used by a layout engine using this fontset.voidflattenFontSet()Flatten the fontset so that any state information is removed and any fonts that have been added to the fontset are "permanent".booleanisEmpty()Tests if the CSS20FontSet has had no fonts added.voidpopFontSet()Pop the state of the fontset so that fonts that were added after the last push operation are removed and no longer available for use.voidpushFontSet()Push the current state of the fontset so that fonts added after this can be removed by popping the fontset to original state.voidrestoreOriginalFontSet()This is equivalent to callingpopFontSet()as many times aspushFontSet()has already been called.voidsetFallbackFonts(FallbackFontSet ffs)Set the fallback fonts.voidsetGenericFont(CSS20GenericFontFamily genericFamily, java.lang.String[] replacementFontNames)Set the list of replacement font family names for the specified CSS generic font family.FontResolutionPrioritysetResolutionPriority(FontResolutionPriority priority)Set the resolution mechanism that theCSS20FontSetshould use to decide which font should be chosen when two fonts appear identical under the CSS font selection algorithm.
-
-
-
Method Detail
-
setResolutionPriority
FontResolutionPriority setResolutionPriority(FontResolutionPriority priority)
Set the resolution mechanism that theCSS20FontSetshould use to decide which font should be chosen when two fonts appear identical under the CSS font selection algorithm. The default resolution priority if none is specified isFontResolutionPriority#FIRSTFontResolutionPriority#INTELLIGENTspecifies that an "intelligent" determination is made about the fonts and the one that "best" represents the CSS attributes where they collide is chosen.FontResolutionPriority#FIRSTspecifies the first font added to the font set that matches the CSS attributes is chosen.FontResolutionPriority#LASTspecifies the last font added to the font set that matches the CSS attributes is chosen.- Parameters:
priority- The resolution mechanism to use- Returns:
- The old resolution priority setting.
-
addFont
void addFont(Font font) throws UnsupportedFontException, InvalidFontException, FontLoadingException
Adds a font to the set of fonts that are examined for resolving a set of CSS attributes into an actual font during the formatting process inPDF16RichTextFormatter.format(com.adobe.fontengine.inlineformatting.AttributedRun, int, int)orPDF16RichTextFormatter.format(com.adobe.fontengine.inlineformatting.AttributedRun, int, int, boolean). If this font is indistinguisable from another font already in the font set then which of the two that is preferred is determined by the settings ofsetResolutionPriority(com.adobe.fontengine.fontmanagement.FontResolutionPriority).- Parameters:
font- the font to add to the fonts used for CSS resolution- Throws:
UnsupportedFontExceptionInvalidFontExceptionFontLoadingException
-
addFont
void addFont(CSS20FontDescription fontDesc, Font font) throws UnsupportedFontException, InvalidFontException, FontLoadingException
Adds a font to the set of fonts that are examined for resolving a set of CSS attributes into an actual font during the formatting process inPDF16RichTextFormatter.format(com.adobe.fontengine.inlineformatting.AttributedRun, int, int)andPDF16RichTextFormatter.format(com.adobe.fontengine.inlineformatting.AttributedRun, int, int, boolean). If this font is indistinguisable from another font already in the font set then which of the two that is preferred is determined by the settings ofsetResolutionPriority(com.adobe.fontengine.fontmanagement.FontResolutionPriority). The CSS attributes of the font are ignored and those provided are used instead.- Parameters:
fontDesc- the CSS properties to use for this fontfont- the font to add to the fonts used for CSS resolution- Throws:
UnsupportedFontExceptionInvalidFontExceptionFontLoadingException
-
isEmpty
boolean isEmpty()
Tests if the CSS20FontSet has had no fonts added. It does not check the fallback or generic fonts.- Returns:
- True if the
CSS20FontSetis empty (has no fonts).
-
setGenericFont
void setGenericFont(CSS20GenericFontFamily genericFamily, java.lang.String[] replacementFontNames)
Set the list of replacement font family names for the specified CSS generic font family.- Parameters:
genericFamily- the CSS generic font family to assign the replacement fonts to.replacementFontNames- a List ofStringobjects with the replacement font family names.- See Also:
CSS20GenericFontFamily
-
setFallbackFonts
void setFallbackFonts(FallbackFontSet ffs)
Set the fallback fonts.- Parameters:
ffs- search the fonts in this set when none of the fonts added by theaddFontmethods are suitable.
-
findFont
Font findFont(CSS20Attribute attributes, ULocale locale) throws FontException
Search for a font using the same search as would used by a layout engine using this fontset. Only the first font that would be found using this search is returned. If the CSS 2.0 attributes used for the search don't lead to a font in the fontset then the locale is used to search the fallback fonts for a match.- Parameters:
attributes- the CSS 2.0 attributes to search forlocale- the locale for the font search- Returns:
- the font found using the CSS 2.0 search algorithm
- Throws:
FontException
-
pushFontSet
void pushFontSet()
Push the current state of the fontset so that fonts added after this can be removed by popping the fontset to original state. It is possible to push the state of the fontset multiple times and subsequently pop it to return it to the original state. The push and pop operations only affect the basic fonts added and it does not change any locale fallback fonts, generic fonts, or resolution priority.
-
popFontSet
void popFontSet()
Pop the state of the fontset so that fonts that were added after the last push operation are removed and no longer available for use. The push and pop operations only affect the basic fonts added and it does not change any locale fallback fonts, generic fonts, or resolution priority.
-
restoreOriginalFontSet
void restoreOriginalFontSet()
This is equivalent to callingpopFontSet()as many times aspushFontSet()has already been called. It will restore the fontset to the state it was in before the first push operation. The push and pop operations only affect the basic fonts added and it does not change any locale fallback fonts, generic fonts, or resolution priority.
-
flattenFontSet
void flattenFontSet()
Flatten the fontset so that any state information is removed and any fonts that have been added to the fontset are "permanent". After this method returns it will not be possible to pop the state of the fontset and return to any previous state. The push and pop operations only affect the basic fonts added and it does not change any locale fallback fonts, generic fonts, or resolution priority.
-
-