textorize 0.22 → 0.23

Sign up to get free protection for your applications and to get access to all the features.
data/bin/textorize CHANGED
@@ -18,6 +18,10 @@ opts = OptionParser.new do |opts|
18
18
  options[:lineheight] = v
19
19
  end
20
20
 
21
+ opts.on('-t', '--ligatures=[TYPE]', String, 'Ligatures usage: all, standard or off') do |v|
22
+ options[:ligatures] = v
23
+ end
24
+
21
25
  opts.on('--list-fonts', 'List available fonts') do |v|
22
26
  options[:util] = 'list-fonts'
23
27
  end
@@ -29,17 +29,19 @@ module Textorize
29
29
 
30
30
  def set_attr_and_text(options, string)
31
31
  @text_view.horizontallyResizable = true
32
- @text_view.useAllLigatures(nil)
33
32
 
34
33
  para = NSMutableParagraphStyle.alloc.init
35
34
  para.lineSpacing = options[:lineheight]
36
35
 
36
+ options[:ligatures] ||= 'standard'
37
+
37
38
  @text_view.typingAttributes = {
38
39
  NSFontAttributeName => NSFont.fontWithName_size(options[:font], options[:size]),
39
40
  NSKernAttributeName => options[:kerning],
40
41
  NSParagraphStyleAttributeName => para,
41
42
  NSBaselineOffsetAttributeName => 0,
42
- NSObliquenessAttributeName => options[:obliqueness]
43
+ NSObliquenessAttributeName => options[:obliqueness],
44
+ NSLigatureAttributeName => { 'off' => 0, 'standard' => 1, 'all' => 2 }[options[:ligatures]]
43
45
  }
44
46
 
45
47
  @text_view.lowerBaseline(nil)
@@ -47,7 +49,7 @@ module Textorize
47
49
  @text_view.string = string
48
50
  @text_view.textColor = NSColor.from_css(options[:color] || 'black')
49
51
  @text_view.backgroundColor = NSColor.from_css(options[:background] || 'white')
50
- @text_view.drawsBackground = true
52
+ @text_view.drawsBackground = true
51
53
  end
52
54
 
53
55
  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.22"
4
+ version: "0.23"
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Fuchs