FontStyles
Inheritance: java.lang.Object
public final class FontStyles
Represents 4 possible styles of the font, used in the document: Regular, Bold, Italic, or Bold Italic.
Constructors
| Constructor | Description |
|---|---|
| FontStyles(boolean isBold, boolean isItalic) | Creates a FontStyles instance from bold/italic flags. |
Fields
| Field | Description |
|---|---|
| Regular | |
| Bold | |
| Italic | |
| BoldItalic | |
| REGULAR | |
| BOLD | |
| ITALIC | |
| BOLD_ITALIC |
Methods
| Method | Description |
|---|---|
| toString(int style) | Converts a style value to a human-readable string. |
| getName() | Returns readable name of this font style. |
| isBold() | Returns true if bold bit is set. |
| isItalic() | Returns true if italic bit is set. |
| toString() | |
| equals(Object obj) | |
| hashCode() | |
| combine(FontStyles first, FontStyles second) | Union (C# operator +) |
| subtract(FontStyles minuend, FontStyles subtrahend) | Difference (C# operator -) |
| tryParse(String style, FontStyles[] parsed) | Parses a font style name to FontStyles. |
FontStyles(boolean isBold, boolean isItalic)
public FontStyles(boolean isBold, boolean isItalic)
Creates a FontStyles instance from bold/italic flags.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| isBold | boolean | |
| isItalic | boolean |
Regular
public static final int Regular
Bold
public static final int Bold
Italic
public static final int Italic
BoldItalic
public static final int BoldItalic
REGULAR
public static final FontStyles REGULAR
BOLD
public static final FontStyles BOLD
ITALIC
public static final FontStyles ITALIC
BOLD_ITALIC
public static final FontStyles BOLD_ITALIC
toString(int style)
public static String toString(int style)
Converts a style value to a human-readable string.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| style | int | the font style value |
Returns: java.lang.String - a string representation of the font style
getName()
public String getName()
Returns readable name of this font style.
Returns: java.lang.String
isBold()
public boolean isBold()
Returns true if bold bit is set.
Returns: boolean
isItalic()
public boolean isItalic()
Returns true if italic bit is set.
Returns: boolean
toString()
public String toString()
Returns: java.lang.String
equals(Object obj)
public boolean equals(Object obj)
Parameters:
| Parameter | Type | Description |
|---|---|---|
| obj | java.lang.Object |
Returns: boolean
hashCode()
public int hashCode()
Returns: int
combine(FontStyles first, FontStyles second)
public static FontStyles combine(FontStyles first, FontStyles second)
Union (C# operator +)
Parameters:
| Parameter | Type | Description |
|---|---|---|
| first | com.groupdocs.viewer.fonts.FontStyles | |
| second | com.groupdocs.viewer.fonts.FontStyles |
Returns: com.groupdocs.viewer.fonts.FontStyles
subtract(FontStyles minuend, FontStyles subtrahend)
public static FontStyles subtract(FontStyles minuend, FontStyles subtrahend)
Difference (C# operator -)
Parameters:
| Parameter | Type | Description |
|---|---|---|
| minuend | com.groupdocs.viewer.fonts.FontStyles | |
| subtrahend | com.groupdocs.viewer.fonts.FontStyles |
Returns: com.groupdocs.viewer.fonts.FontStyles
tryParse(String style, FontStyles[] parsed)
public static boolean tryParse(String style, FontStyles[] parsed)
Parses a font style name to FontStyles.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| style | java.lang.String | |
| parsed | com.groupdocs.viewer.fonts.FontStyles[] |
Returns: boolean - true on success, false otherwise.