Sha256: c5b663cd546e4c04554031cf40c99976fc19da3c60ea625f2faf433e2757eb27
Contents?: true
Size: 955 Bytes
Versions: 3
Compression:
Stored size: 955 Bytes
Contents
require "extract_ttc" require "fontist/import/helpers/system_helper" require_relative "../otf/font_file" module Fontist module Import module Files class CollectionFile attr_reader :fonts def initialize(path) @path = path @fonts = read end def filename File.basename(@path) end private def read switch_to_temp_dir do |tmp_dir| extract_ttfs(tmp_dir).map do |path| Otf::FontFile.new(path) end end end def switch_to_temp_dir Dir.mktmpdir do |tmp_dir| Dir.chdir(tmp_dir) do yield tmp_dir end end end def extract_ttfs(tmp_dir) filenames = ExtractTtc.extract(@path) filenames.map do |filename| File.join(tmp_dir, filename) end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
fontist-1.6.0 | lib/fontist/import/files/collection_file.rb |
fontist-1.5.1 | lib/fontist/import/files/collection_file.rb |
fontist-1.5.0 | lib/fontist/import/files/collection_file.rb |