Class: Label

lime.Label

new lime.Label(txt)

Display object for text
Parameters:
Name Type Description
txt string Text contents of the label.
Source:

Extends

Summary

Methods
<static> installFont(name, fileurl, opt_format)
Helper function to install new font file so you can use the font name as font-family.
calcWordsArray() → {Array.<string>}
Break text into array of line breakable words
getAlign() → {string}
Returns alignment value
getFontColor() → {string}
Returns font color as string
getFontFamily() → {string}
Returns font used to draw the label
getFontSize() → {number}
Returns font size in pixels
getFontWeight() → {string}
Returns font used to draw the label
getLineHeight() → {number}
Return line height as a factor from font size
getPadding() → {goog.math.Box}
Return padding box around the text contents
getShadowBlur() → {number}
Returns shadow blur radius in px.
getShadowColor() → {string}
Returns shadow color
getShadowOffset() → {goog.math.Vec2}
Returns shadow offset in px.
getSize()
getStyle() → {string}
Returns the current font style
getText() → {string}
Returns label text as stirng
<private> hasShadow_()
Returns true if the label has a shadow.
measureText() → {goog.math.Size}
Measure text contents of the label
setAlign(value) → {lime.Label}
Sets label alignment. Accepts normal strings as left,center,right
setFontColor(value) → {lime.Label}
Sets the font color. Accepts #hex, rgb(), rgba() or plain color name.
setFontFamily(value) → {lime.Label}
Set font name
setFontSize(value) → {lime.Label}
Set the font size in pixels
setFontWeight(value) → {lime.Label}
Set font weight
setLineHeight(value, opt_absolute)
Sets the line height used in multiline strings. Can be in pixels or factor from font size.
setPadding(top, opt_right, opt_bottom, opt_left) → {lime.Label}
Set new padding box around text contents.
setShadow(color, opt_blur, opt_offsetX, opt_offsetY) → {lime.Label}
Shorthand for adding shadow to a label. Calling setShadow(null) removes the shadow.
setShadowBlur(radius)
Set the shadow blur radius.
setShadowColor(color)
Set the shadow color.
setShadowOffset(offset, opt_offsetY) → {lime.Label}
Sets label shadow offset in px.
setStyle(txt) → {lime.Label}
Set label text
setText(txt) → {lime.Label}
Set label text
update()
wrapText(context, width) → {Array.<string>}
Wrap text on words array to lines based on current font size and given maximum width.
Inherited
lime.Sprite.addEventListenerlime.Sprite.addTransitionlime.Sprite.appendChildlime.Sprite.calcRelativeQualitylime.Sprite.clearTransitionlime.Sprite.createDomElementlime.Sprite.getAnchorPointlime.Sprite.getAutoResizelime.Sprite.getBoundingBoxlime.Sprite.getChildAtlime.Sprite.getChildIndexlime.Sprite.getCSS3DTransformsAllowedlime.Sprite.getDeepestDomElementlime.Sprite.getDeepestParentWithDomlime.Sprite.getDirectorlime.Sprite.getDirtylime.Sprite.getFilllime.Sprite.getFramelime.Sprite.getHiddenlime.Sprite.getMasklime.Sprite.getNumberOfChildrenlime.Sprite.getOpacitylime.Sprite.getParentlime.Sprite.getParentStack_lime.Sprite.getPositionlime.Sprite.getQualitylime.Sprite.getRelativeQualitylime.Sprite.getRotationlime.Sprite.getScalelime.Sprite.getScenelime.Sprite.getStrokelime.Sprite.hitTestlime.Sprite.localToNodelime.Sprite.localToParentlime.Sprite.localToScreenlime.Sprite.measureContentslime.Sprite.needsDomElementlime.Sprite.parentToLocallime.Sprite.removeAllChildrenlime.Sprite.removeChildlime.Sprite.removeChildAtlime.Sprite.removeDomElementlime.Sprite.removeEventListenerlime.Sprite.runActionlime.Sprite.screenToLocallime.Sprite.setAllow3DCSSTransformslime.Sprite.setAnchorPointlime.Sprite.setAutoResizelime.Sprite.setChildIndexlime.Sprite.setDirtylime.Sprite.setFilllime.Sprite.setHiddenlime.Sprite.setMasklime.Sprite.setOpacitylime.Sprite.setPositionlime.Sprite.setQualitylime.Sprite.setRendererlime.Sprite.setRotationlime.Sprite.setScalelime.Sprite.setSizelime.Sprite.setStrokelime.Sprite.updateDomElementlime.Sprite.updateLayoutlime.Sprite.wasAddedToTreelime.Sprite.wasRemovedFromTree

Members

<static> defaultFont :string

Default Font name for labels
Source:

id :string

Common name for label objects
Source:

supportedRenderers

Source:

Methods

<static> installFont(name, fileurl, opt_format)

Helper function to install new font file so you can use the font name as font-family.
Parameters:
Name Type Argument Description
name string Font name.
fileurl string Path to font file.
opt_format string <optional>
Font format.
Source:

calcWordsArray() → {Array.<string>}

Break text into array of line breakable words
Source:
Returns:
array of words.
Type
Array.<string>

getAlign() → {string}

Returns alignment value
Source:
Returns:
Alignement.
Type
string

getFontColor() → {string}

Returns font color as string
Source:
Returns:
Font color.
Type
string

getFontFamily() → {string}

Returns font used to draw the label
Source:
Returns:
Font name string.
Type
string

getFontSize() → {number}

Returns font size in pixels
Source:
Returns:
Font size in px.
Type
number

getFontWeight() → {string}

Returns font used to draw the label
Source:
Returns:
Font name string.
Type
string

getLineHeight() → {number}

Return line height as a factor from font size
Source:
Returns:
Line height.
Type
number

getPadding() → {goog.math.Box}

Return padding box around the text contents
Source:
Returns:
padding box.
Type
goog.math.Box

getShadowBlur() → {number}

Returns shadow blur radius in px.
Source:
Returns:
shadow blur radius in px.
Type
number

getShadowColor() → {string}

Returns shadow color
Source:
Returns:
shadow color.
Type
string

getShadowOffset() → {goog.math.Vec2}

Returns shadow offset in px.
Source:
Returns:
shadow offset in px.
Type
goog.math.Vec2

getSize()

Source:

getStyle() → {string}

Returns the current font style
Source:
Returns:
Style name string.
Type
string

getText() → {string}

Returns label text as stirng
Source:
Returns:
Text contents.
Type
string

<private> hasShadow_()

Returns true if the label has a shadow.
Source:

measureText() → {goog.math.Size}

Measure text contents of the label
Source:
Returns:
size of the text.
Type
goog.math.Size

setAlign(value) → {lime.Label}

Sets label alignment. Accepts normal strings as left,center,right
Parameters:
Name Type Description
value string New alignment value.
Source:
Returns:
object itself.
Type
lime.Label

setFontColor(value) → {lime.Label}

Sets the font color. Accepts #hex, rgb(), rgba() or plain color name.
Parameters:
Name Type Description
value string New color.
Source:
Returns:
object itself.
Type
lime.Label

setFontFamily(value) → {lime.Label}

Set font name
Parameters:
Name Type Description
value string New font family string.
Source:
Returns:
object itself.
Type
lime.Label

setFontSize(value) → {lime.Label}

Set the font size in pixels
Parameters:
Name Type Description
value number New font size in px.
Source:
Returns:
object itself.
Type
lime.Label

setFontWeight(value) → {lime.Label}

Set font weight
Parameters:
Name Type Description
value string New font weight value.
Source:
Returns:
object itself.
Type
lime.Label

setLineHeight(value, opt_absolute)

Sets the line height used in multiline strings. Can be in pixels or factor from font size.
Parameters:
Name Type Argument Description
value number Line height.
opt_absolute boolean <optional>
If height is in pixels.
Source:

setPadding(top, opt_right, opt_bottom, opt_left) → {lime.Label}

Set new padding box around text contents.
Parameters:
Name Type Argument Description
top number Top padding.
opt_right number <optional>
Right padding.
opt_bottom number <optional>
Bottom padding.
opt_left number <optional>
Left padding.
Source:
Returns:
object itself.
Type
lime.Label

setShadow(color, opt_blur, opt_offsetX, opt_offsetY) → {lime.Label}

Shorthand for adding shadow to a label. Calling setShadow(null) removes the shadow.
Parameters:
Name Type Argument Description
color string <nullable>
Shadow color.
opt_blur number <optional>
Shadow blur radius.
opt_offsetX number | goog.math.Vec2 <optional>
Shadow offset in X axis, or offset Vec2.
opt_offsetY number <optional>
Shadow offset in Y axis.
Source:
Returns:
object itself.
Type
lime.Label

setShadowBlur(radius)

Set the shadow blur radius.
Parameters:
Name Type Description
radius number The shadow blur radius.
Source:

setShadowColor(color)

Set the shadow color.
Parameters:
Name Type Description
color string The shadow color.
Source:

setShadowOffset(offset, opt_offsetY) → {lime.Label}

Sets label shadow offset in px.
Parameters:
Name Type Argument Description
offset goog.math.Vec2 | number Shadow offset.
opt_offsetY number <optional>
Optionaly set offset using x,y.
Source:
Returns:
object itself.
Type
lime.Label

setStyle(txt) → {lime.Label}

Set label text
Parameters:
Name Type Description
txt string New style contents.
Source:
Returns:
object itself.
Type
lime.Label

setText(txt) → {lime.Label}

Set label text
Parameters:
Name Type Description
txt string New text contents.
Source:
Returns:
object itself.
Type
lime.Label

update()

Source:

wrapText(context, width) → {Array.<string>}

Wrap text on words array to lines based on current font size and given maximum width.
Parameters:
Name Type Description
context Object Canvas2DContext used to measure.
width number Maximum line width.
Source:
Returns:
Lines of text.
Type
Array.<string>