Class zebkit.draw.TextRender
mixed with <zebkit.util.Position.Metric>
extends <zebkit.draw.BaseTextRender>
<zebkit.draw>

Text render that expects and draws a text model or a string as its target

Constructor:
zebkit.draw.TextRender (text)

Parameters:



public <String> getLine (r)
public <Integer> getLines ( )
private void invalidate (start, size)
public <Integer> lineWidth (line)
public void paintLine (g, x, y, line, d)
protected void paintSelection (g, x, y, w, h, line, d)
public void recalc ( )
public void setValue (s)
public void textUpdated (e)


public <String> getLine (r)

Get text line by the given line number


Parameters:
  • r <Integer>

    a line number


Returns: <String>

a text line

@Override zebkit.util.Position.Metric
public <Integer> getLines ( )

Get number of lines of target text


Returns: <Integer>

a number of line in the target text

private void invalidate (start, size)

Invalidate metrics for the specified range of lines.


Parameters:
  • start <Integer>

    first line to be invalidated

  • size <Integer>

    number of lines to be invalidated

public <Integer> lineWidth (line)

Get the given text line width in pixels


Parameters:
  • line <Integer>

    a text line number


Returns: <Integer>

a text line width in pixels

public void paintLine (g, x, y, line, d)

Paint the specified text line


Parameters:
protected void paintSelection (g, x, y, w, h, line, d)

Paint the specified text selection of the given line. The area where selection has to be rendered is denoted with the given rectangular area.


Parameters:
  • g <CanvasRenderingContext2D>

    a canvas graphical context

  • x <Integer>

    a x coordinate of selection rectangular area

  • y <Integer>

    a y coordinate of selection rectangular area

  • w <Integer>

    a width of of selection rectangular area

  • h <Integer>

    a height of of selection rectangular area

  • line <Integer>

    [description]

  • d <zebkit.layout.Layoutable>

    a target UI component where the text has to be rendered

public void recalc ( )

Called every time the target text metrics has to be recalculated

@Override zebkit.draw.Render
public chainable setValue (s)

Set the text model content


Parameters:
public void textUpdated (e)

Text model update listener handler


Parameters:


Inherited attributes:
public Integer lineIndent    protected zebkit.layout.Layoutable owner    public Object target   



public <String> color

Text color

public <String | zebkit.Font> font

Text font