def load(self, s): a = util.fromUTF8(s).split(",", 6) if len(a) != 7: return self.x = util.str2float(a[0], 0.0) self.y = util.str2float(a[1], 0.0) self.size = util.str2int(a[2], 12, 4, 288) self.isCentered, self.isRightJustified, self.isBold, self.isItalic, \ self.isUnderlined = util.flags2bools(a[3], "crbiu") tmp = { "Courier" : pml.COURIER, "Helvetica" : pml.HELVETICA, "Times" : pml.TIMES_ROMAN } self.font = tmp.get(a[4], pml.COURIER) self.items = util.unescapeStrings(a[6])
def load(self, s): a = util.fromUTF8(s).split(",", 4) if len(a) != 5: return self.line = util.str2int(a[0], 1, 1, 5) self.xoff = util.str2int(a[1], 0, -100, 100) l, c, self.isBold, self.isItalic, self.isUnderlined = \ util.flags2bools(a[2], "lcbiu") if l: self.align = util.ALIGN_LEFT elif c: self.align = util.ALIGN_CENTER else: self.align = util.ALIGN_RIGHT self.text = a[4]
def load(self, s): a = util.fromUTF8(s).split(",", 6) if len(a) != 7: return self.x = util.str2float(a[0], 0.0) self.y = util.str2float(a[1], 0.0) self.size = util.str2int(a[2], 12, 4, 288) self.isCentered, self.isRightJustified, self.isBold, self.isItalic, \ self.isUnderlined = util.flags2bools(a[3], "crbiu") tmp = { "Courier": pml.COURIER, "Helvetica": pml.HELVETICA, "Times": pml.TIMES_ROMAN } self.font = tmp.get(a[4], pml.COURIER) self.items = util.unescapeStrings(a[6])
def fromStr(self, vals, val, prefix): return util.fromUTF8(val)