0

How can I layer shapes/text in Ruby RVG library? For example, I want to have "Text 1" over "Text 2":

rvg.text(0, 0, "Text 1")
rvg.text(0, 0, "Text 2")

Right now it will have "Text 2" over "Text 1" but I want to have "Text 1" over "Text 2".

Edit

In the following image I add a shape and then the text but the text is still under the shape. Regardless of which order I use, the text is always underneath.

shape and text

Artem Kalinchuk
  • 6,502
  • 7
  • 43
  • 57
  • 1
    You are adding them in the order in which they will be drawn. Since you want to draw text 1 over text 2, add it second. – Brennan Jun 14 '16 at 20:42
  • 1
    @Brennan I had some more findings. See the question with the updates. The text is underneath regardless. – Artem Kalinchuk Jun 15 '16 at 15:50
  • Ok, after a lot of debugging I figured it out. Turns out I was duplicating some of the shapes. What @Brennan said is correct. – Artem Kalinchuk Jun 15 '16 at 20:24

1 Answers1

0

As @Brennan specified, shapes will be drawn in the order they are added.

Artem Kalinchuk
  • 6,502
  • 7
  • 43
  • 57