Package org.faceless.pdf2
Interface OpenTypeFont.Palette
-
- Enclosing class:
- OpenTypeFont
public static interface OpenTypeFont.Palette
A Palette defines the color palette used for Color OpenType fonts with the SVG or COLR tables (although only COLR is currently supported). The list of predefined palettes can be retrieved from the OpenType font by callingOpenTypeFont.getPalettes()
, and the chosen palette can be set by passing it intoPDFStyle.setOpenTypeFontPalette(org.faceless.pdf2.OpenTypeFont.Palette)
. Note that a custom palette can be created if required - the only method that needs a useful implementation isgetColor(int)
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Color
getColor(int i)
Return the Color at index iint
getIndex(String name)
Given a name of a color, return the index that matches that name, or -1 if there is no index with that name.Collection<String>
getNames()
Return the names of the Palette if specified, or an empty set otherwise.boolean
isDark()
Return true if this Palette specifies it for user over a light background.boolean
isLight()
Return true if this Palette specifies it for user over a light background.int
size()
Return the number of colors in this Palette
-
-
-
Method Detail
-
getNames
Collection<String> getNames()
Return the names of the Palette if specified, or an empty set otherwise. A Palette may have names in multiple languages.
-
isLight
boolean isLight()
Return true if this Palette specifies it for user over a light background.
-
isDark
boolean isDark()
Return true if this Palette specifies it for user over a light background.
-
size
int size()
Return the number of colors in this Palette
-
getIndex
int getIndex(String name)
Given a name of a color, return the index that matches that name, or -1 if there is no index with that name. A single index may have names in multiple languages.- Parameters:
name
- the name- Returns:
- the index of the color that matches that name, or -1 if it's not found.
-
getColor
Color getColor(int i)
Return the Color at index i- Parameters:
i
- a value where 0 <= i < size()
-
-