Class FallbackFontSet
- java.lang.Object
-
- com.adobe.fontengine.inlineformatting.FallbackFontSet
-
- All Implemented Interfaces:
java.io.Serializable
public final class FallbackFontSet extends java.lang.Object implements java.io.SerializableA set of fonts indexed byULocale, typically used for fallback.A
FallbackFontSetis a set of fonts indexed byULocale. A typical use is during formatting of text: if the requested font cannot be found or does not contain suitable glyphs for a portion of the text being formatted, the formatter can enumerate the fallback fonts for the locale of the text until a suitable font is found. Indexing by locale (by opposition to a flat set) improves the quality of the generated rendering; for example, some characters are used to write both Japanese and Chinese, but different shapes are expected.The
addFallbackFont(ULocale, Font)andaddFallbackFonts(ULocale, Font[])methods allow the addition of one or more fonts to a set, for a given locale.The
getFallbackFonts(ULocale)method returns anIteratorwhich first enumerates the fonts for a locale (in the order in which they were added), then the fonts for the fallback locale of that locale, and so on up to the fonts for theULocale.ROOTlocale.For example, with a set setup like this:
set.add (new ULocale ("en_US"), us1); set.add (new ULocale ("en_US"), us2); set.add (new ULocale ("en_CA"), ca1); set.add (new ULocale ("en_CA"), ca2); set.add (new ULocale ("en"), en1); set.add (new ULocale ("en"), en2); set.add (ULocale.ROOT, r1); set.add (ULocale.ROOT, r2);then the fallback fonts for the localeen_USare{us1, us2, en1, en2, r1, r2}in that order, the fallback fonts for the localeen_CAare{ca1, ca2, en1, en2, r1, r2}in that order, the fallback fonts for the localeenare{en1, en2, r1, r2}in that order, and the fallback fonts for the localeitare{r1, r2}in that order.Synchronization
FallbackFontSetobjects are suitably synchronized for use in multiple threads.Serialization
FallbackFontSetobjects can be serialized, provided that they contain only fonts which can be serialized.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description FallbackFontSet()Create an empty FallbackFontSet.FallbackFontSet(FallbackFontSet ffs)Create a FallbackFontSet by copying an existing one.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddFallbackFont(ULocale locale, Font font)Add a font to the setvoidaddFallbackFonts(ULocale locale, Font[] fontsToAdd)Add each font in an array to the set.booleanequals(java.lang.Object otherObject)java.util.IteratorgetFallbackFonts(ULocale locale)Enumerate the fonts for a locale.inthashCode()booleanisEmpty()A test on whether this fontset contains any fonts.booleanisEmpty(ULocale locale)A test on whether this fontset contains any fonts for the given locale.java.lang.StringtoString()
-
-
-
Constructor Detail
-
FallbackFontSet
public FallbackFontSet()
Create an empty FallbackFontSet.
-
FallbackFontSet
public FallbackFontSet(FallbackFontSet ffs)
Create a FallbackFontSet by copying an existing one.
-
-
Method Detail
-
addFallbackFonts
public void addFallbackFonts(ULocale locale, Font[] fontsToAdd)
Add each font in an array to the set.- Parameters:
locale- the locale for which those fonts are appropriatefontsToAdd- the fonts to add
-
addFallbackFont
public void addFallbackFont(ULocale locale, Font font)
Add a font to the set- Parameters:
locale- the locale for which the font is appropriatefont- the font to add
-
getFallbackFonts
public java.util.Iterator getFallbackFonts(ULocale locale)
Enumerate the fonts for a locale. The fonts forlocaleare enumerated, then the fonts for the fallback locale oflocale, and so on.
-
equals
public boolean equals(java.lang.Object otherObject)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
isEmpty
public boolean isEmpty()
A test on whether this fontset contains any fonts.- Returns:
- true if the fontset is empty, false otherwise
-
isEmpty
public boolean isEmpty(ULocale locale)
A test on whether this fontset contains any fonts for the given locale.- Parameters:
locale- the locale to test- Returns:
- true if the fontset has no fonts for the given locale, false otherwise
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-