lib/mojo_magick.rb in mojo_magick-0.4.4 vs lib/mojo_magick.rb in mojo_magick-0.4.5
- old
+ new
@@ -1,8 +1,13 @@
cwd = File::dirname(__FILE__)
-require File::join(cwd, 'image_resources')
+initializers_dir = File::expand_path(File::join(cwd, 'initializers'))
+Dir.glob(File::join(initializers_dir, '*.rb')).each { |f| require f }
+require File::join(cwd, 'mojo_magick/util/parser')
+require File::join(cwd, 'image_magick/resource_limits')
+require File::join(cwd, 'image_magick/fonts')
require File::join(cwd, 'mojo_magick/opt_builder')
+require File::join(cwd, 'mojo_magick/font')
require 'tempfile'
# MojoMagick is a stateless set of module methods which present a convient interface
# for accessing common tasks for ImageMagick command line library.
@@ -58,11 +63,12 @@
class MojoMagickException < StandardError; end
class MojoError < MojoMagickException; end
class MojoFailed < MojoMagickException; end
# enable resource limiting functionality
- extend ImageMagickResources::ResourceLimits
+ extend ImageMagick::ResourceLimits
+ extend ImageMagick::Fonts
def MojoMagick::windows?
mem_fix = 1
!(RUBY_PLATFORM =~ /win32/).nil?
end
@@ -122,9 +128,14 @@
extras << "-gravity Center"
extras << "-extent #{geometry}"
end
retval = raw_command("convert", "\"#{source_file}\" -resize \"#{geometry}#{scale_options}\" #{extras.join(' ')} \"#{dest_file}\"")
dest_file
+ end
+
+ def MojoMagick::available_fonts
+ # returns width, height of image if available, nil if not
+ Font.all
end
# returns an empty hash or a hash with :width and :height set (e.g. {:width => INT, :height => INT})
# raises MojoFailed when results are indeterminate (width and height could not be determined)
def MojoMagick::get_image_size(source_file)