def get_font  # :nodoc:

    #   my $record;     # Record identifier
    #   my $length;     # Record length

    #   my $dyHeight;   # Height of font (1/20 of a point)
    #   my $grbit;      # Font attributes
    #   my $icv;        # Index to color palette
    #   my $bls;        # Bold style
    #   my $sss;        # Superscript/subscript
    #   my $uls;        # Underline
    #   my $bFamily;    # Font family
    #   my $bCharSet;   # Character set
    #   my $reserved;   # Reserved
    #   my $cch;        # Length of font name
    #   my $rgch;       # Font name
    #   my $encoding;   # Font name character encoding


    dyHeight   = @size * 20
    icv        = @color
    bls        = @bold
    sss        = @font_script
    uls        = @underline
    bFamily    = @font_family
    bCharSet   = @font_charset
    rgch       = @font
    encoding   = @font_encoding

    ruby_19 { rgch = convert_to_ascii_if_ascii(rgch) }

    # Handle utf8 strings
    if is_utf8?(rgch)
      rgch = utf8_to_16be(rgch)
      encoding = 1
    end

    cch = rgch.bytesize
    #
    # Handle Unicode font names.
    if (encoding == 1)
      raise "Uneven number of bytes in Unicode font name" if cch % 2 != 0
      cch  /= 2 if encoding !=0
      rgch  = utf16be_to_16le(rgch)
    end

    record     = 0x31
    length     = 0x10 + rgch.bytesize
    reserved   = 0x00

    grbit      = 0x00
    grbit     |= 0x02 if @italic != 0
    grbit     |= 0x08 if @font_strikeout != 0
    grbit     |= 0x10 if @font_outline != 0
    grbit     |= 0x20 if @font_shadow != 0


    header = [record, length].pack("vv")
    data   = [dyHeight, grbit, icv, bls,
              sss, uls, bFamily,
              bCharSet, reserved, cch, encoding].pack('vvvvvCCCCCC')

    header + data + rgch
  end
def get_font  # :nodoc:

    #   my $record;     # Record identifier
    #   my $length;     # Record length

    #   my $dyHeight;   # Height of font (1/20 of a point)
    #   my $grbit;      # Font attributes
    #   my $icv;        # Index to color palette
    #   my $bls;        # Bold style
    #   my $sss;        # Superscript/subscript
    #   my $uls;        # Underline
    #   my $bFamily;    # Font family
    #   my $bCharSet;   # Character set
    #   my $reserved;   # Reserved
    #   my $cch;        # Length of font name
    #   my $rgch;       # Font name
    #   my $encoding;   # Font name character encoding


    dyHeight   = @size * 20
    icv        = @color
    bls        = @bold
    sss        = @font_script
    uls        = @underline
    bFamily    = @font_family
    bCharSet   = @font_charset
    rgch       = @font
    encoding   = @font_encoding

    ruby_19 { rgch = convert_to_ascii_if_ascii(rgch) }

    # Handle utf8 strings
    if is_utf8?(rgch)
      rgch = utf8_to_16be(rgch)
      encoding = 1
    end

    cch = rgch.bytesize
    #
    # Handle Unicode font names.
    if (encoding == 1)
      raise "Uneven number of bytes in Unicode font name" if cch % 2 != 0
      cch  /= 2 if encoding !=0
      rgch  = utf16be_to_16le(rgch)
    end

    record     = 0x31
    length     = 0x10 + rgch.bytesize
    reserved   = 0x00

    grbit      = 0x00
    grbit     |= 0x02 if @italic != 0
    grbit     |= 0x08 if @font_strikeout != 0
    grbit     |= 0x10 if @font_outline != 0
    grbit     |= 0x20 if @font_shadow != 0


    header = [record, length].pack("vv")
    data   = [dyHeight, grbit, icv, bls,
              sss, uls, bFamily,
              bCharSet, reserved, cch, encoding].pack('vvvvvCCCCCC')

    header + data + rgch
  end
Generate an Excel BIFF FONT record.