madrobby-textorize 0.0.7 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE +21 -0
- data/bin/textorize +0 -16
- data/lib/textorize/renderer.rb +9 -10
- data/lib/textorize/runner.rb +1 -1
- metadata +2 -1
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
Copyright (c) 2009 Thomas Fuchs
|
2
|
+
http://script.aculo.us/thomas
|
3
|
+
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
a copy of this software and associated documentation files (the
|
6
|
+
"Software"), to deal in the Software without restriction, including
|
7
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be
|
13
|
+
included in all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/bin/textorize
CHANGED
@@ -18,14 +18,6 @@ opts = OptionParser.new do |opts|
|
|
18
18
|
options[:lineheight] = v
|
19
19
|
end
|
20
20
|
|
21
|
-
opts.on('-k', '--kerning=[STEPS]', Integer, 'Tighten or loosen kerning by the given amount') do |v|
|
22
|
-
options[:kerning] = v
|
23
|
-
end
|
24
|
-
|
25
|
-
opts.on('-w', '--width=[WIDTH]', Integer, 'Wrapping width in pixels') do |v|
|
26
|
-
options[:width] = v
|
27
|
-
end
|
28
|
-
|
29
21
|
opts.on('-o', '--output=[FILENAME]', String, 'Specify filename for saving') do |v|
|
30
22
|
options[:output] = v
|
31
23
|
end
|
@@ -34,14 +26,6 @@ opts = OptionParser.new do |opts|
|
|
34
26
|
options[:obliqueness] = v
|
35
27
|
end
|
36
28
|
|
37
|
-
opts.on('-t', '--stencil=[COLOR]', String, 'Render background with color and stencil text') do |v|
|
38
|
-
options[:stencil] = v
|
39
|
-
end
|
40
|
-
|
41
|
-
opts.on('-r', '--reverse', 'Reverse stencil (color on transparent background)') do
|
42
|
-
options[:reverse_stencil] = true
|
43
|
-
end
|
44
|
-
|
45
29
|
opts.on('-c', '--color=[COLOR]', String, 'Render text in specific color') do |v|
|
46
30
|
options[:color] = v
|
47
31
|
end
|
data/lib/textorize/renderer.rb
CHANGED
@@ -5,11 +5,11 @@ module Textorize
|
|
5
5
|
include OSX
|
6
6
|
|
7
7
|
def initialize(window, string, options)
|
8
|
-
@text_view = NSTextView.alloc.initWithFrame([0,0,
|
9
|
-
|
8
|
+
@text_view = NSTextView.alloc.initWithFrame([0,0,0,0])
|
9
|
+
|
10
|
+
@text_view.setString string
|
10
11
|
set_attribs options
|
11
12
|
window.setContentView @text_view
|
12
|
-
@text_view.setString string
|
13
13
|
@text_view.sizeToFit
|
14
14
|
|
15
15
|
window.display
|
@@ -30,14 +30,13 @@ module Textorize
|
|
30
30
|
@text_view.useAllLigatures(nil)
|
31
31
|
|
32
32
|
color = (options[:color] || '0,0,0').split(',')
|
33
|
-
|
34
|
-
bgcolor = (options[:background] || '1,1,1').split(',')
|
35
|
-
@text_view.setBackgroundColor(
|
36
|
-
NSColor.colorWithDeviceRed_green_blue_alpha(bgcolor[0], bgcolor[1], bgcolor[2], 1)
|
37
|
-
)
|
38
|
-
@text_view.setTextColor(fgcolor)
|
33
|
+
background = (options[:background] || '1,1,1').split(',')
|
39
34
|
|
40
|
-
|
35
|
+
@text_view.setTextColor(
|
36
|
+
NSColor.colorWithDeviceRed_green_blue_alpha(color[0], color[1], color[2], 1))
|
37
|
+
|
38
|
+
@text_view.setBackgroundColor(
|
39
|
+
NSColor.colorWithDeviceRed_green_blue_alpha(background[0], background[1], background[2], 1))
|
41
40
|
|
42
41
|
para = NSMutableParagraphStyle.alloc.init
|
43
42
|
para.setLineSpacing(options[:lineheight])
|
data/lib/textorize/runner.rb
CHANGED
@@ -24,7 +24,7 @@ module Textorize
|
|
24
24
|
attr_accessor :output
|
25
25
|
|
26
26
|
def initialize
|
27
|
-
@window = NSWindow.alloc.initWithContentRect_styleMask_backing_defer([
|
27
|
+
@window = NSWindow.alloc.initWithContentRect_styleMask_backing_defer([-2000, -2000, 2000, 2000], NSBorderlessWindowMask, 2, 0)
|
28
28
|
end
|
29
29
|
|
30
30
|
def applicationDidFinishLaunching(notification)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: madrobby-textorize
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Fuchs
|
@@ -30,6 +30,7 @@ files:
|
|
30
30
|
- lib/textorize/saver.rb
|
31
31
|
- lib/textorize.rb
|
32
32
|
- test/test_runner.rb
|
33
|
+
- LICENSE
|
33
34
|
has_rdoc: false
|
34
35
|
homepage: http://github.com/madrobby/textorize
|
35
36
|
licenses:
|