textorize 0.23 → 0.24

Sign up to get free protection for your applications and to get access to all the features.
data/bin/textorize CHANGED
@@ -46,6 +46,10 @@ opts = OptionParser.new do |opts|
46
46
  options[:background] = v
47
47
  end
48
48
 
49
+ opts.on('-a', '--smoothing=[VALUE]', Integer, 'Font smoothing: 0=no subpixel AA, 1=light, 2=normal, 3=strong') do |v|
50
+ options[:font_smoothing] = v
51
+ end
52
+
49
53
  opts.on_tail('-h', '--help', 'Display this message and exit') do
50
54
  puts opts
51
55
  exit
@@ -4,7 +4,7 @@ module Textorize
4
4
  class Renderer
5
5
  include OSX
6
6
 
7
- def initialize(window, string, options)
7
+ def initialize(window, string, options)
8
8
  @text_view = NSTextView.alloc.initWithFrame([0,0,0,0])
9
9
 
10
10
  window.opaque = false
@@ -4,6 +4,12 @@ module Textorize
4
4
  class Runner
5
5
 
6
6
  def initialize(string, output, options)
7
+ if options[:font_smoothing]
8
+ defaults = OSX::NSUserDefaults.standardUserDefaults
9
+ options[:original_font_smoothing] = defaults.integerForKey('AppleFontSmoothing')
10
+ defaults.setInteger_forKey(options[:font_smoothing], 'AppleFontSmoothing')
11
+ end
12
+
7
13
  app = OSX::NSApplication.sharedApplication
8
14
  app.delegate = RunnerApplication.alloc.initWithString_output_options(string, output, options)
9
15
  app.run
@@ -40,6 +46,11 @@ module Textorize
40
46
  Saver.new(renderer).write_to_file(@output)
41
47
  end
42
48
  NSApplication.sharedApplication.terminate(nil)
49
+
50
+ if @options[:font_smoothing]
51
+ defaults = NSUserDefaults.standardUserDefaults
52
+ defaults.setInteger_forKey(options[:original_font_smoothing], 'AppleFontSmoothing')
53
+ end
43
54
  end
44
55
 
45
56
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: textorize
3
3
  version: !ruby/object:Gem::Version
4
- version: "0.23"
4
+ version: "0.24"
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Fuchs