コード例 #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)
コード例 #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)
コード例 #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
コード例 #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
コード例 #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
コード例 #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