public class FontFamily extends Object
RawFont) of different styles to create Font.
Ensure that the raw fonts added to a FontFamily belong to the same family,
and they are only different in style (such as weight and italic).
| 限定符和类型 | 类 | 说明 |
|---|---|---|
static class |
FontFamily.Builder |
Provides a builder to create a
FontFamily instance. |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
FontFamily |
createFamilyWithVariations(String variations) |
Creates a
FontFamily based on this FontFamily and the font variation settings. |
RawFont |
getRawFont(int index) |
Obtains the
RawFont object identified by the specified index in this FontFamily. |
RawFont |
getRawFont(int weight,
boolean isItalic) |
Obtains the
RawFont of the specified style in this FontFamily. |
int |
getSize() |
Obtains the number of
RawFont objects in this FontFamily. |
boolean |
hasGlyph(int codePoint,
int variationSelector) |
Checks whether the
FontFamily contains a glyph corresponding to the character specified by the Unicode. |
public RawFont getRawFont(int index)
RawFont object identified by the specified index in this FontFamily.index - Indicates the index specified.RawFont object if the operation is successful; returns null
if the specified index is invalid.public int getSize()
RawFont objects in this FontFamily.RawFont objects.public RawFont getRawFont(int weight, boolean isItalic)
RawFont of the specified style in this FontFamily.
This method attempts to find a closest match, may not be the exact match.
weight - Indicates the font weight.isItalic - Specifies whether the font is in italics. The value true means that the font is
in italics, and false means the opposite.RawFont object that most matches the specified conditions.public FontFamily createFamilyWithVariations(String variations)
FontFamily based on this FontFamily and the font variation settings.variations - Indicates the font variation settings.FontFamily object created; returns null if this FontFamily
does not support the font variation settings.NullPointerException - Throws this exception if the specified variations is null.public boolean hasGlyph(int codePoint,
int variationSelector)
FontFamily contains a glyph corresponding to the character specified by the Unicode.codePoint - Indicates the Unicode value.variationSelector - Indicates the variation selector of the font. For details, see:
Variation Selectorstrue if the FontFamily contains a glyph corresponding to the character
specified by the Unicode; returns false otherwise.