wiz_rtf 0.6.8 → 0.6.9

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ac771b35f8a2481049d6d3903d414cf682efe9dc
4
- data.tar.gz: 0abedded749171f1f81d71c9da0dcedf23477f20
3
+ metadata.gz: 8e50f7ba95e98ae48567ca4bfd0a8421ace84aec
4
+ data.tar.gz: 287b9d99cccae42cfee1304b212f40bde5f13cc8
5
5
  SHA512:
6
- metadata.gz: e34a0f6a7a53dee404b7968223edfdb0d5761aa53bb6f6db8f0aed809a0b83619ae9eec4252566514dfe28e1a253669610e8c9b05fc612754c630425a7e71905
7
- data.tar.gz: ffd7b8bdc8b6e8d81b92193296977a35cb0794216d6139f82a94a66eebcddc22fc1df578df17ffb9ad3cb7b7ce150f44966b2f95769f93a039ee542b47af6297
6
+ metadata.gz: a0bd83208addc0565fda353b1b9c2102ac81a73c2e6e1dbbe70345f464723143746a492cdafdc28cb7541b0a140a1ba0d560d8d8ffd420080318ed35a33bf206
7
+ data.tar.gz: c94b03baf6581b26c6d3b0e84154ae840ddb978fa9e5c2b382172c35b2e9b8ecbfea0e70f53a69cdfe7816f3bcc42cacecbaa00387b3481427e597d0eb340bc7
@@ -9,25 +9,25 @@ module WizRtf
9
9
  #
10
10
  # Creates a new Rtf document specifing the format of the pages.
11
11
  # == Example:
12
- # ```ruby
13
- # doc = WizRtf::Document.new do
14
- # text "A Example of Rtf Document", 'text-align' => :center, 'font-family' => 'Microsoft YaHei', 'font-size' => 48, 'font-bold' => true, 'font-italic' => true, 'font-underline' => true
15
- # image('h:\eahey.png')
16
- # page_break
17
- # text "A Table Demo", 'foreground-color' => WizRtf::Color::RED, 'background-color' => '#0f00ff'
18
- # table [[{content: WizRtf::Image.new('h:\eahey.png'),rowspan:4},{content:'4',rowspan:4},1,{content:'1',colspan:2}],
19
- # [{content:'4',rowspan:3,colspan:2},8],[11]], column_widths:{1=>100,2 => 100,3 => 50,4 => 50,5 => 50} do
20
- # add_row [1]
12
+ #
13
+ # doc = WizRtf::Document.new do
14
+ # text "A Example of Rtf Document", 'text-align' => :center, 'font-family' => 'Microsoft YaHei', 'font-size' => 48, 'font-bold' => true, 'font-italic' => true, 'font-underline' => true
15
+ # image('h:\eahey.png')
16
+ # page_break
17
+ # text "A Table Demo", 'foreground-color' => WizRtf::Color::RED, 'background-color' => '#0f00ff'
18
+ # table [[{content: WizRtf::Image.new('h:\eahey.png'),rowspan:4},{content:'4',rowspan:4},1,{content:'1',colspan:2}],
19
+ # [{content:'4',rowspan:3,colspan:2},8],[11]], column_widths:{1=>100,2 => 100,3 => 50,4 => 50,5 => 50} do
20
+ # add_row [1]
21
+ # end
21
22
  # end
22
- # end
23
- # doc.save('c:\text.rtf')
24
- # ```
23
+ # doc.save('c:\text.rtf')
24
+ #
25
25
  class Document
26
26
  def initialize(options = {}, &block)
27
27
  @fonts = []
28
28
  @colors = []
29
29
  @parts = []
30
- font 'Courier New'
30
+ font 'NSimSun'
31
31
  block.arity<1 ? self.instance_eval(&block) : block.call(self) if block_given?
32
32
  end
33
33
 
@@ -111,18 +111,20 @@ module WizRtf
111
111
  # current drawing position.
112
112
  # == Styles:
113
113
  # * +text-align+ - sets the horizontal alignment of the text. optional values: +:left+, +:center+, +:right+
114
- # * +font-family+ - set the font family of the text. optional values: 'Arial', 'Arial Black', 'Arial Narrow','Bitstream Vera Sans Mono',
115
- # 'Bitstream Vera Sans','Bitstream Vera Serif','Book Antiqua','Bookman Old Style','Castellar','Century Gothic',
116
- # 'Comic Sans MS','Courier New','Franklin Gothic Medium','Garamond','Georgia','Haettenschweiler','Impact','Lucida Console'
117
- # 'Lucida Sans Unicode','Microsoft Sans Serif','Monotype Corsiva','Palatino Linotype','Papyrus','Sylfaen','Symbol'
118
- # 'Tahoma','Times New Roman','Trebuchet MS','Verdana'.
114
+ # * +font-family+ - set the font family of the text.
115
+ # - optional values:
116
+ # 'Arial', 'Arial Black', 'Arial Narrow','Bitstream Vera Sans Mono',
117
+ # 'Bitstream Vera Sans','Bitstream Vera Serif','Book Antiqua','Bookman Old Style','Castellar','Century Gothic',
118
+ # 'Comic Sans MS','Courier New','Franklin Gothic Medium','Garamond','Georgia','Haettenschweiler','Impact','Lucida Console'
119
+ # 'Lucida Sans Unicode','Microsoft Sans Serif','Monotype Corsiva','Palatino Linotype','Papyrus','Sylfaen','Symbol'
120
+ # 'Tahoma','Times New Roman','Trebuchet MS','Verdana'.
119
121
  # * +font-size+ - set font size of the text.
120
122
  # * +font-bold+ - setting the value true for bold of the text.
121
123
  # * +font-italic+ - setting the value true for italic of the text.
122
124
  # * +font-underline+ - setting the value true for underline of the text.
123
125
  # == Example:
124
126
  #
125
- # text "A Example of Rtf Document", 'text-align' => :center, 'font-family' => 'Microsoft YaHei', 'font-size' => 48, 'font-bold' => true, 'font-italic' => true, 'font-underline' => true
127
+ # text "A Example of Rtf Document", 'text-align' => :center, 'font-family' => 'Microsoft YaHei', 'font-size' => 48, 'font-bold' => true, 'font-italic' => true, 'font-underline' => true
126
128
  #
127
129
  def text(str, styles = {})
128
130
  styles['foreground-color'] = color(styles['foreground-color']) if styles['foreground-color']
@@ -142,14 +144,14 @@ module WizRtf
142
144
  # == Options:
143
145
  # * +column_widths+ - sets the widths of the Columns.
144
146
  # == Example:
145
- # ```ruby
146
- # table [
147
- # [{content: WizRtf::Image.new('h:\eahey.png'),rowspan:4},{content:'4',rowspan:4},1,{content:'1',colspan:2}],
148
- # [{content:'4',rowspan:3,colspan:2},8],[11]
149
- # ], column_widths:{1=>100,2 => 100,3 => 50,4 => 50,5 => 50} do
150
- # add_row [1]
151
- # end
152
- # ```
147
+ #
148
+ # table [
149
+ # [{content: WizRtf::Image.new('h:\eahey.png'),rowspan:4},{content:'4',rowspan:4},1,{content:'1',colspan:2}],
150
+ # [{content:'4',rowspan:3,colspan:2},8],[11]
151
+ # ], column_widths:{1=>100,2 => 100,3 => 50,4 => 50,5 => 50} do
152
+ # add_row [1]
153
+ # end
154
+ #
153
155
  def table(rows = [],options = {}, &block)
154
156
  @parts << WizRtf::Table.new(rows, options, &block)
155
157
  end
@@ -46,34 +46,34 @@ module WizRtf
46
46
 
47
47
  FONTS = [
48
48
  {name:'Arial', family:'fswiss', character:0, pitch:2, panose:'020b0604020202020204'},
49
- {name:'Arial Black', family:'swiss', character:0, pitch:2, panose:'020b0a04020102020204'},
50
- {name:'Arial Narrow', family:'swiss', character:0, pitch:2, panose:'020b0506020202030204'},
51
- {name:'Bitstream Vera Sans Mono', family:'modern', character:0, pitch:1, panose:'020b0609030804020204'},
52
- {name:'Bitstream Vera Sans', family:'swiss', character:0, pitch:2, panose:'020b0603030804020204'},
53
- {name:'Bitstream Vera Serif', family:'roman', character:0, pitch:2, panose:'02060603050605020204'},
54
- {name:'Book Antiqua', family:'roman', character:0, pitch:2, panose:'02040602050305030304'},
55
- {name:'Bookman Old Style', family:'roman', character:0, pitch:2, panose:'02050604050505020204'},
56
- {name:'Castellar', family:'roman', character:0, pitch:2, panose:'020a0402060406010301'},
57
- {name:'Century Gothic', family:'swiss', character:0, pitch:2, panose:'020b0502020202020204'},
58
- {name:'Comic Sans MS', family:'script', charater:0, pitch:2, panose:'030f0702030302020204'},
49
+ {name:'Arial Black', family:'fswiss', character:0, pitch:2, panose:'020b0a04020102020204'},
50
+ {name:'Arial Narrow', family:'fswiss', character:0, pitch:2, panose:'020b0506020202030204'},
51
+ {name:'Bitstream Vera Sans Mono', family:'fmodern', character:0, pitch:1, panose:'020b0609030804020204'},
52
+ {name:'Bitstream Vera Sans', family:'fswiss', character:0, pitch:2, panose:'020b0603030804020204'},
53
+ {name:'Bitstream Vera Serif', family:'froman', character:0, pitch:2, panose:'02060603050605020204'},
54
+ {name:'Book Antiqua', family:'froman', character:0, pitch:2, panose:'02040602050305030304'},
55
+ {name:'Bookman Old Style', family:'froman', character:0, pitch:2, panose:'02050604050505020204'},
56
+ {name:'Castellar', family:'froman', character:0, pitch:2, panose:'020a0402060406010301'},
57
+ {name:'Century Gothic', family:'fswiss', character:0, pitch:2, panose:'020b0502020202020204'},
58
+ {name:'Comic Sans MS', family:'fscript', charater:0, pitch:2, panose:'030f0702030302020204'},
59
59
  {name:'Courier New', family:'froman', character:0, pitch:1, panose:'02070309020205020404'},
60
- {name:'Franklin Gothic Medium', family:'swiss', character:0, picth:2, panose:'020b0603020102020204'},
61
- {name:'Garamond', family:'roman' , character:0, pitch:2, panose:'02020404030301010803'},
62
- {name:'Georgia', family:'roman', character:0, pitch:2, panose:'02040502050405020303'},
63
- {name:'Haettenschweiler', family:'swiss', character:0, pitch:2, panose:'020b0706040902060204'},
64
- {name:'Impact', family:'swiss', character:0, pitch:2, panose:'020b0806030902050204'},
65
- {name:'Lucida Console', family:'modern', character:0, pitch:1, panose:'020b0609040504020204'},
66
- {name:'Lucida Sans Unicode', family:'swiss' , character:0, pitch:2, panose:'020b0602030504020204'},
67
- {name:'Microsoft Sans Serif', family:'swiss', character:0, pitch:2, panose:'020b0604020202020204'},
68
- {name:'Monotype Corsiva', family:'script', character:0, pitch:2, panose:'03010101010201010101'},
69
- {name:'Palatino Linotype', family:'roman', character:0, pitch:2, panose:'02040502050505030304'},
70
- {name:'Papyrus', family:'script', character:0, pitch:2, panose:'03070502060502030205'},
71
- {name:'Sylfaen', family:'roman', character:0, pitch:2, panose:'010a0502050306030303'},
72
- {name:'Symbol', family:'roman', character:2, pitch:2, panose:'05050102010706020507'},
73
- {name:'Tahoma', family:'swiss', character:0, pitch:2, panose:'020b0604030504040204'},
60
+ {name:'Franklin Gothic Medium', family:'fswiss', character:0, picth:2, panose:'020b0603020102020204'},
61
+ {name:'Garamond', family:'froman' , character:0, pitch:2, panose:'02020404030301010803'},
62
+ {name:'Georgia', family:'froman', character:0, pitch:2, panose:'02040502050405020303'},
63
+ {name:'Haettenschweiler', family:'fswiss', character:0, pitch:2, panose:'020b0706040902060204'},
64
+ {name:'Impact', family:'fswiss', character:0, pitch:2, panose:'020b0806030902050204'},
65
+ {name:'Lucida Console', family:'fmodern', character:0, pitch:1, panose:'020b0609040504020204'},
66
+ {name:'Lucida Sans Unicode', family:'fswiss' , character:0, pitch:2, panose:'020b0602030504020204'},
67
+ {name:'Microsoft Sans Serif', family:'fswiss', character:0, pitch:2, panose:'020b0604020202020204'},
68
+ {name:'Monotype Corsiva', family:'fscript', character:0, pitch:2, panose:'03010101010201010101'},
69
+ {name:'Palatino Linotype', family:'froman', character:0, pitch:2, panose:'02040502050505030304'},
70
+ {name:'Papyrus', family:'fscript', character:0, pitch:2, panose:'03070502060502030205'},
71
+ {name:'Sylfaen', family:'froman', character:0, pitch:2, panose:'010a0502050306030303'},
72
+ {name:'Symbol', family:'froman', character:2, pitch:2, panose:'05050102010706020507'},
73
+ {name:'Tahoma', family:'fswiss', character:0, pitch:2, panose:'020b0604030504040204'},
74
74
  {name:'Times New Roman', family:'froman', character:0, pitch:2, panose:'02020603050405020304'},
75
- {name:'Trebuchet MS', family:'swiss', character:0, pitch:2, panose:'020b0603020202020204'},
76
- {name:'Verdana', family:'swiss', character:0, pitch:2, panose:'020b0604030504040204'},
75
+ {name:'Trebuchet MS', family:'fswiss', character:0, pitch:2, panose:'020b0603020202020204'},
76
+ {name:'Verdana', family:'fswiss', character:0, pitch:2, panose:'020b0604030504040204'},
77
77
  {name:'SimSun', family:'fnil', character:134, pitch:2},
78
78
  {name:'KaiTi', family:'fmodern', character:134, pitch:1},
79
79
  {name:'FangSong', family:'fnil', character:134, pitch:1},
@@ -28,7 +28,7 @@ module WizRtf
28
28
  #
29
29
  def initialize(str = '', styles = {})
30
30
  @str = str
31
- @styles = {'text-align' => :left, 'font-family' => 0, 'font-size' => 24, 'font-bold' => false, 'font-italic' => false, 'font-underline' => false, 'foreground-color' => 0, 'background-color' => 0 }.merge(styles)
31
+ @styles = {'text-align' => :left, 'font-family' => 0, 'font-size' => 12, 'font-bold' => false, 'font-italic' => false, 'font-underline' => false, 'foreground-color' => 0, 'background-color' => 0 }.merge(styles)
32
32
  end
33
33
 
34
34
  # Outputs the Partial Rtf Document to a Generic Stream as a Rich Text Format (RTF).
@@ -38,7 +38,7 @@ module WizRtf
38
38
  io.cmd :pard
39
39
  io.cmd TEXT_ALIGN_MAP[@styles['text-align']]
40
40
  io.cmd :f, @styles['font-family']
41
- io.cmd :fs, @styles['font-size']
41
+ io.cmd :fs, @styles['font-size'] * 2
42
42
  io.cmd @styles['font-bold'] ? 'b' : 'b0'
43
43
  io.cmd @styles['font-italic'] ? 'i' : 'i0'
44
44
  io.cmd @styles['font-underline'] ? 'ul' : 'ulnone'
@@ -1,3 +1,3 @@
1
1
  module WizRtf
2
- VERSION = "0.6.8"
2
+ VERSION = "0.6.9"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wiz_rtf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.8
4
+ version: 0.6.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - songgz