def DrawShape(self, device, rect=None, clip=0): RectangularPrimitive.DrawShape(self, device) base_trafo = self.trafo(self.atrafo) base_trafo = base_trafo(Scale(self.properties.font_size)) paths = self.properties.font.GetPaths(self.text, self.properties) obj = PolyBezier(paths, self.properties.Duplicate()) obj.Transform(base_trafo) device.MultiBezier(obj.paths, rect, clip)
def AsBezier(self): if self.text: text = split(self.text, '\n')[0] base_trafo = self.trafo(self.atrafo) base_trafo = base_trafo(Scale(self.properties.font_size)) paths = self.properties.font.GetPaths(self.text, self.properties) obj = PolyBezier(paths, self.properties.Duplicate()) obj.Transform(base_trafo) return obj
def Paths(self): if self.text: base_trafo = self.trafo(self.atrafo) if self.curves_cache is None: a = self.properties paths = a.font.get_paths(self.text, a) self.curves_cache = self.convert_paths(paths) paths = self.duplicate_paths(self.curves_cache) obj = PolyBezier(paths, self.properties.Duplicate()) obj.Transform(base_trafo) return obj.paths
def DrawShape(self, device, rect=None, clip=0): RectangularPrimitive.DrawShape(self, device) base_trafo = self.trafo(self.atrafo) if self.curves_cache is None: a = self.properties paths = a.font.get_paths(self.text, a) self.curves_cache = self.convert_paths(paths) paths = self.duplicate_paths(self.curves_cache) obj = PolyBezier(paths, self.properties.Duplicate()) obj.Transform(base_trafo) device.MultiBezier(obj.paths, rect, clip)
def AsBezier(self): if self.text: objects = [] base_trafo = self.trafo(self.atrafo) base_trafo = base_trafo(Scale(self.properties.font_size)) pos = self.properties.font.TypesetText(self.text) for i in range(len(self.text)): paths = self.properties.font.GetOutline(self.text[i]) if paths: props = self.properties.Duplicate() props.AddStyle(EmptyLineStyle) obj = PolyBezier(paths=paths, properties=props) trafo = base_trafo(Translation(pos[i])) obj.Transform(trafo) objects.append(obj) return Group(objects)