rdkit.sping.PS.pidPS module — The RDKit 2016.09.1 documentation

# rdkit.sping.PS.pidPS module

piddlePS - a PostScript backend for the PIDDLE drawing module

> Magnus Lie Hetland

> 1999

class `rdkit.sping.PS.pidPS.` `EpsDSC`

  Bases: `rdkit.sping.PS.pidPS.PsDSC`

  `documentHeader`()

class `rdkit.sping.PS.pidPS.` `PSCanvas`(size=(300, 300), name='piddlePS', PostScriptLevel=2, fontMapEncoding={('helvetica', 'Bold'): 'Helvetica-Bold-ISOLatin1', 'EncodingName': 'Latin1Encoding', ('courier', 'Bold'): 'Courier-Bold-ISOLatin1', ('courier', 'Italic'): 'Courier-Oblique-ISOLatin1', ('times', 'Bold'): 'Times-Bold-ISOLatin1', ('helvetica', 'Roman'): 'Helvetica-Roman-ISOLatin1', ('times', 'Italic'): 'Times-Italic-ISOLatin1', ('symbol', 'Italic'): 'Symbol', ('times', 'Roman'): 'Times-Roman-ISOLatin1', ('symbol', 'Roman'): 'Symbol', ('symbol', 'Bold'): 'Symbol', ('courier', 'Roman'): 'Courier-Roman-ISOLatin1', ('helvetica', 'Italic'): 'Helvetica-Oblique-ISOLatin1'})

  Bases: `rdkit.sping.pid.Canvas`

  This canvas is meant for generating encapsulated PostScript files (EPS) used for inclusion in other documents; thus really only single-page documents are supported. For historical reasons and because they can be printed (a showpage is included), the files are given a .ps extension by default, and a primitive sort of multipage document can be generated using nextPage() or clear(). Use at your own risk! Future versions of piddlePS will include an EPSCanvas and a PSCanvas which will clearly delineate between single and multipage documents.

  Note: All font encodings must be taken care in __init__, you can’t add
    more after this
  `clear`()

    clear resets the canvas to it’s default state. Though this canvas is really only meant to be an EPS canvas, i.e., single page, for historical reasons we will allow multipage documents. Thus clear will end the page, clear the canvas state back to default, and start a new page. In the future, this PSCanvas will become EPSCanvas and will not support multipage documents. In that case, the canvas will be reset to its default state and the file will be emptied of all previous drawing commands

  `drawArc`(x1, y1, x2, y2, startAng=0, extent=360, edgeColor=None, edgeWidth=None, fillColor=None, dash=None, **kwargs)

    Draw a partial ellipse inscribed within the rectangle x1,y1,x2,y2, starting at startAng degrees and covering extent degrees. Angles start with 0 to the right (+x) and increase counter-clockwise. These should have x1<x2 and y1<y2.

  `drawCurve`(x1, y1, x2, y2, x3, y3, x4, y4, edgeColor=None, edgeWidth=None, fillColor=None, closed=0, dash=None, **kwargs)
  `drawEllipse`(x1, y1, x2, y2, edgeColor=None, edgeWidth=None, fillColor=None, dash=None, **kwargs)

    Draw an orthogonal ellipse inscribed within the rectangle x1,y1,x2,y2. These should have x1<x2 and y1<y2.

  `drawFigure`(partList, edgeColor=None, edgeWidth=None, fillColor=None, closed=0, dash=None, **kwargs)
  `drawLine`(x1, y1, x2, y2, color=None, width=None, dash=None, **kwargs)
  `drawLines`(lineList, color=None, width=None, dash=None, **kwargs)
  `drawPolygon`(pointlist, edgeColor=None, edgeWidth=None, fillColor=None, closed=0, dash=None, **kwargs)
  `drawRoundRect`(x1, y1, x2, y2, rx=8, ry=8, edgeColor=None, edgeWidth=None, fillColor=None, dash=None, **kwargs)

    Draw a rounded rectangle between x1,y1, and x2,y2, with corners inset as ellipses with x radius rx and y radius ry. These should have x1<x2, y1<y2, rx>0, and ry>0.

  `drawString`(self, s, x, y, font=None, color=None, angle=0)

    draw a string s at position x,y

  `flush`()
  `fontAscent`(font=None)
  `fontDescent`(font=None)
  `nextPage`()
  `psBeginDocument`()
  `psBeginPage`(pageName=None)
  `psEndDocument`()
  `psEndPage`()
  `resetToDefaults`()
  `save`(file=None, format=None)

    Write the current document to a file or stream and close the file Computes any final trailers, etc. that need to be done in order to produce a well formed postscript file. At least for now though, it still allows you to add to the file after a save by not actually inserting the finalization code into self.code

    the format argument is not used

  `stringWidth`(s, font=None)

    Return the logical width of the string if it were drawn in the current font (defaults to self.font).

exception `rdkit.sping.PS.pidPS.` `PostScriptLevelException`

  Bases: `ValueError`

class `rdkit.sping.PS.pidPS.` `PsDSC`

  Bases: `object`

  `BeginPageStr`(pageSetupStr, pageName=None)

    Use this at the beginning of each page, feed it your setup code in the form of a string of postscript. pageName is the “number” of the page. By default it will be 0.

  `EndPageStr`()
  `boundingBoxStr`(x0, y0, x1, y1)

    coordinates of bbox in default PS coordinates

  `documentHeader`()

`rdkit.sping.PS.pidPS.` `dashLineDefinition`()

`rdkit.sping.PS.pidPS.` `latin1FontEncoding`(fontname)

  use this to generating PS code for re-encoding a font as ISOLatin1 from font with name ‘fontname’ defines reencoded font, ‘fontname-ISOLatin1’