code: public function addFont(\PhpOffice\PhpSpreadsheet\Style\Font $font)
      {
          $fontHashCode = $font->getHashCode();
          if (isset($this->addedFonts[$fontHashCode])) {
              $fontIndex = $this->addedFonts[$fontHashCode];
          } else {
              $countFonts = count($this->fontWriters);
              $fontIndex = ($countFonts < 4) ? $countFonts : $countFonts + 1;
  
              $fontWriter = new Font($font);
              $fontWriter->setColorIndex($this->addColor($font->getColor()->getRGB()));
              $this->fontWriters[] = $fontWriter;
  
              $this->addedFonts[$fontHashCode] = $fontIndex;
          }
  
          return $fontIndex;
      }
docs: Add a font to added fonts.
  
  @param \PhpOffice\PhpSpreadsheet\Style\Font $font
  
  @return int Index to FONT record