How to preserve gds text justification when using move_tree?

edited March 2016 in KLayout Support

I think it's a bug, but it might also be a feature.

I have gds text that is aligned center (both h and v). When I use move_tree the alignment is lost and becomes (Default). It then shows as left aligned.

I use use move_tree to create a cell with only one toplevel. After I merge several GDS libs I get too many toplevel cells. So I create a new layout and move_tree the wanted top cell to the new layout. There might be smarter ways to achieve this.

Theo

Comments

  • edited November -1

    Hi Theo,

    looks like this is a bug. I'll take a look at this.

    Matthias

  • edited November -1

    Hi Theo,

    I tried to reproduce the problem but I failed.

    Here is the code I used:

    # create a first layout and a single text with alignment flags
    
    ly = RBA::Layout::new(true)
    top = ly.create_cell("TOP")
    l1 = ly.layer(1, 0)
    t = RBA::Text::new
    t.string = "abc"
    t.valign = 2
    t.halign = 1
    top.shapes(l1).insert(t)
    
    puts "listing of shapes in 'top' (L1):"    
    top.shapes(l1).each do |s|
      puts s.text.to_s + " valign:" + s.text.valign.to_s + " halign:" + s.text.halign.to_s
    end
    
    # create a second layout and use move_tree to transfer the shapes from the first to the second layout
    
    ly2 = RBA::Layout::new(true)
    top2 = ly.create_cell("TOP")
    
    puts "Applying move_tree .."
    top2.move_tree(top)
    
    puts "listing of shapes in 'top' (L1):"
    top.shapes(l1).each do |s|
      puts s.text.to_s + " valign:" + s.text.valign.to_s + " halign:" + s.text.halign.to_s
    end
    

    The output for the current version 0.24.5 is:

    listing of shapes in 'top' (L1):
    ('abc',r0 0,0) valign:2 halign:1
    Applying move_tree ..
    listing of shapes in 'top' (L1):
    listing of shapes in 'top2' (L2):
    ('abc',r0 0,0) valign:2 halign:1
    

    From this log it seems as if the text alignment flags are transferred properly (2 and 1 is an arbitrary choice, but it's not default). So at least this basic application seems to work.

    Any idea?

    Matthias

Sign In or Register to comment.