(self, **options)
See the class docstring for explanation of options.
See the class docstring for explanation of options.
See the class docstring for explanation of options .
def __init__(self, **options):
        """
        See the class docstring for explanation of options.
        """
        if not pil_available:
            raise PilNotAvailable(
                'Python Imaging Library is required for this formatter')
        Formatter.__init__(self, **options)
        # Read the style
        self.styles = dict(self.style)
        if self.style.background_color is None:
            self.background_color = '#fff'
        else:
            self.background_color = self.style.background_color
        # Image options
        self.image_format = get_choice_opt(
            options, 'image_format', ['png', 'jpeg', 'gif', 'bmp'],
            self.default_image_format, normcase=True)
        self.image_pad = get_int_opt(options, 'image_pad', 10)
        self.line_pad = get_int_opt(options, 'line_pad', 2)
        # The fonts
        fontsize = get_int_opt(options, 'font_size', 14)
        self.fonts = FontManager(options.get('font_name', ''), fontsize)
        self.fontw, self.fonth = self.fonts.get_char_size()
        # Line number options
        self.line_number_fg = options.get('line_number_fg', '#886')
        self.line_number_bg = options.get('line_number_bg', '#eed')
        self.line_number_chars = get_int_opt(options,
                                        'line_number_chars', 2)
        self.line_number_bold = get_bool_opt(options,
                                        'line_number_bold', False)
        self.line_number_italic = get_bool_opt(options,
                                        'line_number_italic', False)
        self.line_number_pad = get_int_opt(options, 'line_number_pad', 6)
        self.line_numbers = get_bool_opt(options, 'line_numbers', True)
        self.line_number_separator = get_bool_opt(options,
                                        'line_number_separator', True)
        self.line_number_step = get_int_opt(options, 'line_number_step', 1)
        self.line_number_start = get_int_opt(options, 'line_number_start', 1)
        if self.line_numbers:
            self.line_number_width = (self.fontw * self.line_number_chars +
                                   self.line_number_pad * 2)
        else:
            self.line_number_width = 0
        self.hl_lines = []
        hl_lines_str = get_list_opt(options, 'hl_lines', [])
        for line in hl_lines_str:
            try:
                self.hl_lines.append(int(line))
            except ValueError:
                pass
        self.hl_color = options.get('hl_color',
                                    self.style.highlight_color) or '#f90'
        self.drawables = []
def __init__ ( self , * * options ) : if not pil_available : raise PilNotAvailable ( 'Python Imaging Library is required for this formatter' ) Formatter . __init__ ( self , * * options ) # Read the style self . styles = dict ( self . style ) if self . style . background_color is None : self . background_color = '#fff' else : self . background_color = self . style . background_color # Image options self . image_format = get_choice_opt ( options , 'image_format' , [ 'png' , 'jpeg' , 'gif' , 'bmp' ] , self . default_image_format , normcase = True ) self . image_pad = get_int_opt ( options , 'image_pad' , 10 ) self . line_pad = get_int_opt ( options , 'line_pad' , 2 ) # The fonts fontsize = get_int_opt ( options , 'font_size' , 14 ) self . fonts = FontManager ( options . get ( 'font_name' , '' ) , fontsize ) self . fontw , self . fonth = self . fonts . get_char_size ( ) # Line number options self . line_number_fg = options . get ( 'line_number_fg' , '#886' ) self . line_number_bg = options . get ( 'line_number_bg' , '#eed' ) self . line_number_chars = get_int_opt ( options , 'line_number_chars' , 2 ) self . line_number_bold = get_bool_opt ( options , 'line_number_bold' , False ) self . line_number_italic = get_bool_opt ( options , 'line_number_italic' , False ) self . line_number_pad = get_int_opt ( options , 'line_number_pad' , 6 ) self . line_numbers = get_bool_opt ( options , 'line_numbers' , True ) self . line_number_separator = get_bool_opt ( options , 'line_number_separator' , True ) self . line_number_step = get_int_opt ( options , 'line_number_step' , 1 ) self . line_number_start = get_int_opt ( options , 'line_number_start' , 1 ) if self . line_numbers : self . line_number_width = ( self . fontw * self . line_number_chars + self . line_number_pad * 2 ) else : self . line_number_width = 0 self . hl_lines = [ ] hl_lines_str = get_list_opt ( options , 'hl_lines' , [ ] ) for line in hl_lines_str : try : self . hl_lines . append ( int ( line ) ) except ValueError : pass self . hl_color = options . get ( 'hl_color' , self . style . highlight_color ) or '#f90' self . drawables = [ ]