def __init__(self,writer=None,cpl=72,frameStyle="+-+|+-+|",**kw): TextPrinter.__init__(self,pageSize=(cpl,0),cpl=cpl,**kw) if writer is None: """ tests/75.py fails if I take stdout from self.session.toolkit because TestCase.setUp() only does setSystemConsole() while self.session remains the RunTests instance. """ writer=syscon.getSystemConsole() #writer=syscon.getSystemConsole().stdout #writer=self.session.toolkit.stdout #writer=sys.stdout self._writer = writer assert len(frameStyle) == 8 self.topLeft = frameStyle[0] self.topBorder = frameStyle[1] self.topRight = frameStyle[2] self.rightBorder = frameStyle[3] self.bottomRight = frameStyle[4] self.bottomBorder = frameStyle[5] self.bottomLeft = frameStyle[6] self.leftBorder = frameStyle[7]
def __init__(self, writer=None, cpl=72, frameStyle="+-+|+-+|", **kw): TextPrinter.__init__(self, pageSize=(cpl, 0), cpl=cpl, **kw) if writer is None: """ tests/75.py fails if I take stdout from self.session.toolkit because TestCase.setUp() only does setSystemConsole() while self.session remains the RunTests instance. """ writer = syscon.getSystemConsole() #writer=syscon.getSystemConsole().stdout #writer=self.session.toolkit.stdout #writer=sys.stdout self._writer = writer assert len(frameStyle) == 8 self.topLeft = frameStyle[0] self.topBorder = frameStyle[1] self.topRight = frameStyle[2] self.rightBorder = frameStyle[3] self.bottomRight = frameStyle[4] self.bottomBorder = frameStyle[5] self.bottomLeft = frameStyle[6] self.leftBorder = frameStyle[7]
def __init__(self, printerName=None, spoolFile=None, lpi=6, fontName="Courier New", fontWeights=None, jobName="Win32PrinterDocument", **kw): TextPrinter.__init__(self,pageSize=A4,**kw) self.lpi = None self.line = "" self.leading = 0 self.maxLeading=0 self.logfont=win32gui.LOGFONT() # 20070414 : self.weight_bold = win32con.FW_BOLD self.weight_normal = win32con.FW_NORMAL if fontWeights is not None: if len(fontWeights) != 2: raise TypeError("len(fontWeights) must be 2") for i in fontWeights: if type(i) != int: raise TypeError("%r : not an integer" % i) # bolder than normal because Courier.ttf isn't dark enough self.weight_normal = fontWeights[0] # win32con.FW_SEMIBOLD self.weight_bold = fontWeights[1] # win32con.FW_EXTRABOLD """ lfHeight lfWidth lfEscapement lfOrientation lfWeight lfItalic lfUnderline lfStrikeOut lfCharSet lfOutPrecision lfClipPrecision lfQuality lfPitchAndFamily Specifies the pitch and family of the font. The two low-order bits specify the pitch of the font and can be one of the following values: * DEFAULT_PITCH * FIXED_PITCH * VARIABLE_PITCH The four high-order bits specify the font family and can be one of the following values. Value Description FF_DECORATIVE Novelty fonts. Old English is an example. FF_DONTCARE Use default font. FF_MODERN Fonts with constant stroke width, with or without serifs. Pica, Elite, and Courier New are examples. FF_ROMAN Fonts with variable stroke width and with serifs. MS Serif is an example. FF_SCRIPT Fonts designed to look like handwriting. Script and Cursive are examples. FF_SWISS Fonts with variable stroke width and without serifs. MS Sans Serif is an example. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/fontext_8fp0.asp lfFaceName """ self.logfont.lfPitchAndFamily=win32con.FIXED_PITCH if fontName is not None: self.logfont.lfFaceName=fontName self.logfont.lfCharSet=win32con.OEM_CHARSET #self.logfont.lfCharSet=win32con.DEFAULT_CHARSET #self.logfont.lfCharSet=win32con.ANSI_CHARSET #self.logfont.lfCharSet=win32con.GB2312_CHARSET #self.logfont.lfCharSet=win32con.BALTIC_CHARSET #self.logfont.lfCharSet=win32con.HEBREW_CHARSET #self.logfont.lfCharSet=win32con.ARABIC_CHARSET #self.logfont.lfCharSet=win32con.SYMBOL_CHARSET self.logfont.lfWeight=self.weight_normal self.setCpi(self.cpi) ## self.fontDict = dict( ## name=fontName, ## #pitchAndFamily ## #orientation=50 ## ) ## try: ## self.fontDict['charset'] = charsets[encoding] ## except KeyError,e: ## self.debug("No charset defined for %s encoding",encoding) ## self.fontDict['charset'] = win32con.OEM_CHARSET #self.font = None #self.useWorldTransform=useWorldTransform self.spoolFile = spoolFile self.jobName = jobName #self.fontName=fontName if printerName is None: printerName=win32print.GetDefaultPrinter() self.printerName=printerName
def __init__(self, printerName=None, spoolFile=None, lpi=6, fontName="Courier New", fontWeights=None, jobName="Win32PrinterDocument", **kw): TextPrinter.__init__(self, pageSize=A4, **kw) self.lpi = None self.line = "" self.leading = 0 self.maxLeading = 0 self.logfont = win32gui.LOGFONT() # 20070414 : self.weight_bold = win32con.FW_BOLD self.weight_normal = win32con.FW_NORMAL if fontWeights is not None: if len(fontWeights) != 2: raise TypeError("len(fontWeights) must be 2") for i in fontWeights: if type(i) != int: raise TypeError("%r : not an integer" % i) # bolder than normal because Courier.ttf isn't dark enough self.weight_normal = fontWeights[0] # win32con.FW_SEMIBOLD self.weight_bold = fontWeights[1] # win32con.FW_EXTRABOLD """ lfHeight lfWidth lfEscapement lfOrientation lfWeight lfItalic lfUnderline lfStrikeOut lfCharSet lfOutPrecision lfClipPrecision lfQuality lfPitchAndFamily Specifies the pitch and family of the font. The two low-order bits specify the pitch of the font and can be one of the following values: * DEFAULT_PITCH * FIXED_PITCH * VARIABLE_PITCH The four high-order bits specify the font family and can be one of the following values. Value Description FF_DECORATIVE Novelty fonts. Old English is an example. FF_DONTCARE Use default font. FF_MODERN Fonts with constant stroke width, with or without serifs. Pica, Elite, and Courier New are examples. FF_ROMAN Fonts with variable stroke width and with serifs. MS Serif is an example. FF_SCRIPT Fonts designed to look like handwriting. Script and Cursive are examples. FF_SWISS Fonts with variable stroke width and without serifs. MS Sans Serif is an example. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/fontext_8fp0.asp lfFaceName """ self.logfont.lfPitchAndFamily = win32con.FIXED_PITCH if fontName is not None: self.logfont.lfFaceName = fontName self.logfont.lfCharSet = win32con.OEM_CHARSET #self.logfont.lfCharSet=win32con.DEFAULT_CHARSET #self.logfont.lfCharSet=win32con.ANSI_CHARSET #self.logfont.lfCharSet=win32con.GB2312_CHARSET #self.logfont.lfCharSet=win32con.BALTIC_CHARSET #self.logfont.lfCharSet=win32con.HEBREW_CHARSET #self.logfont.lfCharSet=win32con.ARABIC_CHARSET #self.logfont.lfCharSet=win32con.SYMBOL_CHARSET self.logfont.lfWeight = self.weight_normal self.setCpi(self.cpi) ## self.fontDict = dict( ## name=fontName, ## #pitchAndFamily ## #orientation=50 ## ) ## try: ## self.fontDict['charset'] = charsets[encoding] ## except KeyError,e: ## self.debug("No charset defined for %s encoding",encoding) ## self.fontDict['charset'] = win32con.OEM_CHARSET #self.font = None #self.useWorldTransform=useWorldTransform self.spoolFile = spoolFile self.jobName = jobName #self.fontName=fontName if printerName is None: printerName = win32print.GetDefaultPrinter() self.printerName = printerName