By opening gds II file klayout makes an error as soon as a text element is present on the file.
The exact error is: XY record expected (position=3679052, record number=287423, cell=Grating2)
The gds II file is readable with the Raith software. The structure was prepared with a python script of my own, but reproducing exactly what the Raith program normally generate. I give you the python function generating the TEXT:
def addText(self, pos, txt, height=None, mag=22.22222, layer=0, width=0, dose=1,angle=0):
# height is given in micron!
if height!=None: mag=height*22.22222
if angle!=0: self.addObj('ANGLE',angle*1.0)
The addObj function add binary data to the gds file where the first argument is the header ASCII (from http://www.rulabinsky.com/cavd/text/chapc.html) and the second argument is the parameter which is automatically converted in binary as the previous link suggest. Everything works fine with the Raith viewer.
This script that mimic what Raith is doing write the binary code \x17\x02 and \x11\x00. I have no idea what they mean, but klayout also crash when I don't include them.
Does anyone have an idea what is the exact problem?