thinreports 0.8.2 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (170) hide show
  1. checksums.yaml +4 -4
  2. data/.github/CONTRIBUTING.md +2 -0
  3. data/.travis.yml +3 -3
  4. data/CHANGELOG.md +98 -1
  5. data/README.md +0 -9
  6. data/Rakefile +1 -2
  7. data/examples/character_spacing/character_spacing.tlf +293 -1
  8. data/examples/dynamic_image/dynamic_image.tlf +661 -1
  9. data/examples/dynamic_style/dynamic_style.rb +4 -4
  10. data/examples/dynamic_style/dynamic_style.tlf +1835 -1
  11. data/examples/dynamic_style/dynamic_style_in_list.tlf +344 -1
  12. data/examples/eudc/eudc.tlf +180 -1
  13. data/examples/hidden_shapes/hidden_shapes.tlf +449 -1
  14. data/examples/list_events/list_events.rb +1 -28
  15. data/examples/list_events/list_events.tlf +361 -0
  16. data/examples/list_manual_generation/list_manual_generation.tlf +132 -1
  17. data/examples/list_page_number/list_page_number.tlf +254 -1
  18. data/examples/page_number/page_number.tlf +215 -1
  19. data/examples/palleted_png/palleted_png.rb +2 -0
  20. data/examples/palleted_png/palleted_png.tlf +47 -1
  21. data/examples/password_setting/password_setting.tlf +45 -1
  22. data/examples/report_callbacks/report_callbacks.rb +1 -18
  23. data/examples/report_callbacks/report_callbacks.tlf +147 -1
  24. data/examples/single_line_tblock/single_line_tblock.tlf +170 -1
  25. data/examples/tblock_overflow/tblock_overflow.tlf +538 -1
  26. data/examples/tblock_styles/font_size.tlf +383 -1
  27. data/examples/tblock_styles/tblock_styles.tlf +889 -1
  28. data/examples/text_align/text_align.tlf +241 -1
  29. data/examples/typeB_page_size/B4_ISO.tlf +45 -1
  30. data/examples/typeB_page_size/B4_JIS.tlf +45 -1
  31. data/examples/word_wrap/word_wrap.tlf +297 -1
  32. data/lib/thinreports.rb +0 -1
  33. data/lib/thinreports/config.rb +3 -0
  34. data/lib/thinreports/core/errors.rb +0 -3
  35. data/lib/thinreports/core/format/base.rb +4 -4
  36. data/lib/thinreports/core/shape.rb +1 -9
  37. data/lib/thinreports/core/shape/basic.rb +3 -3
  38. data/lib/thinreports/core/shape/basic/block_format.rb +1 -1
  39. data/lib/thinreports/core/shape/basic/format.rb +2 -14
  40. data/lib/thinreports/core/shape/basic/internal.rb +2 -2
  41. data/lib/thinreports/core/shape/image_block.rb +3 -3
  42. data/lib/thinreports/core/shape/image_block/format.rb +0 -2
  43. data/lib/thinreports/core/shape/image_block/internal.rb +1 -1
  44. data/lib/thinreports/core/shape/list.rb +3 -7
  45. data/lib/thinreports/core/shape/list/format.rb +37 -24
  46. data/lib/thinreports/core/shape/list/manager.rb +1 -36
  47. data/lib/thinreports/core/shape/list/page.rb +0 -15
  48. data/lib/thinreports/core/shape/list/page_state.rb +1 -1
  49. data/lib/thinreports/core/shape/list/section_format.rb +14 -12
  50. data/lib/thinreports/core/shape/list/section_internal.rb +4 -7
  51. data/lib/thinreports/core/shape/manager/format.rb +0 -2
  52. data/lib/thinreports/core/shape/manager/internal.rb +1 -1
  53. data/lib/thinreports/core/shape/page_number.rb +1 -1
  54. data/lib/thinreports/core/shape/page_number/format.rb +9 -6
  55. data/lib/thinreports/core/shape/page_number/interface.rb +1 -1
  56. data/lib/thinreports/core/shape/page_number/internal.rb +2 -6
  57. data/lib/thinreports/core/shape/style/base.rb +11 -13
  58. data/lib/thinreports/core/shape/style/basic.rb +4 -4
  59. data/lib/thinreports/core/shape/style/graphic.rb +4 -10
  60. data/lib/thinreports/core/shape/style/text.rb +36 -69
  61. data/lib/thinreports/core/shape/text.rb +3 -3
  62. data/lib/thinreports/core/shape/text/format.rb +3 -13
  63. data/lib/thinreports/core/shape/text/internal.rb +2 -2
  64. data/lib/thinreports/core/shape/text_block.rb +3 -3
  65. data/lib/thinreports/core/shape/text_block/format.rb +9 -6
  66. data/lib/thinreports/core/shape/text_block/interface.rb +7 -7
  67. data/lib/thinreports/core/shape/text_block/internal.rb +1 -1
  68. data/lib/thinreports/generator/pdf.rb +0 -1
  69. data/lib/thinreports/generator/pdf/document.rb +2 -2
  70. data/lib/thinreports/generator/pdf/document/draw_shape.rb +25 -51
  71. data/lib/thinreports/generator/pdf/document/draw_template_items.rb +66 -0
  72. data/lib/thinreports/generator/pdf/document/font.rb +3 -8
  73. data/lib/thinreports/generator/pdf/document/graphics/attributes.rb +97 -77
  74. data/lib/thinreports/generator/pdf/document/graphics/basic.rb +18 -13
  75. data/lib/thinreports/generator/pdf/document/graphics/image.rb +17 -12
  76. data/lib/thinreports/generator/pdf/document/page.rb +1 -1
  77. data/lib/thinreports/generator/pdf/drawer/list.rb +5 -1
  78. data/lib/thinreports/generator/pdf/drawer/list_section.rb +1 -4
  79. data/lib/thinreports/generator/pdf/drawer/page.rb +9 -9
  80. data/lib/thinreports/layout.rb +3 -3
  81. data/lib/thinreports/layout/base.rb +0 -16
  82. data/lib/thinreports/layout/format.rb +38 -57
  83. data/lib/thinreports/layout/legacy_schema.rb +354 -0
  84. data/lib/thinreports/layout/version.rb +1 -1
  85. data/lib/thinreports/report.rb +0 -1
  86. data/lib/thinreports/report/base.rb +3 -17
  87. data/lib/thinreports/report/internal.rb +13 -55
  88. data/lib/thinreports/report/page.rb +1 -1
  89. data/lib/thinreports/version.rb +1 -1
  90. data/test/data/legacy_layout/all-items.tlf +1 -0
  91. data/test/schema_helper.rb +121 -0
  92. data/test/test_helper.rb +13 -50
  93. data/test/unit/core/format/test_base.rb +35 -31
  94. data/test/unit/core/shape/base/test_internal.rb +1 -1
  95. data/test/unit/core/shape/basic/test_block_format.rb +23 -0
  96. data/test/unit/core/shape/basic/{test_basic_interface.rb → test_block_interface.rb} +1 -1
  97. data/test/unit/core/shape/basic/{test_basic_internal.rb → test_block_internal.rb} +4 -7
  98. data/test/unit/core/shape/basic/test_format.rb +25 -47
  99. data/test/unit/core/shape/basic/test_interface.rb +5 -5
  100. data/test/unit/core/shape/basic/test_internal.rb +6 -11
  101. data/test/unit/core/shape/image_block/test_interface.rb +5 -5
  102. data/test/unit/core/shape/image_block/test_internal.rb +2 -2
  103. data/test/unit/core/shape/list/test_format.rb +86 -44
  104. data/test/unit/core/shape/list/test_manager.rb +10 -65
  105. data/test/unit/core/shape/list/test_page.rb +10 -61
  106. data/test/unit/core/shape/list/test_page_state.rb +1 -1
  107. data/test/unit/core/shape/list/test_section_format.rb +19 -28
  108. data/test/unit/core/shape/list/test_section_interface.rb +14 -6
  109. data/test/unit/core/shape/list/test_section_internal.rb +17 -23
  110. data/test/unit/core/shape/manager/test_format.rb +1 -1
  111. data/test/unit/core/shape/manager/test_internal.rb +59 -98
  112. data/test/unit/core/shape/manager/test_target.rb +21 -30
  113. data/test/unit/core/shape/page_number/test_format.rb +34 -52
  114. data/test/unit/core/shape/page_number/test_interface.rb +1 -1
  115. data/test/unit/core/shape/page_number/test_internal.rb +2 -2
  116. data/test/unit/core/shape/styles/test_base.rb +16 -41
  117. data/test/unit/core/shape/styles/test_basic.rb +7 -7
  118. data/test/unit/core/shape/styles/test_graphic.rb +27 -32
  119. data/test/unit/core/shape/styles/test_text.rb +68 -311
  120. data/test/unit/core/shape/text/test_format.rb +30 -59
  121. data/test/unit/core/shape/text/test_internal.rb +5 -5
  122. data/test/unit/core/shape/text_block/formatter/test_datetime.rb +13 -13
  123. data/test/unit/core/shape/text_block/test_format.rb +145 -146
  124. data/test/unit/core/shape/text_block/test_interface.rb +9 -9
  125. data/test/unit/core/shape/text_block/test_internal.rb +9 -9
  126. data/test/unit/core/test_shape.rb +19 -31
  127. data/test/unit/generator/pdf/document/graphics/test_attributes.rb +112 -122
  128. data/test/unit/generator/pdf/document/graphics/test_basic.rb +45 -0
  129. data/test/unit/generator/pdf/document/graphics/test_image.rb +5 -5
  130. data/test/unit/generator/pdf/document/test_font.rb +4 -10
  131. data/test/unit/generator/pdf/document/test_page.rb +13 -11
  132. data/test/unit/generator/pdf/document/test_parse_color.rb +5 -5
  133. data/test/unit/generator/test_base.rb +5 -5
  134. data/test/unit/generator/test_configuration.rb +4 -8
  135. data/test/unit/generator/test_pdf.rb +3 -2
  136. data/test/unit/layout/test_base.rb +16 -22
  137. data/test/unit/layout/test_format.rb +66 -86
  138. data/test/unit/layout/test_legacy_schema.rb +587 -0
  139. data/test/unit/layout/test_version.rb +20 -20
  140. data/test/unit/report/test_base.rb +32 -45
  141. data/test/unit/report/test_internal.rb +43 -99
  142. data/test/unit/test_config.rb +4 -2
  143. data/test/unit/test_layout.rb +1 -1
  144. metadata +20 -48
  145. data/examples/list_events/list_events_0_7_7.tlf +0 -1
  146. data/examples/list_events/list_events_0_8.tlf +0 -1
  147. data/lib/thinreports/core/events.rb +0 -69
  148. data/lib/thinreports/core/format/builder.rb +0 -62
  149. data/lib/thinreports/core/shape/list/configuration.rb +0 -54
  150. data/lib/thinreports/core/shape/list/events.rb +0 -47
  151. data/lib/thinreports/core/shape/list/store.rb +0 -33
  152. data/lib/thinreports/generator/pdf/configuration.rb +0 -33
  153. data/lib/thinreports/generator/pdf/document/parse_svg.rb +0 -104
  154. data/lib/thinreports/layout/configuration.rb +0 -29
  155. data/test/data/layout_block.tlf +0 -1
  156. data/test/data/layout_list.tlf +0 -1
  157. data/test/data/layout_list_noheader.tlf +0 -1
  158. data/test/data/layout_text1.tlf +0 -1
  159. data/test/data/layout_text2.tlf +0 -1
  160. data/test/unit/core/format/test_builder.rb +0 -109
  161. data/test/unit/core/shape/basic/test_basic_format.rb +0 -30
  162. data/test/unit/core/shape/image_block/test_format.rb +0 -58
  163. data/test/unit/core/shape/list/test_configuration.rb +0 -69
  164. data/test/unit/core/shape/list/test_events.rb +0 -36
  165. data/test/unit/core/shape/list/test_store.rb +0 -41
  166. data/test/unit/core/test_events.rb +0 -93
  167. data/test/unit/generator/pdf/document/test_draw_shape.rb +0 -44
  168. data/test/unit/generator/pdf/test_configuration.rb +0 -31
  169. data/test/unit/layout/test_configuration.rb +0 -21
  170. data/test/unit/report/test_events.rb +0 -22
@@ -5,9 +5,7 @@ module Thinreports
5
5
 
6
6
  class List::SectionInternal < Base::Internal
7
7
  format_delegators :height,
8
- :relative_left,
9
- :relative_top,
10
- :svg_tag
8
+ :relative_left
11
9
 
12
10
  # @return [Symbol]
13
11
  attr_accessor :section_name
@@ -21,10 +19,9 @@ module Thinreports
21
19
  states[:relative_top] = ry
22
20
  end
23
21
 
24
- # @return [Array<Numeric>]
25
- def relative_position
26
- [relative_left,
27
- relative_top + (states[:relative_top] || 0)]
22
+ # @return [Float]
23
+ def relative_top
24
+ states[:relative_top] || 0
28
25
  end
29
26
  end
30
27
 
@@ -7,8 +7,6 @@ module Thinreports
7
7
  # @return [Symbol, Integer]
8
8
  attr_reader :identifier
9
9
 
10
- config_reader layout: %w( svg )
11
-
12
10
  def initialize(config, id = nil, &block)
13
11
  super(config, &block)
14
12
  @identifier = id || self.object_id
@@ -57,7 +57,7 @@ module Thinreports
57
57
  shape
58
58
  end
59
59
  # When shape was not found in registry.
60
- elsif format.has_shape?(id)
60
+ elsif format.has_shape?(id)
61
61
  shape_format = find_format(id)
62
62
  return nil unless shape_format.display?
63
63
 
@@ -4,7 +4,7 @@ module Thinreports
4
4
  module Core::Shape
5
5
 
6
6
  module PageNumber
7
- TYPE_NAME = 's-pageno'
7
+ TYPE_NAME = 'page-number'
8
8
  end
9
9
 
10
10
  end
@@ -4,15 +4,18 @@ module Thinreports
4
4
  module Core::Shape
5
5
 
6
6
  class PageNumber::Format < Basic::Format
7
- config_reader :overflow, :target, :box
7
+ config_reader :target
8
8
  config_reader default_format: %w( format )
9
9
 
10
+ # For saving compatible 0.8.x format API
11
+ config_reader overflow: %w( style overflow )
12
+
10
13
  def id
11
- unless @id
12
- @id = read('id')
13
- @id = self.class.next_default_id if blank_value?(@id)
14
- end
15
- @id
14
+ @id ||= blank_value?(read('id')) ? self.class.next_default_id : read('id')
15
+ end
16
+
17
+ def for_report?
18
+ blank_value?(target)
16
19
  end
17
20
 
18
21
  def self.next_default_id
@@ -16,7 +16,7 @@ module Thinreports
16
16
  end
17
17
 
18
18
  private
19
-
19
+
20
20
  # @see Thinreports::Core::Shape::Base::Interface#init_internal
21
21
  def init_internal(parent, format)
22
22
  PageNumber::Internal.new(parent, format)
@@ -4,7 +4,7 @@ module Thinreports
4
4
  module Core::Shape
5
5
 
6
6
  class PageNumber::Internal < Basic::Internal
7
- format_delegators :box
7
+ format_delegators :box, :for_report?
8
8
 
9
9
  def read_format
10
10
  states.key?(:format) ? states[:format] : format.default_format.dup
@@ -36,12 +36,8 @@ module Thinreports
36
36
  @style ||= PageNumber::Style.new(format)
37
37
  end
38
38
 
39
- def for_report?
40
- blank_value?(format.target)
41
- end
42
-
43
39
  def type_of?(type_name)
44
- type_name == :pageno
40
+ type_name == PageNumber::TYPE_NAME
45
41
  end
46
42
 
47
43
  def start_page_number
@@ -54,10 +54,9 @@ module Thinreports
54
54
  def initialize(format, default_styles = {})
55
55
  @format = format
56
56
  @styles = default_styles
57
- @base_styles = format.svg_attrs || {}
57
+ @base_styles = format.style || {}
58
58
 
59
59
  @accessible_styles = self.class.accessible_styles.dup
60
- @finalized_svg_attributes = nil
61
60
  end
62
61
 
63
62
  # @param [Symbol] style_method
@@ -84,17 +83,6 @@ module Thinreports
84
83
  self.class.new(@format, @styles.empty? ? {} : deep_copy(@styles))
85
84
  end
86
85
 
87
- # @return [Hash]
88
- def finalized_svg_attributes
89
- @finalized_svg_attributes ||=
90
- if @styles.empty?
91
- @base_styles.dup
92
- else
93
- @base_styles.merge(@styles)
94
- end
95
- end
96
- alias_method :svg_attrs, :finalized_svg_attributes
97
-
98
86
  # @param [String, Symbol] style
99
87
  # @return [Object]
100
88
  def read_internal_style(style)
@@ -114,6 +102,16 @@ module Thinreports
114
102
  accessible_styles.include?(style_method)
115
103
  end
116
104
 
105
+ # @return [Hash]
106
+ def finalized_styles
107
+ @finalized_styles ||=
108
+ if @styles.empty?
109
+ @base_styles.dup
110
+ else
111
+ @base_styles.merge(@styles)
112
+ end
113
+ end
114
+
117
115
  private
118
116
 
119
117
  # @param [Hash] s
@@ -2,16 +2,16 @@
2
2
 
3
3
  module Thinreports
4
4
  module Core::Shape
5
-
5
+
6
6
  class Style::Basic < Style::Base
7
7
  style_accessible :visible
8
8
  attr_accessor :visible
9
-
9
+
10
10
  def initialize(*args)
11
11
  super
12
12
  @visible = @format.display?
13
13
  end
14
14
  end
15
-
15
+
16
16
  end
17
- end
17
+ end
@@ -10,23 +10,17 @@ module Thinreports
10
10
  # @return [String]
11
11
  # @method border_color=(color)
12
12
  # @param [String] color
13
- style_accessor :border_color, 'stroke'
13
+ style_accessor :border_color, 'border-color'
14
14
 
15
15
  # @method border_width
16
- # @return [String, Number]
17
- style_reader :border_width, 'stroke-width'
16
+ # @return [Number]
17
+ style_accessor :border_width, 'border-width'
18
18
 
19
19
  # @method fill_color
20
20
  # @return [String]
21
21
  # @method fill_color=(color)
22
22
  # @param [String] color
23
- style_accessor :fill_color, 'fill'
24
-
25
- # @param [String, Number] width
26
- def border_width=(width)
27
- write_internal_style('stroke-opacity', '1') unless width.to_i.zero?
28
- write_internal_style('stroke-width', width)
29
- end
23
+ style_accessor :fill_color, 'fill-color'
30
24
 
31
25
  # @return [Array<String, Number>]
32
26
  def border
@@ -4,10 +4,6 @@ module Thinreports
4
4
  module Core::Shape
5
5
 
6
6
  class Style::Text < Style::Basic
7
- TEXT_ALIGN_NAMES = {left: 'start',
8
- center: 'middle',
9
- right: 'end'}
10
-
11
7
  style_accessible :bold, :italic, :underline, :linethrough,
12
8
  :align, :valign, :color, :font_size
13
9
 
@@ -15,7 +11,7 @@ module Thinreports
15
11
  # @return [String]
16
12
  # @method color=(v)
17
13
  # @param [String] v
18
- style_accessor :color, 'fill'
14
+ style_accessor :color, 'color'
19
15
 
20
16
  # @method font_size
21
17
  # @return [Numeric, String]
@@ -23,123 +19,94 @@ module Thinreports
23
19
  # @param [Numeric, String]
24
20
  style_accessor :font_size, 'font-size'
25
21
 
26
- def initialize(*args)
22
+ def initialize(*)
27
23
  super
28
- @valign = default_valign
29
- end
30
-
31
- def copy
32
- new_style = super
33
- new_style.valign = self.valign
34
- new_style
35
- end
36
-
37
- def identifier
38
- super + (@valign == default_valign ? '' : @valign.to_s)
24
+ initialize_font_style
39
25
  end
40
26
 
41
27
  # @return [Boolean]
42
28
  def bold
43
- read_internal_style('font-weight') == 'bold'
29
+ read_internal_style('font-style').include?('bold')
44
30
  end
45
31
 
46
32
  # @param [Boolean] enable
47
33
  def bold=(enable)
48
- write_internal_style('font-weight', enable ? 'bold' : 'normal')
34
+ write_font_style('bold', enable)
49
35
  end
50
36
 
51
37
  # @return [Boolean]
52
38
  def italic
53
- read_internal_style('font-style') == 'italic'
39
+ read_internal_style('font-style').include?('italic')
54
40
  end
55
41
 
56
42
  # @param [Boolean] enable
57
43
  def italic=(enable)
58
- write_internal_style('font-style', enable ? 'italic' : 'normal')
44
+ write_font_style('italic', enable)
59
45
  end
60
46
 
61
47
  # @return [Boolean]
62
48
  def underline
63
- read_internal_style('text-decoration').include?('underline')
49
+ read_internal_style('font-style').include?('underline')
64
50
  end
65
51
 
66
52
  # @param [Boolean] enable
67
53
  def underline=(enable)
68
- text_decoration(enable, linethrough)
54
+ write_font_style('underline', enable)
69
55
  end
70
56
 
71
57
  # @return [Boolean]
72
58
  def linethrough
73
- read_internal_style('text-decoration').include?('line-through')
59
+ read_internal_style('font-style').include?('linethrough')
74
60
  end
75
61
 
76
62
  # @param [Boolean] enable
77
63
  def linethrough=(enable)
78
- text_decoration(underline, enable)
64
+ write_font_style('linethrough', enable)
79
65
  end
80
66
 
81
- # @return [Symbol]
67
+ # @return [:left, :center, :right]
82
68
  def align
83
- interface_text_align(read_internal_style('text-anchor'))
69
+ read_internal_style('text-align').to_sym
84
70
  end
85
71
 
86
72
  # @param [:left, :center, :right] align_name
87
73
  def align=(align_name)
88
- verify_style_value(align_name, TEXT_ALIGN_NAMES.keys,
74
+ verify_style_value(align_name, [:left, :center, :right],
89
75
  'Only :left or :center, :right can be specified as align.')
90
- write_internal_style('text-anchor', internal_text_align(align_name))
76
+ write_internal_style('text-align', align_name.to_s)
91
77
  end
92
78
 
93
- # @return [Symbol]
79
+ # @return [:top, :middle, :bottom]
94
80
  def valign
95
- @valign
81
+ vertical_align = read_internal_style('vertical-align')
82
+ blank_value?(vertical_align) ? :top : vertical_align.to_sym
96
83
  end
97
84
 
98
- # @param [:top, :center, :bottom] valign_name
85
+ # @param [:top, :center, :middle, :bottom] valign_name
99
86
  def valign=(valign_name)
100
- verify_style_value(valign_name, [:top, :center, :bottom],
101
- 'Only :top or :center, :bottom can be specified as valign.')
102
- @valign = valign_name
103
- end
104
-
105
- private
106
-
107
- # @return [Symbol, nil]
108
- def default_valign
109
- if accessible_styles.include?(:valign)
110
- blank_value?(@format.valign) ? :top : @format.valign.to_sym
111
- else
112
- :top
87
+ if valign_name == :center
88
+ warn '[DEPRECATION] :center value for valign style is deprecated and will be removed in thinreports-generator 1.0.' \
89
+ ' Please use :middle instead of :center.'
90
+ valign_name = :middle
113
91
  end
114
- end
115
92
 
116
- # @param [Symbol] align The interface align name.
117
- # @return [String, nil]
118
- def internal_text_align(align)
119
- TEXT_ALIGN_NAMES[align]
93
+ verify_style_value(valign_name, [:top, :middle, :bottom],
94
+ 'Only :top or :middle (:center), :bottom can be specified as valign.')
95
+ write_internal_style('vertical-align', valign_name.to_s)
120
96
  end
121
97
 
122
- # @param [String] align The internal align name.
123
- # @return [Symbol]
124
- def interface_text_align(align)
125
- TEXT_ALIGN_NAMES.invert[align] || :left
98
+ private
99
+
100
+ def initialize_font_style
101
+ styles['font-style'] ||= (@base_styles['font-style'] || []).dup
126
102
  end
127
103
 
128
- # @param [Boolean] u
129
- # @param [Boolean] s
130
- def text_decoration(u, s)
131
- deco =
132
- case
133
- when u && s
134
- 'underline line-through'
135
- when u && !s
136
- 'underline'
137
- when !u && s
138
- 'line-through'
139
- else
140
- 'none'
141
- end
142
- write_internal_style('text-decoration', deco)
104
+ def write_font_style(style_name, enable)
105
+ if enable
106
+ styles['font-style'].push(style_name).uniq!
107
+ else
108
+ styles['font-style'].delete(style_name)
109
+ end
143
110
  end
144
111
  end
145
112
 
@@ -2,11 +2,11 @@
2
2
 
3
3
  module Thinreports
4
4
  module Core::Shape
5
-
5
+
6
6
  module Text
7
- TYPE_NAME = 's-text'
7
+ TYPE_NAME = 'text'
8
8
  end
9
-
9
+
10
10
  end
11
11
  end
12
12
 
@@ -4,20 +4,10 @@ module Thinreports
4
4
  module Core::Shape
5
5
 
6
6
  class Text::Format < Basic::Format
7
- config_reader :text, :box, :valign
8
- config_reader svg_content: %w( svg content ),
9
- line_height: %w( line-height )
10
7
 
11
- class << self
12
- private
13
-
14
- # @see Thinreports::Core::Shape::Basic::Format#build_internal
15
- def build_internal(raw_format)
16
- new(raw_format) do |f|
17
- clean_with_attributes(f.svg_content)
18
- end
19
- end
20
- end
8
+ config_reader :texts
9
+ config_reader valign: %w( style vertical-align )
10
+ config_reader line_height: %w( style line-height )
21
11
  end
22
12
 
23
13
  end
@@ -5,14 +5,14 @@ module Thinreports
5
5
 
6
6
  class Text::Internal < Basic::Internal
7
7
  # Delegate to Format's methods
8
- format_delegators :svg_content, :text, :box
8
+ format_delegators :texts, :box
9
9
 
10
10
  def style
11
11
  @style ||= Style::Text.new(format)
12
12
  end
13
13
 
14
14
  def type_of?(type_name)
15
- type_name == :text
15
+ type_name == Text::TYPE_NAME
16
16
  end
17
17
  end
18
18