original_docstring: 
          Return the font for the given setting name.
          
docstring: Return the font for the given setting name.
docstring_tokens: Return the font for the given setting name .
code: def find_font(self, key, setting_name):
          """
          Return the font for the given setting name.
          """
          trace = 'zoom' in g.app.debug
          c, get = self.c, self.c.config.get
          default_size = c.config.defaultBodyFontSize
          for name in (setting_name, setting_name.rstrip('_font')):
              size_error = False
              family = get(name + '_family', 'family')
              size = get(name + '_size', 'size')
              slant = get(name + '_slant', 'slant')
              weight = get(name + '_weight', 'weight')
              if family or slant or weight or size:
                  family = family or g.app.config.defaultFontFamily
                  key = f"{key}::{setting_name}"
                  if key in self.zoom_dict:
                      old_size = self.zoom_dict.get(key)
                  else:
                      # It's a good idea to set size explicitly.
                      old_size = size or default_size
                  if isinstance(old_size, str):
                      # All settings should be in units of points.
                      try:
                          if old_size.endswith(('pt', 'px'),):
                              old_size = int(old_size[:-2])
                          else:
                              old_size = int(old_size)
                      except ValueError:
                          size_error = True
                  elif not isinstance(old_size, int):
                      size_error = True
                  if size_error:
                      g.trace('bad old_size:', old_size.__class__, old_size)
                      size = old_size
                  else:
                      # #490: Use c.zoom_size if it exists.
                      zoom_delta = getattr(c, 'zoom_delta', 0)
                      if zoom_delta:
                          size = old_size + zoom_delta
                          self.zoom_dict[key] = size
                  slant = slant or 'roman'
                  weight = weight or 'normal'
                  size = str(size)
                  font = g.app.gui.getFontFromParams(family, size, slant, weight)
                  # A good trace: the key shows what is happening.
                  if font:
                      if trace:
                          g.trace(
                              f"key: {key:>35} family: {family or 'None'} "
                              f"size: {size or 'None'} {slant} {weight}")
                      return font
          return None
code_tokens: def find_font ( self , key , setting_name ) : trace = 'zoom' in g . app . debug c , get = self . c , self . c . config . get default_size = c . config . defaultBodyFontSize for name in ( setting_name , setting_name . rstrip ( '_font' ) ) : size_error = False family = get ( name + '_family' , 'family' ) size = get ( name + '_size' , 'size' ) slant = get ( name + '_slant' , 'slant' ) weight = get ( name + '_weight' , 'weight' ) if family or slant or weight or size : family = family or g . app . config . defaultFontFamily key = f"{key}::{setting_name}" if key in self . zoom_dict : old_size = self . zoom_dict . get ( key ) else : old_size = size or default_size if isinstance ( old_size , str ) : try : if old_size . endswith ( ( 'pt' , 'px' ) , ) : old_size = int ( old_size [ : - 2 ] ) else : old_size = int ( old_size ) except ValueError : size_error = True elif not isinstance ( old_size , int ) : size_error = True if size_error : g . trace ( 'bad old_size:' , old_size . __class__ , old_size ) size = old_size else : zoom_delta = getattr ( c , 'zoom_delta' , 0 ) if zoom_delta : size = old_size + zoom_delta self . zoom_dict [ key ] = size slant = slant or 'roman' weight = weight or 'normal' size = str ( size ) font = g . app . gui . getFontFromParams ( family , size , slant , weight ) if font : if trace : g . trace ( f"key: {key:>35} family: {family or 'None'} " f"size: {size or 'None'} {slant} {weight}" ) return font return None
short_docstring: Return the font for the given setting name.
short_docstring_tokens: Return the font for the given setting name .
comment: """
          Return the font for the given setting name.
          """$SEP$# It's a good idea to set size explicitly.$SEP$# All settings should be in units of points.$SEP$# #490: Use c.zoom_size if it exists.$SEP$# A good trace: the key shows what is happening.