madrobby-textorize 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/textorize/renderer.rb +13 -12
- metadata +3 -3
data/lib/textorize/renderer.rb
CHANGED
@@ -7,8 +7,7 @@ module Textorize
|
|
7
7
|
def initialize(window, string, options)
|
8
8
|
@text_view = NSTextView.alloc.initWithFrame([0,0,0,0])
|
9
9
|
|
10
|
-
|
11
|
-
set_attribs options
|
10
|
+
set_attr_and_text options, string
|
12
11
|
window.setContentView @text_view
|
13
12
|
@text_view.sizeToFit
|
14
13
|
|
@@ -25,19 +24,10 @@ module Textorize
|
|
25
24
|
|
26
25
|
private
|
27
26
|
|
28
|
-
def
|
27
|
+
def set_attr_and_text(options, string)
|
29
28
|
@text_view.setHorizontallyResizable(true)
|
30
29
|
@text_view.useAllLigatures(nil)
|
31
30
|
|
32
|
-
color = (options[:color] || '0,0,0').split(',')
|
33
|
-
background = (options[:background] || '1,1,1').split(',')
|
34
|
-
|
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))
|
40
|
-
|
41
31
|
para = NSMutableParagraphStyle.alloc.init
|
42
32
|
para.setLineSpacing(options[:lineheight])
|
43
33
|
|
@@ -50,6 +40,17 @@ module Textorize
|
|
50
40
|
|
51
41
|
@text_view.setTypingAttributes(attribs)
|
52
42
|
@text_view.lowerBaseline(nil)
|
43
|
+
|
44
|
+
@text_view.setString string
|
45
|
+
|
46
|
+
color = (options[:color] || '0,0,0').split(',')
|
47
|
+
background = (options[:background] || '1,1,1').split(',')
|
48
|
+
|
49
|
+
@text_view.setTextColor(
|
50
|
+
NSColor.colorWithDeviceRed_green_blue_alpha(color[0], color[1], color[2], 1))
|
51
|
+
|
52
|
+
@text_view.setBackgroundColor(
|
53
|
+
NSColor.colorWithDeviceRed_green_blue_alpha(background[0], background[1], background[2], 1))
|
53
54
|
end
|
54
55
|
|
55
56
|
end
|
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.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Fuchs
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-09-
|
12
|
+
date: 2009-09-27 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -23,6 +23,7 @@ extra_rdoc_files: []
|
|
23
23
|
|
24
24
|
files:
|
25
25
|
- Rakefile
|
26
|
+
- LICENSE
|
26
27
|
- bin/textorize
|
27
28
|
- lib/textorize
|
28
29
|
- lib/textorize/renderer.rb
|
@@ -30,7 +31,6 @@ files:
|
|
30
31
|
- lib/textorize/saver.rb
|
31
32
|
- lib/textorize.rb
|
32
33
|
- test/test_runner.rb
|
33
|
-
- LICENSE
|
34
34
|
has_rdoc: false
|
35
35
|
homepage: http://github.com/madrobby/textorize
|
36
36
|
licenses:
|