lib/compass/fontcustom/glyph_map.rb in compass-fontcustom-1.3.0 vs lib/compass/fontcustom/glyph_map.rb in compass-fontcustom-1.3.1

- old
+ new

@@ -37,40 +37,36 @@ @glyphs.index name end # Starts the Fontcustom font generator to write font files to disk. def generate - args = self.class.config.generator_options || {} - args.merge!( - :input => path, - :output => output_dir, - :font_name => @name, - :no_hash => !Compass.configuration.fontcustom_hash, - :quiet => true, - :fonts => [] - ) - ::Fontcustom::Base.new(args).compile + args = (self.class.config.generator_options || {}). + merge(output: output_dir, quiet: true, fonts: []). + merge(Compass.configuration.fontcustom_options). + merge(font_name: @name, input: path) + @fontcustom = ::Fontcustom::Base.new(args) + @fontcustom.compile + File.delete(@fontcustom.manifest.manifest) if Compass.configuration.fontcustom_discard_manifest end - def filename - file = glob.first - File.basename file, File.extname(file) + def fonts + if @fontcustom + @fontcustom.manifest.get(:fonts).each_with_object({}) do |font, result| + result[File.extname(font)[1..-1].to_sym] = font + end + end end - def output_dir - Compass.configuration.fontcustom_fonts_path + def glyphs + @fontcustom.manifest.get :glyphs end def to_s @name.to_s end - protected - - def glob - glob = File.join output_dir, "#{self.name}*" - Dir[glob] - end - + def output_dir + Compass.configuration.fontcustom_fonts_path || Compass.configuration.fonts_path + end end end end