class_docstr: FreeType font wrapper (requires _imagingft service)
class_docstr_tok: ["FreeType","font","wrapper","(","requires","_imagingft","service",")"]
docstr: :param name: The name of the style.
  :exception OSError: If the font is not a variation font.
docstr_tok: [":","param","name",":","The","name","of","the","style",".",":","exception","OSError",":","If","the","font","is","not","a","variation","font","."]
code: def set_variation_by_name(self, name):
      """
      :param name: The name of the style.
      :exception OSError: If the font is not a variation font.
      """
      names = self.get_variation_names()
      if not isinstance(name, bytes):
          name = name.encode()
      index = names.index(name) + 1
  
      if index == getattr(self, "_last_variation_index", None):
          # When the same name is set twice in a row,
          # there is an 'unknown freetype error'
          # https://savannah.nongnu.org/bugs/?56186
          return
      self._last_variation_index = index
  
      self.font.setvarname(index)
  
imports: import base64
  import os
  import sys
  import warnings
  from enum import IntEnum
  from io import BytesIO
  from .None import Image
  from ._util import is_directory, is_path
label_desc: Use image node_id 12 for calling the FreeTypeFont obj's underlying member method code with example usage: obj.set_variation_by_name(name) without return types