Package chemaxon.struc.graphics
Class MTextAttributes
java.lang.Object
chemaxon.struc.graphics.MTextAttributes
- All Implemented Interfaces:
Externalizable,Serializable
Text attributes. This class is immutable (constant), attributes can
only be set by the constructors.
- Since:
- Marvin 4.1, 10/05/2005
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intAll identifiers.static final intIdentifier of the font's bold subattribute.static final intIdentifier of the x shift attribute.static final intIdentifier of the y shift attribute.static final intIdentifier of the font attribute.static final intAll font bits.static final intIdentifier of the font family subattribute.static final intIdentifier of the font size subattribute.static final intIdentifier of the color attribute.static final intIdentifier of the font's italic subattribute.static final intIdentifier of the font scale attribute.static final intIdentifier of the subscript/superscript level attribute.static final MTextAttributesDefault attributes object.static final doubleDefault value of the y shift attribute in superscriptsstatic final doubleDefault value of the font scale attribute in superscriptsstatic final intDefault value of the superscript level attribute in superscripts -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a default attributes object.MTextAttributes(int set, int subl, Color c, MFont ft, double scale, double dx, double dy) Constructs an attributes object. -
Method Summary
Modifier and TypeMethodDescriptionCreates identical attributes for the next section.encode(MFont deffnt, MTextAttributes prev) Returns the string representation of the attributes.booleanTests whether two attributes objects equal or not.booleanTests whether two attributes objects equal or not.booleanTests whether the attributes of two neighboring sections equal or not.Gets the base font.doublegetDx()Gets the x shift.doublegetDy()Gets the y shift.Gets the font family name.Gets the foreground color.doublegetScale()Gets the relative size of the font compared to the base font.intgetSet()Gets the set of attributes used.byteGets the subscript/superscript level.inthashCode()booleanisCompatible(MTextAttributes newCommon, MTextAttributes origCommon, MFont deffnt) Tests whether two attribute sets are compatible.booleanTests whether all attributes have default values.booleanisFontDefault(MFont deffnt) Tests whether the default font is used.booleanTests whether the default font is used.voidtoString()Returns the string representation of the attributes.void
-
Field Details
-
DEFAULT
Default attributes object. -
A_SUBLEVEL
public static final int A_SUBLEVELIdentifier of the subscript/superscript level attribute.- See Also:
-
A_FOREGROUND
public static final int A_FOREGROUNDIdentifier of the color attribute.- See Also:
-
A_FONT
public static final int A_FONTIdentifier of the font attribute.- See Also:
-
A_FONTFAMILY
public static final int A_FONTFAMILYIdentifier of the font family subattribute.- See Also:
-
A_FONTSIZE
public static final int A_FONTSIZEIdentifier of the font size subattribute.- See Also:
-
A_BOLD
public static final int A_BOLDIdentifier of the font's bold subattribute.- See Also:
-
A_ITALIC
public static final int A_ITALICIdentifier of the font's italic subattribute.- See Also:
-
A_FONT_BITS
public static final int A_FONT_BITSAll font bits.- See Also:
-
A_SCALE
public static final int A_SCALEIdentifier of the font scale attribute.- See Also:
-
A_DX
public static final int A_DXIdentifier of the x shift attribute.- See Also:
-
A_DY
public static final int A_DYIdentifier of the y shift attribute.- See Also:
-
A_ALL
public static final int A_ALLAll identifiers.- See Also:
-
DEFAULT_SUPERSCRIPT_SCALE
public static final double DEFAULT_SUPERSCRIPT_SCALEDefault value of the font scale attribute in superscripts- See Also:
-
DEFAULT_SUPERSCRIPT_DELTAY
public static final double DEFAULT_SUPERSCRIPT_DELTAYDefault value of the y shift attribute in superscripts- See Also:
-
DEFAULT_SUPERSCRIPT_SUBLEVEL
public static final int DEFAULT_SUPERSCRIPT_SUBLEVELDefault value of the superscript level attribute in superscripts- See Also:
-
-
Constructor Details
-
MTextAttributes
public MTextAttributes()Constructs a default attributes object. -
MTextAttributes
Constructs an attributes object.- Parameters:
set- bits corresponding to the attributes setsubl- the subscript/superscript levelc- the colorft- the fontscale- the font scaledx- the x shiftdy- the y shift- See Also:
-
-
Method Details
-
getSet
public int getSet()Gets the set of attributes used.- Returns:
- the set
- See Also:
-
getSubLevel
public byte getSubLevel()Gets the subscript/superscript level.- Returns:
- the subscript/superscript level or 0
-
getForeground
Gets the foreground color.- Returns:
- the color
-
getBaseFont
Gets the base font.- Returns:
- the base font or null
-
getFontFamily
Gets the font family name.- Returns:
- the font family name
-
getScale
public double getScale()Gets the relative size of the font compared to the base font.- Returns:
- the font scale
-
getDx
public double getDx()Gets the x shift.- Returns:
- the shift
-
getDy
public double getDy()Gets the y shift.- Returns:
- the shift
-
isDefault
public boolean isDefault()Tests whether all attributes have default values.- Returns:
- true if all attributes are null or zero, false if there is at least one nondefault property
-
isFontDefault
Tests whether the default font is used.- Parameters:
deffnt- the default font- Returns:
- true if the default font is used, false otherwise
-
isFontRegular
public boolean isFontRegular()Tests whether the default font is used.- Returns:
- true if the default font is used, false otherwise
-
toString
Returns the string representation of the attributes. -
encode
Returns the string representation of the attributes. The returned string is written in the MRV file.- Parameters:
deffnt- the default fontprev- attributes of the previous section or null- Returns:
- the string
-
equalsNext
Tests whether the attributes of two neighboring sections equal or not.- Parameters:
o- attributes of the next section- Returns:
- true if the attributes equals, false otherwise
-
equals
Tests whether two attributes objects equal or not.- Parameters:
o- other attributes- Returns:
- true if the attributes equals, false otherwise
-
hashCode
public int hashCode() -
equals
Tests whether two attributes objects equal or not. -
isCompatible
Tests whether two attribute sets are compatible.- Parameters:
newCommon- the new common attributesorigCommon- the original common attributesdeffnt- default font- Returns:
- true if the attribute sets equal, false otherwise
- See Also:
-
createNext
Creates identical attributes for the next section.- Returns:
- the new attributes
-
readExternal
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOExceptionClassNotFoundException
-
writeExternal
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-