chemaxon.struc.graphics
Class MTextDocument.Section

java.lang.Object
  extended by chemaxon.struc.graphics.MTextDocument.Section
Enclosing class:
MTextDocument

public static class MTextDocument.Section
extends java.lang.Object

Plain text section with uniform attributes.


Constructor Summary
MTextDocument.Section(int pos, java.lang.String s)
          Constructs a text section.
MTextDocument.Section(int pos, java.lang.String s, MTextAttributes attr)
          Constructs a text section.
MTextDocument.Section(MTextDocument.Section sec)
          Copy constructor.
 
Method Summary
 double doubleStringWidth(java.lang.String s, MFont dmf, java.awt.FontMetrics fm, java.awt.Graphics g)
          Gets the width of a string as a floating point number.
 MTextAttributes getAttributes()
          Gets the attributes.
 java.awt.FontMetrics getFontMetrics(java.awt.Graphics g, MFont deffnt)
          Gets and updates the font metrics of a document section.
 int getPosition()
          Gets the position in the document.
 java.lang.String getString()
          Gets the text string.
 int length()
          Gets text length.
 java.lang.String substring(int start)
          Gets a substring.
 java.lang.String substring(int start, int end)
          Gets a substring.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MTextDocument.Section

public MTextDocument.Section(int pos,
                             java.lang.String s)
Constructs a text section.

Parameters:
pos - the position in the document
s - the text string

MTextDocument.Section

public MTextDocument.Section(int pos,
                             java.lang.String s,
                             MTextAttributes attr)
Constructs a text section.

Parameters:
pos - the position in the document
s - the text string
attr - text attributes

MTextDocument.Section

public MTextDocument.Section(MTextDocument.Section sec)
Copy constructor.

Parameters:
sec - the section to copy
Method Detail

getPosition

public int getPosition()
Gets the position in the document.

Returns:
the position

getString

public java.lang.String getString()
Gets the text string.

Returns:
the string

substring

public java.lang.String substring(int start)
Gets a substring.

Parameters:
start - index of first character
Returns:
the substring

substring

public java.lang.String substring(int start,
                                  int end)
Gets a substring.

Parameters:
start - index of first character
end - index of last character + 1
Returns:
the substring

length

public int length()
Gets text length.

Returns:
the length

getAttributes

public MTextAttributes getAttributes()
Gets the attributes.

Returns:
the attributes

getFontMetrics

public java.awt.FontMetrics getFontMetrics(java.awt.Graphics g,
                                           MFont deffnt)
Gets and updates the font metrics of a document section.

Parameters:
g - the graphics context
deffnt - the default font
Returns:
the font metrics

doubleStringWidth

public double doubleStringWidth(java.lang.String s,
                                MFont dmf,
                                java.awt.FontMetrics fm,
                                java.awt.Graphics g)
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 string
fm - the font metrics
g - the graphics context
Returns:
the with of the string
Since:
Marvin 4.1, 11/01/2005