Example #1
0
  def _setPyartFont(self, fontInstance):
    # accounts for "None" option
    # does not act on self.defaultFont at all

    fontsize = fontInstance.size
    self._pycan.gstate.font_size = fontsize
    # map pid name for font to Pyart name
    pyartname = Fontmapping.getPyartName(fontInstance)
    self._pycan.gstate.setfont(pyartname)
Example #2
0
    def _setPyartFont(self, fontInstance):
        # accounts for "None" option
        # does not act on self.defaultFont at all

        fontsize = fontInstance.size
        self._pycan.gstate.font_size = fontsize
        # map pid name for font to Pyart name
        pyartname = Fontmapping.getPyartName(fontInstance)
        self._pycan.gstate.setfont(pyartname)
Example #3
0
 def fontDescent(self, font=None):
   if not font:
     font = self.defaultFont
   fontname = Fontmapping.getPdfName(font)
   return -pdfmetrics.ascent_descent[fontname][1] * 0.001 * font.size
Example #4
0
 def stringWidth(self, s, font=None):
   if not font:
     font = self.defaultFont
   fontname = Fontmapping.getPdfName(font)
   return pdfmetrics.stringwidth(s, fontname) * font.size * 0.001
Example #5
0
 def fontDescent(self, font=None):
     if not font:
         font = self.defaultFont
     fontname = Fontmapping.getPdfName(font)
     return -pdfmetrics.ascent_descent[fontname][1] * 0.001 * font.size
Example #6
0
 def stringWidth(self, s, font=None):
     if not font:
         font = self.defaultFont
     fontname = Fontmapping.getPdfName(font)
     return pdfmetrics.stringwidth(s, fontname) * font.size * 0.001