Sha256: 23b7f37e7af9d046d067407668daf8bd67a82bdcc7da32f7518f98fe62ec4f4b
Contents?: true
Size: 1.11 KB
Versions: 1
Compression:
Stored size: 1.11 KB
Contents
namespace :fonts do desc "Convert a font to SVG" task :convert_svg => :merb_env do TMP_DIR = "/tmp/font-convert" TRUETYPE = FontFormat.new(:ttf, :otf) POSTSCRIPT = FontFormat.new(:cff, :otf) SVG = FontFormat.new(:ttf, :svg) file = ARGV[1] filename = File.basename(file) output_filename = filename.split('.')[0] + ".svg" FileUtils.mkdir(TMP_DIR) unless File.exist? TMP_DIR FileUtils.cp(file, TMP_DIR) naming_strategy = FontFileNamingStrategy.new(filename, TMP_DIR) converter = FontProcessing::FontConverter.new(naming_strategy) original_font_format = filename =~ /\.ttf$/ ? TRUETYPE : POSTSCRIPT FileUtils.cp(naming_strategy.source, naming_strategy.source(original_font_format)) converter.convert(TRUETYPE) if original_font_format.outline_format != :ttf FileUtils.cp(naming_strategy.source(TRUETYPE), naming_strategy.char_set(CharSet.default, TRUETYPE)) converter.convert_char_set(CharSet.default, TRUETYPE, SVG) FileUtils.cp(naming_strategy.char_set(CharSet.default, SVG), File.join(File.dirname(file), output_filename)) FileUtils.rmdir(TMP_DIR) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fontprocessor-27.1.3 | tasks/fonts.rake |