code: def __init__(self, base_font_ttf: str, font_size: int):
      self.font_name = (
          base_font_ttf
          if not base_font_ttf.endswith(".ttf")
          else base_font_ttf[:-4]
      )
  
      self.default_font = Font(
          ImageFont.truetype(self.font_name + ".ttf", size=font_size)
      )
  
      def font_or_default(ttf):
          try:
              return Font(ImageFont.truetype(ttf, size=font_size))
          except OSError:
              logger.warning(
                  f"Error loading font {ttf}. Using default font."
              )
              return self.default_font
  
      self.variants = [
          self.default_font,
          font_or_default(self.font_name + "-Bold.ttf"),
          font_or_default(self.font_name + "-Italic.ttf"),
          font_or_default(self.font_name + "-BoldItalic.ttf"),
      ]
  
imports: from PIL import ImageFont, ImageDraw, Image
  import numpy
  import random
  from skimage.transform import rescale
  from enum import IntEnum
  from collections import namedtuple
  from typing import List
  import logging
  from calamari_ocr.ocr.dataset.datareader.generated_line_dataset import LineGeneratorParams
label_desc: Use image node_id 1 to create a new FontVariants object  with example: obj = FontVariants(base_font_ttf, font_size)