textorize 0.26 → 0.27
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/textorize +4 -0
- data/lib/textorize/renderer.rb +3 -1
- metadata +1 -1
data/bin/textorize
CHANGED
@@ -30,6 +30,10 @@ opts = OptionParser.new do |opts|
|
|
30
30
|
options[:kerning] = v
|
31
31
|
end
|
32
32
|
|
33
|
+
opts.on('-p', '--padding=[VALUE]', Float, 'Padding in px') do |v|
|
34
|
+
options[:padding] = v
|
35
|
+
end
|
36
|
+
|
33
37
|
opts.on('-o', '--output=[FILENAME]', String, 'Specify filename for saving') do |v|
|
34
38
|
options[:output] = v
|
35
39
|
end
|
data/lib/textorize/renderer.rb
CHANGED
@@ -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
|
@@ -46,6 +46,8 @@ module Textorize
|
|
46
46
|
|
47
47
|
@text_view.lowerBaseline(nil)
|
48
48
|
|
49
|
+
@text_view.setTextContainerInset([options[:padding],options[:padding]]) if options[:padding]
|
50
|
+
|
49
51
|
@text_view.string = string
|
50
52
|
@text_view.textColor = NSColor.from_css(options[:color] || 'black')
|
51
53
|
@text_view.backgroundColor = NSColor.from_css(options[:background] || 'white')
|