def __init__(self, fname, ffamily=None, fstyle='', fsize=0, ffname=None, fonts=None):
        """fname - name of the output pdf file
        you can initialize fonts in more ways, explicit (applies .add_font of fpdf) or explicit:
         - explicit with fonts= (see the implicit code bellow with DejaVu fonts where font styles B,I,BI are supported)
         - explicit with ffamily where just one font will be added
         - implicit DejaVu, if unicode fonts are installed for the fpdf package (in its font/ directory and so on)
         - implicit Arial, if fpdf cannot find unicode fonts
        """
        self.w_fname = fname
        self.w_pdf = FPDF()
        self.w_pdf.utils = Utils(self.w_pdf)
        self.w_pdf.add_page()
        explicit = ffamily or fonts
        if explicit:
            if not fonts:
                fonts = [(ffamily, '', ffname)] if ffname else []
        else:
            # try Unicode fonts from fpdf/font (or location defined by SYSTEM_TTFONTS or FPDF_FONTPATH) first
            fonts = [
                ('DejaVu', '', 'DejaVuSansCondensed.ttf'),
                ('DejaVu', 'B', 'DejaVuSansCondensed-Bold.ttf'),
                ('DejaVu', 'I', 'DejaVuSansCondensed-Oblique.ttf'),
                ('DejaVu', 'BI', 'DejaVuSansCondensed-BoldOblique.ttf'),
            ]
        try:
            for font in fonts:
                self.w_pdf.add_font(font[0], font[1], font[2], uni=True)
            self.w_pdf.set_font(fonts[0][0] if fonts else ffamily)
        except RuntimeError:
            if not explicit:    # fallback from unicode to latin-1
                self.w_pdf.set_font('Arial')
            else:
                raise RuntimeError(FONT_ERROR)
def __init__ ( self , fname , ffamily = None , fstyle = '' , fsize = 0 , ffname = None , fonts = None ) : self . w_fname = fname self . w_pdf = FPDF ( ) self . w_pdf . utils = Utils ( self . w_pdf ) self . w_pdf . add_page ( ) explicit = ffamily or fonts if explicit : if not fonts : fonts = [ ( ffamily , '' , ffname ) ] if ffname else [ ] else : fonts = [ ( 'DejaVu' , '' , 'DejaVuSansCondensed.ttf' ) , ( 'DejaVu' , 'B' , 'DejaVuSansCondensed-Bold.ttf' ) , ( 'DejaVu' , 'I' , 'DejaVuSansCondensed-Oblique.ttf' ) , ( 'DejaVu' , 'BI' , 'DejaVuSansCondensed-BoldOblique.ttf' ) , ] try : for font in fonts : self . w_pdf . add_font ( font [ 0 ] , font [ 1 ] , font [ 2 ] , uni = True ) self . w_pdf . set_font ( fonts [ 0 ] [ 0 ] if fonts else ffamily ) except RuntimeError : if not explicit : self . w_pdf . set_font ( 'Arial' ) else : raise RuntimeError ( FONT_ERROR )
fname - name of the output pdf file
        you can initialize fonts in more ways, explicit (applies .add_font of fpdf) or explicit:
         - explicit with fonts= (see the implicit code bellow with DejaVu fonts where font styles B,I,BI are supported)
         - explicit with ffamily where just one font will be added
         - implicit DejaVu, if unicode fonts are installed for the fpdf package (in its font/ directory and so on)
         - implicit Arial, if fpdf cannot find unicode fonts