mxText

Extends mxShape to implement a text shape.  To change vertical text from bottom to top to top to bottom, the following code can be used:

mxText.prototype.ieVerticalFilter = 'progid:DXImageTransform.Microsoft.BasicImage(rotation=1)';
mxText.prototype.verticalTextDegree = 90;

mxText.prototype.getVerticalOffset = function(offset)
{
  return new mxPoint(-offset.y, offset.x);
};
Summary
mxTextExtends mxShape to implement a text shape.
Functions
mxTextConstructs a new text shape.
Variables
replaceLinefeedsSpecifies if linefeeds in HTML labels should be replaced with BR tags.
ieVerticalFilterHolds the filter definition for vertical text in IE.
verticalTextDegreeSpecifies the degree to be used for vertical text.
forceIgnoreStringSizeSpecifies if the string size should always be ignored.
Functions
isStyleSetReturns true if the given font style (bold, italic etc) is true in this shape’s fontStyle.
createOverride to create HTML regardless of gradient and rounded property.
updateBoundingBoxOverrides method to do nothing.
createForeignObjectCreates and returns the foreignObject node to represent this shape.
createHtmlCreates and returns the HTML node to represent this shape.
createVmlCreates and returns the VML node(s) to represent this shape.
redrawHtmlUpdates the HTML node(s) to reflect the latest bounds and scale.
getOffsetReturns the description of the space between the <bounds> size and the label size as an mxPoint.
getSpacingReturns the spacing as an mxPoint.
createHtmlTableCreates and returns a HTML table with a table body and a single row with a single cell.
updateTableStyleUpdates the style of the given HTML table and the value within the table.
getTableSizeReturns the actual size of the table.
updateTableWidthUpdates the width of the given HTML table.
redrawVmlUpdates the VML node(s) to reflect the latest bounds and scale.
redrawTextboxRedraws the textbox for this text.
redrawHtmlTableRedraws the HTML table.
getVerticalOffsetReturns the factors for the offset to be added to the text vertical text rotation.
redrawForeignObjectRedraws the foreign object for this text.
createSvgCreates and returns the SVG node(s) to represent this shape.
redrawSvgUpdates the SVG node(s) to reflect the latest bounds and scale.
redrawSvgTextNodesHook to update the position of the SVG text nodes.
releaseSvgClipReleases the given SVG clip removing it from the DOM if required.
getSvgClipReturns a new or existing SVG clip path which is a descendant of the given SVG node with a unique ID.
isEmptyStringReturns true if the given string is empty or contains only whitespace.
createSvgSpanCreats an SVG tspan node for the given text.
destroyExtends destroy to remove any allocated SVG clips.

Functions

mxText

function mxText(value,
bounds,
align,
valign,
color,
family,
size,
fontStyle,
spacing,
spacingTop,
spacingRight,
spacingBottom,
spacingLeft,
horizontal,
background,
border,
wrap,
clipped,
overflow,
labelPadding)

Constructs a new text shape.

Parameters

valueString that represents the text to be displayed.  This is stored in <value>.
boundsmxRectangle that defines the bounds.  This is stored in mxShape.bounds.
alignSpecifies the horizontal alignment.  Default is ‘’.  This is stored in <align>.
valignSpecifies the vertical alignment.  Default is ‘’.  This is stored in <valign>.
colorString that specifies the text color.  Default is ‘black’.  This is stored in <color>.
familyString that specifies the font family.  Default is mxConstants.DEFAULT_FONTFAMILY.  This is stored in <family>.
sizeInteger that specifies the font size.  Default is mxConstants.DEFAULT_FONTSIZE.  This is stored in <size>.
fontStyleSpecifies the font style.  Default is 0.  This is stored in <fontStyle>.
spacingInteger that specifies the global spacing.  Default is 2.  This is stored in <spacing>.
spacingTopInteger that specifies the top spacing.  Default is 0.  The sum of the spacing and this is stored in <spacingTop>.
spacingRightInteger that specifies the right spacing.  Default is 0.  The sum of the spacing and this is stored in <spacingRight>.
spacingBottomInteger that specifies the bottom spacing.  Default is 0.The sum of the spacing and this is stored in <spacingBottom>.
spacingLeftInteger that specifies the left spacing.  Default is 0.  The sum of the spacing and this is stored in <spacingLeft>.
horizontalBoolean that specifies if the label is horizontal.  Default is true.  This is stored in <horizontal>.
backgroundString that specifies the background color.  Default is null.  This is stored in <background>.
borderString that specifies the label border color.  Default is null.  This is stored in <border>.
wrapSpecifies if word-wrapping should be enabled.  Default is false.  This is stored in <wrap>.
clippedSpecifies if the label should be clipped.  Default is false.  This is stored in <clipped>.
overflowValue of the overflow style.  Default is ‘visible’.

Variables

replaceLinefeeds

mxText.prototype.replaceLinefeeds

Specifies if linefeeds in HTML labels should be replaced with BR tags.  Default is true.  This is also used in mxImageExport to export the label.

ieVerticalFilter

mxText.prototype.ieVerticalFilter

Holds the filter definition for vertical text in IE.  Default is progid:DXImageTransform.Microsoft.BasicImage(rotation=3).

verticalTextDegree

mxText.prototype.verticalTextDegree

Specifies the degree to be used for vertical text.  Default is -90.

forceIgnoreStringSize

mxText.prototype.forceIgnoreStringSize

Specifies if the string size should always be ignored.  Default is false.  This can be used to improve rendering speed in slow browsers.  This can be used if all labels are smaller than the vertex width.  String sizes are ignored by default for labels which are left aligned with no background and border or if the overflow is set to fill.

Functions

isStyleSet

mxText.prototype.isStyleSet = function(style)

Returns true if the given font style (bold, italic etc) is true in this shape’s fontStyle.

Parameters

styleFontstyle constant from mxConstants.

create

mxText.prototype.create = function(container)

Override to create HTML regardless of gradient and rounded property.

updateBoundingBox

mxText.prototype.updateBoundingBox = function()

Overrides method to do nothing.

createForeignObject

mxText.prototype.createForeignObject = function()

Creates and returns the foreignObject node to represent this shape.

createHtml

mxText.prototype.createHtml = function()

Creates and returns the HTML node to represent this shape.

createVml

mxText.prototype.createVml = function()

Creates and returns the VML node(s) to represent this shape.

redrawHtml

mxText.prototype.redrawHtml = function()

Updates the HTML node(s) to reflect the latest bounds and scale.

getOffset

mxText.prototype.getOffset = function(outerWidth,
outerHeight,
actualWidth,
actualHeight,
horizontal)

Returns the description of the space between the <bounds> size and the label size as an mxPoint.

getSpacing

mxText.prototype.getSpacing = function(horizontal)

Returns the spacing as an mxPoint.

createHtmlTable

mxText.prototype.createHtmlTable = function()

Creates and returns a HTML table with a table body and a single row with a single cell.

updateTableStyle

Updates the style of the given HTML table and the value within the table.

getTableSize

mxText.prototype.getTableSize = function(table)

Returns the actual size of the table.

updateTableWidth

mxText.prototype.updateTableWidth = function(table)

Updates the width of the given HTML table.

redrawVml

mxText.prototype.redrawVml = function()

Updates the VML node(s) to reflect the latest bounds and scale.

redrawTextbox

mxText.prototype.redrawTextbox = function()

Redraws the textbox for this text.  This is only used in IE in exact rendering mode.

redrawHtmlTable

mxText.prototype.redrawHtmlTable = function()

Redraws the HTML table.  This is used for HTML labels in all modes except exact in IE and if NO_FO is false for the browser.

getVerticalOffset

mxText.prototype.getVerticalOffset = function(offset)

Returns the factors for the offset to be added to the text vertical text rotation.  This implementation returns (offset.y, -offset.x).

redrawForeignObject

mxText.prototype.redrawForeignObject = function()

Redraws the foreign object for this text.

createSvg

mxText.prototype.createSvg = function()

Creates and returns the SVG node(s) to represent this shape.

redrawSvg

mxText.prototype.redrawSvg = function()

Updates the SVG node(s) to reflect the latest bounds and scale.

redrawSvgTextNodes

mxText.prototype.redrawSvgTextNodes = function(x,
y,
dy)

Hook to update the position of the SVG text nodes.

releaseSvgClip

mxText.prototype.releaseSvgClip = function()

Releases the given SVG clip removing it from the DOM if required.

getSvgClip

mxText.prototype.getSvgClip = function(svg,
x,
y,
w,
h)

Returns a new or existing SVG clip path which is a descendant of the given SVG node with a unique ID.

isEmptyString

mxText.prototype.isEmptyString = function(text)

Returns true if the given string is empty or contains only whitespace.

createSvgSpan

mxText.prototype.createSvgSpan = function(text)

Creats an SVG tspan node for the given text.

destroy

mxText.prototype.destroy = function()

Extends destroy to remove any allocated SVG clips.

Base class for all shapes.
function mxText(value,
bounds,
align,
valign,
color,
family,
size,
fontStyle,
spacing,
spacingTop,
spacingRight,
spacingBottom,
spacingLeft,
horizontal,
background,
border,
wrap,
clipped,
overflow,
labelPadding)
Constructs a new text shape.
mxText.prototype.replaceLinefeeds
Specifies if linefeeds in HTML labels should be replaced with BR tags.
mxText.prototype.ieVerticalFilter
Holds the filter definition for vertical text in IE.
mxText.prototype.verticalTextDegree
Specifies the degree to be used for vertical text.
mxText.prototype.forceIgnoreStringSize
Specifies if the string size should always be ignored.
mxText.prototype.isStyleSet = function(style)
Returns true if the given font style (bold, italic etc) is true in this shape’s fontStyle.
mxText.prototype.create = function(container)
Override to create HTML regardless of gradient and rounded property.
mxText.prototype.updateBoundingBox = function()
Overrides method to do nothing.
mxText.prototype.createForeignObject = function()
Creates and returns the foreignObject node to represent this shape.
mxText.prototype.createHtml = function()
Creates and returns the HTML node to represent this shape.
mxText.prototype.createVml = function()
Creates and returns the VML node(s) to represent this shape.
mxText.prototype.redrawHtml = function()
Updates the HTML node(s) to reflect the latest bounds and scale.
mxText.prototype.getOffset = function(outerWidth,
outerHeight,
actualWidth,
actualHeight,
horizontal)
Returns the description of the space between the bounds size and the label size as an mxPoint.
Implements a 2-dimensional vector with double precision coordinates.
mxText.prototype.getSpacing = function(horizontal)
Returns the spacing as an mxPoint.
mxText.prototype.createHtmlTable = function()
Creates and returns a HTML table with a table body and a single row with a single cell.
mxText.prototype.getTableSize = function(table)
Returns the actual size of the table.
mxText.prototype.updateTableWidth = function(table)
Updates the width of the given HTML table.
mxText.prototype.redrawVml = function()
Updates the VML node(s) to reflect the latest bounds and scale.
mxText.prototype.redrawTextbox = function()
Redraws the textbox for this text.
mxText.prototype.redrawHtmlTable = function()
Redraws the HTML table.
mxText.prototype.getVerticalOffset = function(offset)
Returns the factors for the offset to be added to the text vertical text rotation.
mxText.prototype.redrawForeignObject = function()
Redraws the foreign object for this text.
mxText.prototype.createSvg = function()
Creates and returns the SVG node(s) to represent this shape.
mxText.prototype.redrawSvg = function()
Updates the SVG node(s) to reflect the latest bounds and scale.
mxText.prototype.redrawSvgTextNodes = function(x,
y,
dy)
Hook to update the position of the SVG text nodes.
mxText.prototype.releaseSvgClip = function()
Releases the given SVG clip removing it from the DOM if required.
mxText.prototype.getSvgClip = function(svg,
x,
y,
w,
h)
Returns a new or existing SVG clip path which is a descendant of the given SVG node with a unique ID.
mxText.prototype.isEmptyString = function(text)
Returns true if the given string is empty or contains only whitespace.
mxText.prototype.createSvgSpan = function(text)
Creats an SVG tspan node for the given text.
mxText.prototype.destroy = function()
Extends destroy to remove any allocated SVG clips.
Extends mxPoint to implement a 2-dimensional rectangle with double precision coordinates.
mxShape.prototype.bounds
Holds the mxRectangle that specifies the bounds of this shape.
Defines the default family for all fonts in points.
Defines the default size for all fonts in points.
Creates a new image export instance to be used with an export canvas.
Defines various global constants.
Close