src/reportlab/lib/fontfinder.py
branchpy33
changeset 3723 99aa837b6703
parent 3721 0c93dd8ff567
child 3884 3bc59a4c3c21
equal deleted inserted replaced
3722:29c11b905751 3723:99aa837b6703
   103         return "FontDescriptor(%s)" % self.name
   103         return "FontDescriptor(%s)" % self.name
   104 
   104 
   105     def getTag(self):
   105     def getTag(self):
   106         "Return an XML tag representation"
   106         "Return an XML tag representation"
   107         attrs = []
   107         attrs = []
   108         for (k, v) in list(self.__dict__.items()):
   108         for k, v in self.__dict__.items():
   109             if k not in ['timeModified']:
   109             if k not in ['timeModified']:
   110                 if v:
   110                 if v:
   111                     attrs.append('%s=%s' % (k, quoteattr(str(v))))
   111                     attrs.append('%s=%s' % (k, quoteattr(str(v))))
   112         return '<font ' + ' '.join(attrs) + '/>'
   112         return '<font ' + ' '.join(attrs) + '/>'
   113 
   113 
   176     def getFontsWithAttributes(self, **kwds):
   176     def getFontsWithAttributes(self, **kwds):
   177         """This is a general lightweight search."""
   177         """This is a general lightweight search."""
   178         selected = []
   178         selected = []
   179         for font in self._fonts:
   179         for font in self._fonts:
   180             OK = True
   180             OK = True
   181             for (k, v) in list(kwds.items()):
   181             for k, v in kwds.items():
   182                 if getattr(font, k, None) != v:
   182                 if getattr(font, k, None) != v:
   183                     OK = False
   183                     OK = False
   184             if OK:
   184             if OK:
   185                 selected.append(font)
   185                 selected.append(font)
   186         return selected
   186         return selected