Class CompositeTextLine
This class was designed and implemented by Jon T. Swanson, Ph.D.
Used to create composite text line objects.
public class CompositeTextLine : IBaselineDrawable, IDrawable
- Inheritance
-
CompositeTextLine
- Implements
- Inherited Members
Constructors
CompositeTextLine(float, float)
Creates a composite text line at the specified location.
public CompositeTextLine(float x, float y)
Parameters
Methods
AddComponent(TextLine)
Add a new text line.
Find the current font, current size and effects (normal, super or subscript) Set the position of the component to the starting stored as current position Set the size and offset based on effects Set the new current position
public CompositeTextLine AddComponent(TextLine component)
Parameters
componentTextLinethe component.
Returns
- CompositeTextLine
this CompositeTextLine object.
AddFormula(Font, string)
Adds the components of a chemical formula, in the specified font.
The digits that follow an element or a closing bracket are subscripts, as the 2 of H2O and the 6, 12 and 6 of C6H12O6; a run of digits and signs after a circumflex is a superscript, as the charge of Ca^2+ and SO4^2-; and everything else is drawn on the baseline, including a digit that begins the formula, as the 2 of 2H2O.
public CompositeTextLine AddFormula(Font font, string formula)
Parameters
Returns
- CompositeTextLine
this CompositeTextLine object.
DrawOn(Page)
Draws this line on the specified page.
public float[] DrawOn(Page page)
Parameters
pagePagethe page to draw on.
Returns
- float[]
x and y coordinates of the bottom right corner of this component.
GetAscent()
Returns how far above its baseline this composite text line reaches: the ascent of the component that reaches highest, a superscript included.
public float GetAscent()
Returns
- float
the ascent, in points.
GetDescent()
Returns how far below its baseline this composite text line reaches: the descent of the component that reaches lowest, a subscript included.
public float GetDescent()
Returns
- float
the descent, in points.
GetFontSize()
Gets the font size.
public float GetFontSize()
Returns
- float
fontSize the font size.
GetHeight()
Returns the height of this CompositeTextLine.
public float GetHeight()
Returns
- float
the height.
GetLocation()
Returns the position of this composite text line.
public float[] GetLocation()
Returns
- float[]
the x and y coordinates of this composite text line.
GetMinMaxY()
Returns the vertical coordinates of the top left and bottom right corners of the bounding box of this composite text line.
public float[] GetMinMaxY()
Returns
- float[]
the an array containing the vertical coordinates.
GetNumberOfTextLines()
Returns the number of text lines.
public int GetNumberOfTextLines()
Returns
- int
the number of text lines.
GetSubscriptFactor()
Gets the subscript factor for this text line.
public float GetSubscriptFactor()
Returns
- float
subscript the subscript size factor.
GetSubscriptPosition()
Gets the subscript position for this text line.
public float GetSubscriptPosition()
Returns
- float
subscriptPosition the subscript position.
GetSuperscriptFactor()
Gets the superscript factor for this text line.
public float GetSuperscriptFactor()
Returns
- float
superscript the superscript size factor.
GetSuperscriptPosition()
Gets the superscript position for this text line.
public float GetSuperscriptPosition()
Returns
- float
superscriptPosition the superscript position.
GetTextLine(int)
Return the nth entry in the TextLine array.
public TextLine GetTextLine(int index)
Parameters
indexintthe index of the nth element.
Returns
- TextLine
the text line at the specified index.
GetWidth()
Returns the width of this CompositeTextLine.
public float GetWidth()
Returns
- float
the width.
SetFontSize(float)
Sets the font size.
public CompositeTextLine SetFontSize(float fontSize)
Parameters
fontSizefloatthe font size.
Returns
- CompositeTextLine
this CompositeTextLine object.
SetLocation(float, float)
Loop through all the text lines and reset their location based on the new location set here.
public CompositeTextLine SetLocation(float x, float y)
Parameters
Returns
- CompositeTextLine
this CompositeTextLine object.
SetSubscriptFactor(float)
Sets the subscript factor for this composite text line.
public CompositeTextLine SetSubscriptFactor(float subscript)
Parameters
subscriptfloatthe subscript size factor.
Returns
- CompositeTextLine
this CompositeTextLine object.
SetSubscriptPosition(float)
Sets the subscript position for this composite text line.
public CompositeTextLine SetSubscriptPosition(float subscriptPosition)
Parameters
subscriptPositionfloatthe subscript position.
Returns
- CompositeTextLine
this CompositeTextLine object.
SetSuperscriptFactor(float)
Sets the superscript factor for this composite text line.
public CompositeTextLine SetSuperscriptFactor(float superscript)
Parameters
superscriptfloatthe superscript size factor.
Returns
- CompositeTextLine
this CompositeTextLine object.
SetSuperscriptPosition(float)
Sets the superscript position for this composite text line.
public CompositeTextLine SetSuperscriptPosition(float superscriptPosition)
Parameters
superscriptPositionfloatthe superscript position.
Returns
- CompositeTextLine
this CompositeTextLine object.