lib/cheapredwine.rb in cheapredwine-0.0.2 vs lib/cheapredwine.rb in cheapredwine-0.1.0
- old
+ new
@@ -1,15 +1,12 @@
require "cheapredwine/version"
require "cheapredwine/ttx"
require "cheapredwine/image"
-CheapRedWine::TTX.configure do |config|
- config.output_folder = 'spec/fixtures'
-end
module CheapRedWine
- class Font
+ class Meta
attr_accessor :name, :family, :features, :path
def initialize
yield(self) if block_given?
end
@@ -17,17 +14,17 @@
def file
File.new(path)
end
end
- def self.font(file)
+ def self.meta(file)
parser = TTX.for_font(file)
- Font.new do |font|
- font.name = parser.font_name
- font.family = parser.family_name
- font.features = parser.features
- font.path = file
+ Meta.new do |meta|
+ meta.name = parser.font_name
+ meta.family = parser.family_name
+ meta.features = parser.features
+ meta.path = file
end
end
def self.image(font, text, options = {})
features = merge_features(font.features, options.fetch(:features) { [] })
@@ -36,9 +33,17 @@
font: font.file,
text: text
})
params = Image::Params.new(options)
Image::Writer.new(params).exec
+ end
+
+ def self.ttx_output_folder=(folder)
+ CheapRedWine::TTX.configuration.output_folder = folder
+ end
+
+ def self.ttx_output_folder
+ CheapRedWine::TTX.configuration.output_folder
end
private
def self.merge_features(all_features, selected_features)