code: def _load_font(face, bold, italic):
      key = "%s-%s-%s" % (face, bold, italic)
      if key in _font_dict:
          return _font_dict[key]
      if face in _vispy_fonts:
          return _load_vispy_font(face, bold, italic)
      traits = 0
      traits |= kCTFontBoldTrait if bold else 0
      traits |= kCTFontItalicTrait if italic else 0
  
      # Create an attribute dictionary.
      args = [
          None,
          0,
          cf.kCFTypeDictionaryKeyCallBacks,
          cf.kCFTypeDictionaryValueCallBacks,
      ]
      attributes = cf.CFDictionaryCreateMutable(*args)
      # Add family name to attributes.
      cfname = CFSTR(face)
      cf.CFDictionaryAddValue(
          attributes, kCTFontFamilyNameAttribute, cfname
      )
      cf.CFRelease(cfname)
      # Construct a CFNumber to represent the traits.
      itraits = c_int32(traits)
      sym_traits = cf.CFNumberCreate(
          None, kCFNumberSInt32Type, byref(itraits)
      )
      if sym_traits:
          # Construct a dictionary to hold the traits values.
          args = [
              None,
              0,
              cf.kCFTypeDictionaryKeyCallBacks,
              cf.kCFTypeDictionaryValueCallBacks,
          ]
          traits_dict = cf.CFDictionaryCreateMutable(*args)
          if traits_dict:
              # Add CFNumber traits to traits dictionary.
              cf.CFDictionaryAddValue(
                  traits_dict, kCTFontSymbolicTrait, sym_traits
              )
              # Add traits dictionary to attributes.
              cf.CFDictionaryAddValue(
                  attributes, kCTFontTraitsAttribute, traits_dict
              )
              cf.CFRelease(traits_dict)
          cf.CFRelease(sym_traits)
      # Create font descriptor with attributes.
      desc = ct.CTFontDescriptorCreateWithAttributes(attributes)
      cf.CFRelease(attributes)
      font = ct.CTFontCreateWithFontDescriptor(desc, 12.0, None)
      if not font:
          raise RuntimeError("Couldn't load font: %s" % face)
      _font_dict[key] = font
      return font
  
file_path: vispy/vispy/util/fonts/_quartz.py
imports: import numpy
  from ctypes import byref, c_int32, c_byte
  from ...ext.cocoapy import cf, ct, quartz, CFRange, CFSTR, CGGlyph, UniChar, kCTFontFamilyNameAttribute, kCTFontBoldTrait, kCTFontItalicTrait, kCTFontSymbolicTrait, kCTFontTraitsAttribute, kCTFontAttributeName, kCGImageAlphaPremultipliedLast, kCFNumberSInt32Type, ObjCClass
  from ._vispy_fonts import _vispy_fonts, _get_vispy_font_filename
label_desc: Use image node_id 2 for calling a global function with example usage: _load_font(face, bold, italic) and returns: font, _font_dict, _load_vispy_font