Module: TankaRenderer::Renderer::Base
Instance Attribute Summary collapse
-
#body_color ⇒ Object
Returns the value of attribute body_color.
-
#font ⇒ Object
Returns the value of attribute font.
-
#height ⇒ Object
Returns the value of attribute height.
-
#text_color ⇒ Object
Returns the value of attribute text_color.
-
#vertical ⇒ Object
Returns the value of attribute vertical.
-
#width ⇒ Object
Returns the value of attribute width.
Instance Method Summary collapse
- #draw(context, text) ⇒ Object
- #guess_font(part_of_font_name) ⇒ Object
- #initialize ⇒ Object
- #render(text, output_path) ⇒ Object
Instance Attribute Details
#body_color ⇒ Object
Returns the value of attribute body_color.
9 10 11 |
# File 'lib/tanka_renderer/renderer/base.rb', line 9 def body_color @body_color end |
#font ⇒ Object
Returns the value of attribute font.
8 9 10 |
# File 'lib/tanka_renderer/renderer/base.rb', line 8 def font @font end |
#height ⇒ Object
Returns the value of attribute height.
8 9 10 |
# File 'lib/tanka_renderer/renderer/base.rb', line 8 def height @height end |
#text_color ⇒ Object
Returns the value of attribute text_color.
9 10 11 |
# File 'lib/tanka_renderer/renderer/base.rb', line 9 def text_color @text_color end |
#vertical ⇒ Object
Returns the value of attribute vertical.
10 11 12 |
# File 'lib/tanka_renderer/renderer/base.rb', line 10 def vertical @vertical end |
#width ⇒ Object
Returns the value of attribute width.
8 9 10 |
# File 'lib/tanka_renderer/renderer/base.rb', line 8 def width @width end |
Instance Method Details
#draw(context, text) ⇒ Object
28 29 30 31 |
# File 'lib/tanka_renderer/renderer/base.rb', line 28 def draw(context, text) draw_body(context) draw_text(context, text) end |
#guess_font(part_of_font_name) ⇒ Object
20 21 22 |
# File 'lib/tanka_renderer/renderer/base.rb', line 20 def guess_font(part_of_font_name) @font = Fontdock::Local.find(part_of_font_name) end |
#initialize ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/tanka_renderer/renderer/base.rb', line 11 def initialize @width = 300 @height = 500 @font = "IPAMincho" @body_color = :white @text_color = :black @vertical = true end |
#render(text, output_path) ⇒ Object
24 25 26 |
# File 'lib/tanka_renderer/renderer/base.rb', line 24 def render(text, output_path) @width, @height = @height, @width unless @vertical end |