Class lime.Label
Extends
lime.Sprite.
Defined in: label.js.
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
lime.Label(txt)
Display object for text
|
| Field Attributes | Field Name and Description |
|---|---|
| <static> |
lime.Label.defaultFont
Default Font name for labels
|
|
Common name for label objects
|
|
- Fields borrowed from class lime.Sprite:
- fill_, getCanvasContextName_
- Fields borrowed from class lime.Node:
- customEvent_, eventHandlers_, inTree_, transitionsAdd_, transitionsClear_
| Method Attributes | Method Name and Description |
|---|---|
|
Break text into array of line breakable words
|
|
|
getAlign()
Returns alignment value
|
|
|
Returns font color as string
|
|
|
Returns font used to draw the label
|
|
|
Returns font size in pixels
|
|
|
Returns font used to draw the label
|
|
|
Return line height as a factor from font size
|
|
|
Return padding box around the text contents
|
|
|
getSize()
|
|
|
getText()
Returns label text as stirng
|
|
| <static> |
lime.Label.installFont(name, fileurl, opt_format)
Helper function to install new font file so you can use
the font name as font-family.
|
|
Measure text contents of the label
|
|
|
setAlign(value)
Sets label alignment.
|
|
|
setFontColor(value)
Sets the font color.
|
|
|
setFontFamily(value)
Set font name
|
|
|
setFontSize(value)
Set the font size in pixels
|
|
|
setFontWeight(value)
Set font weight
|
|
|
setLineHeight(value, opt_absolute)
Sets the line height used in multiline strings.
|
|
|
setPadding(top, opt_right, opt_bottom, opt_left)
Set new padding box around text contents.
|
|
|
setText(txt)
Set label text
|
|
|
update()
|
|
|
wrapText(context, width)
Wrap text on words array to lines based on current
font size and given maximum width.
|
- Methods borrowed from class lime.Sprite:
- getFill, getStroke, setFill, setStroke
- Methods borrowed from class lime.Node:
- addDependency, addEventListener, addTransition, appendChild, calcRelativeQuality, clearTransition, createDomElement, getAnchorPoint, getAutoResize, getBoundingBox, getChildAt, getChildIndex, getDeepestDomElement, getDeepestParentWithDom, getDirector, getDirty, getFrame, getHidden, getMask, getNumberOfChildren, getOpacity, getParent, getParentStack_, getPosition, getQuality, getRelativeQuality, getRotation, getScale, getScene, hitTest, localToNode, localToParent, localToScreen, measureContents, needsDomElement, parentToLocal, releaseDependencies, removeAllChildren, removeChild, removeChildAt, removeDependency, removeDomElement, removeEventListener, runAction, screenToLocal, setAnchorPoint, setAutoResize, setChildIndex, setDirty, setHidden, setMask, setOpacity, setPosition, setQuality, setRenderer, setRotation, setScale, setSize, setupDependencies, updateDomElement, updateLayout, wasAddedToTree, wasRemovedFromTree
Class Detail
lime.Label(txt)
Display object for text
- Parameters:
- {string} txt
- Text contents of the label.
Field Detail
<static>
lime.Label.defaultFont
Default Font name for labels
id
Common name for label objects
supportedRenderers
Method Detail
{Array.}
calcWordsArray()
Break text into array of line breakable words
- Returns:
- {Array.
} array of words.
{string}
getAlign()
Returns alignment value
- Returns:
- {string} Alignement.
{string}
getFontColor()
Returns font color as string
- Returns:
- {string} Font color.
{string}
getFontFamily()
Returns font used to draw the label
- Returns:
- {string} Font name string.
{number}
getFontSize()
Returns font size in pixels
- Returns:
- {number} Font size in px.
{string}
getFontWeight()
Returns font used to draw the label
- Returns:
- {string} Font name string.
{number}
getLineHeight()
Return line height as a factor from font size
- Returns:
- {number} Line height.
{goog.math.Box}
getPadding()
Return padding box around the text contents
- Returns:
- {goog.math.Box} padding box.
getSize()
{string}
getText()
Returns label text as stirng
- Returns:
- {string} Text contents.
<static>
lime.Label.installFont(name, fileurl, opt_format)
Helper function to install new font file so you can use
the font name as font-family.
- Parameters:
- {string} name
- Font name.
- {string} fileurl
- Path to font file.
- {string=} opt_format
- Font format.
{goog.math.Size}
measureText()
Measure text contents of the label
- Returns:
- {goog.math.Size} size of the text.
{lime.Label}
setAlign(value)
Sets label alignment. Accepts normal strings as left,center,right
- Parameters:
- {string} value
- New alignment value.
- Returns:
- {lime.Label} object itself.
{lime.Label}
setFontColor(value)
Sets the font color. Accepts #hex, rgb(), rgba() or plain color name.
- Parameters:
- {string} value
- New color.
- Returns:
- {lime.Label} object itself.
{lime.Label}
setFontFamily(value)
Set font name
- Parameters:
- {string} value
- New font family string.
- Returns:
- {lime.Label} object itself.
{lime.Label}
setFontSize(value)
Set the font size in pixels
- Parameters:
- {number} value
- New font size in px.
- Returns:
- {lime.Label} object itself.
{lime.Label}
setFontWeight(value)
Set font weight
- Parameters:
- {string} value
- New font weight value.
- Returns:
- {lime.Label} object itself.
setLineHeight(value, opt_absolute)
Sets the line height used in multiline strings. Can be in pixels
or factor from font size.
- Parameters:
- {number} value
- Line height.
- {boolean=} opt_absolute
- If height is in pixels.
{lime.Label}
setPadding(top, opt_right, opt_bottom, opt_left)
Set new padding box around text contents.
- Parameters:
- {number} top
- Top padding.
- {number=} opt_right
- Right padding.
- {number=} opt_bottom
- Bottom padding.
- {number=} opt_left
- Left padding.
- Returns:
- {lime.Label} object itself.
{lime.Label}
setText(txt)
Set label text
- Parameters:
- {string} txt
- New text contents.
- Returns:
- {lime.Label} object itself.
update()
{Array.}
wrapText(context, width)
Wrap text on words array to lines based on current
font size and given maximum width.
- Parameters:
- {Object} context
- Canvas2DContext used to measure.
- {number} width
- Maximum line width.
- Returns:
- {Array.
} Lines of text.