Text pcell sizing

To create a MaskID I use the pcell text and it works really great.
It creates for a project Name a text pcell in different Layer:

        import klayout.db as db
        import klayout.lib
        for eachLayer in self.MaskIdLayerList:
            if not eachLayer == self.trenchLayer:
                param = {
                  "text": self.projectName,       # the text to produce
                  "layer": db.LayerInfo(int(eachLayer),0),       # target layer of the TEXT
                  "mag": self.MaskIDmag

                pv = []
                for p in pcell_decl.get_parameters():
                  if p.name in param:
                bbox= self.top_cell.bbox()

                text_cell_index = self.layoutT.add_pcell_variant(self.Textlib, pcell_decl.id(), pv)
                t = db.Trans(db.Trans.R270, 0, 0)
                self.top_cell.insert(db.CellInstArray(text_cell_index, t))

The issue to solve now is that I need to shrink one dedicated layer (trench layer) about 1.5 um, otherwise DRC error occur.
Just changing the MAG won't help - the distance of all letters of the text should stay the same.
One possible solution is to create an additional text pcell, overlay with the other, flatten it and use the negative size to shrink. It works manual in the GUI but there might be a more elegant way to do it with python.
If you have one in mind I appreciate your feedback.
Best Regards,


  • @andyL

    There is such a parameter already. It's called "bias".

    This is a text with a magnification of 10 and a bias of -0.4:

    Please note - as you see on the "R" - for achieving a particular trench width you'll need a font which is made for biasing. Some features of the built-in font don't size properly.


  • Wow - overseen it. Thanks a lot, this save saves me a lot of work. Now the DRC requirement is fulfilled. Again - Thanks !!

Sign In or Register to comment.