Class: Textorize::RunnerApplication
- Inherits:
-
OSX::NSObject
- Object
- OSX::NSObject
- Textorize::RunnerApplication
- Includes:
- OSX
- Defined in:
- lib/textorize/runner.rb
Instance Method Summary collapse
- #applicationDidFinishLaunching(notification) ⇒ Object
- #initWithString_output_options(string, output, options) ⇒ Object
- #list_fonts ⇒ Object
Instance Method Details
#applicationDidFinishLaunching(notification) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/textorize/runner.rb', line 41 def applicationDidFinishLaunching(notification) if @options[:util] == 'list-fonts' list_fonts else renderer = Renderer.new(@window, @string, @options) Saver.new(renderer).write_to_file(@output) end NSApplication.sharedApplication.terminate(nil) if @options[:font_smoothing] defaults = NSUserDefaults.standardUserDefaults defaults.setInteger_forKey([:original_font_smoothing], 'AppleFontSmoothing') end end |
#initWithString_output_options(string, output, options) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/textorize/runner.rb', line 23 def (string, output, ) if init @string, @output, @options = string, output, @window = NSWindow.alloc.objc_send( :initWithContentRect, [-2000, -2000, 2000, 2000], :styleMask, NSBorderlessWindowMask, :backing, 2, :defer, 0) self end end |
#list_fonts ⇒ Object
36 37 38 39 |
# File 'lib/textorize/runner.rb', line 36 def list_fonts fonts = NSFontManager.sharedFontManager.availableFontFamilies puts fonts.sort.join("\n") end |