def txt(self,
            thetext,
            trafo,
            halign=text.ALIGN_LEFT,
            valign=text.ALIGN_BASE,
            chargap=1.0,
            wordgap=1.0,
            linegap=1.0):
        thetext = self.unicode_decoder(thetext)
        if len(trafo) == 2:
            trafo = Translation(trafo)
        else:
            trafo = apply(Trafo, trafo)
        object = text.SimpleText(text=thetext,
                                 trafo=trafo,
                                 halign=halign,
                                 valign=valign,
                                 properties=self.get_prop_stack())

        object.properties.SetProperty(align=halign,
                                      valign=valign,
                                      chargap=chargap,
                                      wordgap=wordgap,
                                      linegap=linegap)
        self.append_object(object)
Esempio n. 2
0
    def txt(self,
            readline,
            thetext,
            trafo,
            halign=text.ALIGN_LEFT,
            valign=text.ALIGN_BASE,
            chargap=1.0,
            wordgap=1.0,
            linegap=1.0):
        if type(thetext) == IntType:
            txt = ''
            for item in range(thetext):
                txt += readline()
            txt = txt.decode('utf-8')
        else:
            txt = self.unicode_decoder(thetext)

        if len(trafo) == 2:
            trafo = Translation(trafo)
        else:
            trafo = apply(Trafo, trafo)
        obj = text.SimpleText(text=txt,
                              trafo=trafo,
                              halign=halign,
                              valign=valign,
                              properties=self.get_prop_stack())

        obj.properties.SetProperty(align=halign,
                                   valign=valign,
                                   chargap=chargap,
                                   wordgap=wordgap,
                                   linegap=linegap)
        self.append_object(obj)
Esempio n. 3
0
	def txt(self, thetext, trafo, halign=text.ALIGN_LEFT,
			valign=text.ALIGN_BASE):
		if len(trafo) == 2:
			trafo = Translation(trafo)
		else:
			trafo = apply(Trafo, trafo)
		object = text.SimpleText(text=thetext, trafo=trafo,
									halign=halign, valign=valign,
									properties=self.get_prop_stack())
		self.append_object(object)
	def TEXT(self, size):
		P = self.Pnt()
		F = self.Enum()
		S = self.getstr()
		T = Translation(self.trafo(P))
		Py = Point(reff.text.orientation[0]).normalized()
		Px = Point(reff.text.orientation[1]).normalized()
		B = transform_base(Point(0.0, 0.0) , reff.text.expansion * Px , Py)
		self.style = basestyle.Duplicate()
		self.style.font = GetFont(fntlst[self.fntmap[reff.text.fontindex]])
		self.style.font_size = reff.text.height * self.Scale
		self.style.fill_pattern = SolidPattern(apply(CreateRGBColor , reff.text.color))
		O = text.SimpleText(text=S, trafo=T(B),
							halign=text.ALIGN_LEFT, valign=text.ALIGN_BASE,
							properties=self.get_prop_stack())
		self.append_object(O)
 def simple_text(self,
                 str,
                 trafo=None,
                 valign=text.ALIGN_BASE,
                 halign=text.ALIGN_LEFT):
     if type(trafo) == TupleType:
         if len(trafo) == 2:
             trafo = apply(Translation, trafo)
         else:
             raise TypeError, "trafo must be a Trafo-object or a 2-tuple"
     self.append_object(
         text.SimpleText(text=str,
                         trafo=trafo,
                         valign=valign,
                         halign=halign,
                         properties=self.get_prop_stack()))