# nodesnim/nodescontrol/rich_label

Dark Mode

Search:
Group by:

It provides convenient text rendering. With it, you can set color and underlie for specific chars.

# Imports

../thirdparty/opengl, ../thirdparty/opengl/glut, ../core/vector2, ../core/rect2, ../core/anchor, ../core/input, ../core/enums, ../core/color, ../core/color_text, ../nodes/node, control

# Types

    RichLabelObj = object of ControlRef
      font*: pointer               ## Glut font data.
      spacing*: float              ## Font spacing.
      size*: float                 ## Font size.
      text*: ColorTextRef          ## RichLabel text.
      text_align*: AnchorRef       ## Text align.

    RichLabelRef = ref RichLabelObj

# Procs

    proc RichLabel(name: string = "Richlabel"): RichLabelRef {...}{.raises: [], tags: [].}

  Creates a new RichLabel.

  Arguments:

  - `name` is a node name.

  Examples:

      var text = RichLabel("RichLabel")

# Methods

    method draw(self: RichLabelRef; w, h: GLfloat) {...}{.raises: [GLerror, Exception],
        tags: [RootEffect].}

  This uses in the `window.nim`.

    method duplicate(self: RichLabelRef): RichLabelRef {...}{.base, raises: [], tags: [].}

  Duplicates Richlabel object and create a new RichLabel.

    method setTextAlign(self: RichLabelRef; align: AnchorRef) {...}{.base, raises: [], tags: [].}

  Changes text alignment.

    method setTextAlign(self: RichLabelRef; x1, y1, x2, y2: float) {...}{.base, raises: [], tags: [].}

  Changes text alignment.

    method setText(self: RichLabelRef; value: ColorTextRef) {...}{.base, raises: [], tags: [].}

  Changes RichLabel text.