Dtext halign=, valign=

Hi Matthias,

I noticed that for "Dtext", .halign=(1) and .valign=(1) are not centering the text. It works for "text" though (v 25.8). Maybe it is working fine in the most recent version (not checked yet).

      layer = 10
      text = "HELP"
      origin = 20.0,10.0
      size = 2.0
      dbu = Application.instance.main_window.current_view.active_cellview.layout.dbu


      layer_info = LayerInfo.new(layer,0)

      layer_index = Application.instance.main_window.current_view.active_cellview.layout.layer(layer_info)


      label = RBA::DText::new(text, origin[0], origin[1])

      label.halign=(1)
      label.valign=(1)
      label.size=(size)

      Application.instance.main_window.current_view.active_cellview.cell.shapes(layer_index).insert(label)


      label = RBA::Text::new(text, (origin[0]/dbu).round, (origin[1]/dbu).round)

      label.halign=(1)
      label.valign=(1)
      label.size=((size/dbu).round)

      Application.instance.main_window.current_view.active_cellview.cell.shapes(layer_index).insert(label)

      Application.instance.main_window.current_view.add_missing_layers
      Application.instance.main_window.current_view.zoom_fit

Cheers,

Tomas

Comments

  • Hi Thomas,

    looks like it's working at least for my version:

    Most formats except GDS do not preserve text alignment as there no such feature there. Maybe you're looking at texts you have writted and read back?

    Matthias

  • Hi Matthias,

    Thank you for the fast reply. I upgraded to version 26.10 and the code works indeed fine there :-)
    Must have been a small issue in version 25.8 as I'm aware of text alignment preservation in GDS only and did not write and read back.

    Have a nice evening,

    Tomas

Sign In or Register to comment.