public class MTextAttributes extends Object implements Externalizable
Modifier and Type | Field and Description |
---|---|
static int |
A_ALL
All identifiers.
|
static int |
A_BOLD
Identifier of the font's bold subattribute.
|
static int |
A_DX
Identifier of the x shift attribute.
|
static int |
A_DY
Identifier of the y shift attribute.
|
static int |
A_FONT
Identifier of the font attribute.
|
static int |
A_FONT_BITS
All font bits.
|
static int |
A_FONTFAMILY
Identifier of the font family subattribute.
|
static int |
A_FONTSIZE
Identifier of the font size subattribute.
|
static int |
A_FOREGROUND
Identifier of the color attribute.
|
static int |
A_ITALIC
Identifier of the font's italic subattribute.
|
static int |
A_SCALE
Identifier of the font scale attribute.
|
static int |
A_SUBLEVEL
Identifier of the subscript/superscript level attribute.
|
static MTextAttributes |
DEFAULT
Default attributes object.
|
static double |
DEFAULT_SUPERSCRIPT_DELTAY
Default value of the y shift attribute in superscripts
|
static double |
DEFAULT_SUPERSCRIPT_SCALE
Default value of the font scale attribute in superscripts
|
static int |
DEFAULT_SUPERSCRIPT_SUBLEVEL
Default value of the superscript level attribute in superscripts
|
Constructor and Description |
---|
MTextAttributes(int set,
int subl,
Color c,
MFont ft,
double scale,
double dx,
double dy)
Constructs a attributes object.
|
Modifier and Type | Method and Description |
---|---|
MTextAttributes |
createCompatible(MTextAttributes newCommon,
MTextAttributes origCommon,
MFont deffnt,
chemaxon.struc.graphics.MTextAttributes.MFontCreator ftcreator) |
MTextAttributes |
createNext()
Creates identical attributes for the next section.
|
MTextAttributes |
decode(String str,
MFont deffnt,
chemaxon.struc.graphics.MTextAttributes.MFontCreator fntcreator)
Reads attributes of the next section from a string.
|
String |
encode(MFont deffnt,
MTextAttributes prev)
Returns the string representation of the attributes.
|
boolean |
equals(MTextAttributes o)
Tests whether two attributes objects equal or not.
|
boolean |
equals(Object o)
Tests whether two attributes objects equal or not.
|
boolean |
equalsNext(MTextAttributes o)
Tests whether the attributes of two neighboring sections equal or not.
|
MFont |
getBaseFont()
Gets the base font.
|
MTextAttributes |
getCompatibleAttributes(MTextAttributes attr,
MFont deffnt,
chemaxon.struc.graphics.MTextAttributes.MFontCreator ftcreator,
int set0)
Gets the compatible attributes.
|
double |
getDx()
Gets the x shift.
|
double |
getDy()
Gets the y shift.
|
String |
getFontFamily()
Gets the font family name.
|
Color |
getForeground()
Gets the foreground color.
|
double |
getScale()
Gets the relative size of the font compared to the base font.
|
int |
getSet()
Gets the set of attributes used.
|
byte |
getSubLevel()
Gets the subscript/superscript level.
|
int |
hashCode() |
boolean |
isCompatible(MTextAttributes newCommon,
MTextAttributes origCommon,
MFont deffnt)
Tests whether two attribute sets are compatible.
|
boolean |
isDefault()
Tests whether all attributes have default values.
|
boolean |
isFontDefault(MFont deffnt)
Tests whether the default font is used.
|
boolean |
isFontRegular()
Tests whether the default font is used.
|
void |
readExternal(ObjectInput in) |
String |
toString()
Returns the string representation of the attributes.
|
void |
writeExternal(ObjectOutput out) |
public static final MTextAttributes DEFAULT
public static final int A_SUBLEVEL
public static final int A_FOREGROUND
public static final int A_FONT
public static final int A_FONTFAMILY
public static final int A_FONTSIZE
public static final int A_BOLD
public static final int A_ITALIC
public static final int A_FONT_BITS
public static final int A_SCALE
public static final int A_DX
public static final int A_DY
public static final int A_ALL
public static final double DEFAULT_SUPERSCRIPT_SCALE
public static final double DEFAULT_SUPERSCRIPT_DELTAY
public static final int DEFAULT_SUPERSCRIPT_SUBLEVEL
public MTextAttributes(int set, int subl, Color c, MFont ft, double scale, double dx, double dy)
set
- bits corresponding to the attributes setsubl
- the subscript/superscript levelc
- the colorft
- the fontscale
- the font scaledx
- the x shiftdy
- the y shiftA_SUBLEVEL
,
A_FOREGROUND
,
A_FONT
,
A_FONTFAMILY
,
A_FONTSIZE
,
A_BOLD
,
A_ITALIC
,
A_SCALE
,
A_DX
,
A_DY
public int getSet()
A_SUBLEVEL
,
A_FOREGROUND
,
A_FONT
,
A_FONTFAMILY
,
A_FONTSIZE
,
A_BOLD
,
A_ITALIC
,
A_SCALE
,
A_DX
,
A_DY
public MTextAttributes decode(String str, MFont deffnt, chemaxon.struc.graphics.MTextAttributes.MFontCreator fntcreator) throws IllegalArgumentException
str
- the stringdeffnt
- the default fontfntcreator
- the font creatorIllegalArgumentException
public byte getSubLevel()
public Color getForeground()
public MFont getBaseFont()
public String getFontFamily()
public double getScale()
public double getDx()
public double getDy()
public boolean isDefault()
public boolean isFontDefault(MFont deffnt)
deffnt
- the default fontpublic boolean isFontRegular()
public String toString()
public String encode(MFont deffnt, MTextAttributes prev)
deffnt
- the default fontprev
- attributes of the previous section or nullpublic boolean equalsNext(MTextAttributes o)
o
- attributes of the next sectionpublic boolean equals(MTextAttributes o)
o
- other attributespublic boolean equals(Object o)
public boolean isCompatible(MTextAttributes newCommon, MTextAttributes origCommon, MFont deffnt)
newCommon
- the new common attributesorigCommon
- the original common attributesdeffnt
- default fontA_SUBLEVEL
,
A_FOREGROUND
,
A_FONT
,
A_FONTFAMILY
,
A_FONTSIZE
,
A_BOLD
,
A_ITALIC
,
A_SCALE
,
A_DX
,
A_DY
public MTextAttributes getCompatibleAttributes(MTextAttributes attr, MFont deffnt, chemaxon.struc.graphics.MTextAttributes.MFontCreator ftcreator, int set0)
attr
- the other attributes objectdeffnt
- the default fontftcreator
- the font creatorset0
- the initial set or 0isCompatible(MTextAttributes, MTextAttributes, MFont)
public MTextAttributes createCompatible(MTextAttributes newCommon, MTextAttributes origCommon, MFont deffnt, chemaxon.struc.graphics.MTextAttributes.MFontCreator ftcreator)
public MTextAttributes createNext()
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
IOException
ClassNotFoundException
public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
IOException