new BaseRichTextDrawer(bridge, options, drawConfigs)
A base and abstract rich text drawer class.
Parameters:
Name | Type | Description |
---|---|---|
bridge |
Object | Text draw bridge used. |
options |
Hash | Options to draw text. |
drawConfigs |
Object | instance of Kekule.Render.Render2DConfigs. // If not set, the singleton instance of Kekule.Render.Render2DConfigs will be used. |
Extends
- ObjectEx
Members
-
_FONT_OPTION_FIELDS
-
private
Methods
-
draw(context, coord, richText, options, drawConfigs) → {Object}
-
Draw a rich text on coordinate.
Parameters:
Name Type Description context
Object Context (canvas, SVG, VML, WebGL...) to draw. coord
Hash richText
Object Rich text object to draw. options
Object Options to draw text. Can have the following fields: { fontSize, fontFamily, charDirection, horizontalAlign, verticalAlign, textBoxXAlignment, textBoxYAlignment, textBoxAlignmentMode } Note here textBoxAlignmentMode decide the alignment style, BOX means alignment based on the whole box, ANCHOR means textBoxXAlignment and textBoxYAlignment affect on the childmost anchor item of richtext. drawConfigs
Object instance of Kekule.Render.Render2DConfigs. This param will override drawer's drawConfigs property. Returns:
Object drawed on screen.- Type
- Object
-
drawEx(context, coord, richText, options, drawConfigs) → {Object}
-
Draw a rich text on coordinate.
Parameters:
Name Type Description context
Object Context (canvas, SVG, VML, WebGL...) to draw. coord
Hash richText
Object Rich text object to draw. options
Object Options to draw text. Can have the following fields: { fontSize, fontFamily, charDirection, horizontalAlign, verticalAlign, textBoxXAlignment, textBoxYAlignment, textBoxAlignmentMode } Note here textBoxAlignmentMode decide the alignment style, BOX means alignment based on the whole box, ANCHOR means textBoxXAlignment and textBoxYAlignment affect on the childmost anchor item of richtext. drawConfigs
Object instance of Kekule.Render.Render2DConfigs. This param will override drawer's drawConfigs property. Returns:
A two fields object: { drawnObj: object on context that display the text. Can be null to some context (such as canvas). boundRect: bound rectangle of text on context. }- Type
- Object
-
initialize()