TextSystem
MRSystem
TextSystem ⇐ Handles text creation and font rendering for mr-text
, mr-textfield
, and mr-textarea
with a starting framerate of 1/30.
Kind: global class
Extends: MRSystem
- TextSystem ⇐
MRSystem
- .TextSystem
- .onNewEntity(entity)
- ._updateSpecificEntity()
- .eventUpdate()
- .update(deltaTime, frame)
- .updateStyle(entity)
- .addText(entity)
- .parseFontWeight(weight) ⇒
string
- .parseFontSize(val, el) ⇒
number
- .getVerticalAlign(verticalAlign, entity) ⇒
string
- .getLineHeight(lineHeight, entity) ⇒
number
- .getTextAlign(textAlign) ⇒
string
- .setColor(textObj, color)
- .parseFontFace(cssString) ⇒
object
textSystem.TextSystem
Kind: instance class of TextSystem
new exports.TextSystem()
TextSystem’s default constructor
textSystem.onNewEntity(entity)
When a new entity is created, adds it to the physics registry and initializes the physics aspects of the entity.
Kind: instance method of TextSystem
Param | Type | Description |
---|---|---|
entity | MREntity |
the entity being set up |
textSystem._updateSpecificEntity()
The per entity triggered update call. Handles updating all text items including updates for style and cleaning of content for special characters.
Kind: instance method of TextSystem
textSystem.eventUpdate()
The per global scene event update call. Handles updating all text items including updates for style and cleaning of content for special characters.
Kind: instance method of TextSystem
textSystem.update(deltaTime, frame)
The per-frame system update call for all text items including updates for style and cleaning of content for special characters.
Kind: instance method of TextSystem
Param | Type | Description |
---|---|---|
deltaTime | number |
given timestep to be used for any feature changes |
frame | object |
given frame information to be used for any feature changes |
textSystem.updateStyle(entity)
Updates the style for the text’s information based on compStyle and inputted css elements.
Kind: instance method of TextSystem
Param | Type | Description |
---|---|---|
entity | MRTextEntity |
the text entity whose style is being updated |
textSystem.addText(entity)
Handles when text is added as an entity updating content and style for the internal textObj appropriately.
Kind: instance method of TextSystem
Param | Type | Description |
---|---|---|
entity | MRTextEntity |
the text entity being updated |
string
textSystem.parseFontWeight(weight) ⇒ parses the font weight as ‘bold’, ‘normal’, etc based on the given weight value
Kind: instance method of TextSystem
Returns: string
- - the enum of ‘bold’, ‘normal’, etc
Param | Type | Description |
---|---|---|
weight | number |
the numerical representation of the font-weight |
number
textSystem.parseFontSize(val, el) ⇒ parses the font size based on its XXpx
value and converts it to a usable result based on the virtual display resolution
Kind: instance method of TextSystem
Returns: number
- - the font size adjusted for the display as expected
Param | Type | Description |
---|---|---|
val | number |
the value being adjusted |
el | object |
the css element handler |
string
textSystem.getVerticalAlign(verticalAlign, entity) ⇒ Gets the vertical align
Kind: instance method of TextSystem
Returns: string
- - the string representation of the the verticalAlign
Param | Type | Description |
---|---|---|
verticalAlign | number |
the numerical representation in pixel space of the vertical Align |
entity | MREntity |
the entity whose comp style (css) is relevant |
number
textSystem.getLineHeight(lineHeight, entity) ⇒ Gets the line height
Kind: instance method of TextSystem
Returns: number
- - the numerical representation of the the lineHeight
Param | Type | Description |
---|---|---|
lineHeight | number |
the numerical representation in pixel space of the line height |
entity | MREntity |
the entity whose comp style (css) is relevant |
string
textSystem.getTextAlign(textAlign) ⇒ Gets the text alignment string
Kind: instance method of TextSystem
Returns: string
- - the resolved textAlign
.
Param | Type | Description |
---|---|---|
textAlign | string |
handles values for start , end , left , and right ; otherwise, defaults to the same input as textAlign . |
textSystem.setColor(textObj, color)
Sets the matrial color and opacity based on the css color element
Kind: instance method of TextSystem
Param | Type | Description |
---|---|---|
textObj | object |
the textObj whose color is being updated |
color | object |
the representation of color as rgba(xxx,xxx,xxx) or as #xxx |
object
textSystem.parseFontFace(cssString) ⇒ Based on the given font-face value in the passed cssString, tries to either use by default or download the requested font-face for use by the text object.
Kind: instance method of TextSystem
Returns: object
- - json object respresenting the preloaded font-face
Param | Type | Description |
---|---|---|
cssString | string |
the css string to be parsed for the font-face css value. |