code: function(segment_sizes, total_size, line, layout){
          // The passes done for fitting a label, and provided tolerances for each pass
          // First straight is chosen with a low tolerance. Then curved. Then straight with a higher tolerance.
          const passes = [
              { type: 'straight', tolerance : (layout.no_curving) ? LINE_EXCEED_STRAIGHT_NO_CURVE : LINE_EXCEED_STRAIGHT },
              { type: 'curved' },
              { type: 'straight', tolerance : LINE_EXCEED_STAIGHT_LOOSE }
          ];
  
          // loop through passes. first label found wins.
          for (let i = 0; i < passes.length; i++){
              let check = passes[i];
              let label;
              if (check.type === 'straight'){
                  label = new LabelLineStraight(total_size, line, layout, check.tolerance);
              }
              else if (check.type === 'curved' && !layout.no_curving && line.length > 2){
                  label = new LabelLineCurved(segment_sizes, line, layout);
              }
  
              if (label && !label.throw_away) {
                  return label;
              }
          }
  
          return false;
      }
docs: Given a label's bounding box size and size of broken up individual segments return a label that fits along the line geometry that is either straight (preferred) or curved (if straight tolerances aren't met)