Package chemaxon.struc.graphics
Class MTextDocument.Section
java.lang.Object
chemaxon.struc.graphics.MTextDocument.Section
- Enclosing class:
MTextDocument
Plain text section with uniform attributes.
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a text section.Section(int pos, String s, MTextAttributes attr) Constructs a text section.Copy constructor. -
Method Summary
Modifier and TypeMethodDescriptiondoubledoubleStringWidth(String s, MFont dmf, FontMetrics fm, Graphics g) Gets the width of a string as a floating point number.Gets the attributes.getFontMetrics(Graphics g, MFont deffnt) Gets and updates the font metrics of a document section.intGets the position in the document.Gets the text string.intlength()Gets text length.substring(int start) Gets a substring.substring(int start, int end) Gets a substring.
-
Constructor Details
-
Section
Constructs a text section.- Parameters:
pos- the position in the documents- the text string
-
Section
Constructs a text section.- Parameters:
pos- the position in the documents- the text stringattr- text attributes
-
Section
Copy constructor.- Parameters:
sec- the section to copy
-
-
Method Details
-
getPosition
public int getPosition()Gets the position in the document.- Returns:
- the position
-
getString
Gets the text string.- Returns:
- the string
-
substring
Gets a substring.- Parameters:
start- index of first character- Returns:
- the substring
-
substring
Gets a substring.- Parameters:
start- index of first characterend- index of last character + 1- Returns:
- the substring
-
length
public int length()Gets text length.- Returns:
- the length
-
getAttributes
Gets the attributes.- Returns:
- the attributes
-
getFontMetrics
Gets and updates the font metrics of a document section.- Parameters:
g- the graphics contextdeffnt- the default font- Returns:
- the font metrics
-
doubleStringWidth
Gets the width of a string as a floating point number. Anti-aliasing and fractional metrics hints can affect the value of the advance.- Parameters:
s- the stringfm- the font metricsg- the graphics context- Returns:
- the with of the string
- Since:
- Marvin 4.1, 11/01/2005
-