class Prawn::Font::TTC

@private

Public Class Methods

font_names(file) click to toggle source

Returns a list of the names of all named fonts in the given ttc file. They are returned in order of their appearance in the file.

# File lib/prawn/font/ttc.rb, line 10
def self.font_names(file)
  TTFunk::Collection.open(file) do |ttc|
    ttc.map { |font| font.name.font_name.first }
  end
end

Private Instance Methods

font_option_to_index(file, option) click to toggle source
# File lib/prawn/font/ttc.rb, line 25
def font_option_to_index(file, option)
  if option.is_a?(Numeric)
    option
  else
    self.class.font_names(file).index { |n| n == option } || 0
  end
end
read_ttf_file() click to toggle source
# File lib/prawn/font/ttc.rb, line 18
def read_ttf_file
  TTFunk::File.from_ttc(
    @name,
    font_option_to_index(@name, @options[:font])
  )
end