# File lib/rabbit/element/text-renderer.rb, line 23 def align=(new_value) if new_value.is_a?(String) new_value = Pango::Layout.const_get("ALIGN_#{new_value.to_s.upcase}") end dirty! if @align != new_value @align = new_value end
# File lib/rabbit/element/text-renderer.rb, line 162 def as_large_as_possible(proc_name=nil, &compute_max_size) proc_name ||= "as-large-as-possible" make_params = Proc.new do |canvas, x, y, w, h, initial_width, initial_height, max_width, max_height| if (max_width and initial_width > max_width) or (max_height and initial_height > max_height) scale = 0.95 compare = Proc.new do |_width, _height| (max_width.nil? or _width < max_width) and (max_height.nil? or _height < max_height) end else scale = 1.05 compare = Proc.new do |_width, _height| (max_width and _width > max_width) or (max_height and _height > max_height) end end [scale, compare] end dynamic_font_size_computation(proc_name, compute_max_size, &make_params) end
# File lib/rabbit/element/text-renderer.rb, line 92 def clear_theme super text_clear_theme end
# File lib/rabbit/element/text-renderer.rb, line 58 def compile(canvas, x, y, w, h) super text_compile(canvas, x, y, w, h) end
# File lib/rabbit/element/text-renderer.rb, line 106 def dirty! super @layout = nil end
# File lib/rabbit/element/text-renderer.rb, line 111 def dirty? super or text_dirty? end
# File lib/rabbit/element/text-renderer.rb, line 80 def do_horizontal_centering(canvas, x, y, w, h) self.align = Pango::Layout::ALIGN_CENTER end
# File lib/rabbit/element/text-renderer.rb, line 76 def do_horizontal_centering? @horizontal_centering end
# File lib/rabbit/element/text-renderer.rb, line 127 def font_size text_props["size"] end
# File lib/rabbit/element/text-renderer.rb, line 140 def have_numerical_font_size? font_size.is_a?(Numeric) end
# File lib/rabbit/element/text-renderer.rb, line 50 def height if @height @height + @padding_top + @padding_bottom else nil end end
# File lib/rabbit/element/text-renderer.rb, line 31 def justify=(new_value) new_value = true if new_value dirty! if @justify != new_value @justify = new_value end
# File lib/rabbit/element/text-renderer.rb, line 144 def keep_in_size(proc_name=nil, &compute_max_size) proc_name ||= "keep-in-size" make_params = Proc.new do |canvas, x, y, w, h, initial_width, initial_height, max_width, max_height| if (max_width and initial_width > max_width) or (max_height and initial_height > max_height) scale = 0.95 compare = Proc.new do |_width, _height| (max_width.nil? or _width < max_width) and (max_height.nil? or _height < max_height) end [scale, compare] end end dynamic_font_size_computation(proc_name, compute_max_size, &make_params) end
# File lib/rabbit/element/text-renderer.rb, line 88 def markuped_text markup(text) end
# File lib/rabbit/element/text-renderer.rb, line 131 def pixel_font_size _font_size = font_size if _font_size _font_size / Pango::SCALE else original_height end end
# File lib/rabbit/element/text-renderer.rb, line 84 def reset_horizontal_centering(canvas, x, y, w, h) self.align = default_align if @align == Pango::Layout::ALIGN_CENTER end
# File lib/rabbit/element/text-renderer.rb, line 37 def spacing=(new_spacing) dirty! if @spacing != new_spacing @spacing = new_spacing end
# File lib/rabbit/element/text-renderer.rb, line 97 def text_clear_theme @layout = nil @indent = 0 @spacing = 0 @wrap_mode = default_wrap_mode @align = default_align @justify = default_justify end
# File lib/rabbit/element/text-renderer.rb, line 63 def text_compile(canvas, x, y, w, h) if (@width and @width > @w) or (@height and @height > @h) dirty! end if_dirty do setup_draw_info(markuped_text, canvas, w) end end
# File lib/rabbit/element/text-renderer.rb, line 115 def text_dirty? @layout.nil? end
# File lib/rabbit/element/text-renderer.rb, line 119 def text_props props = {} @prop.each do |name, formatter| props[name] = formatter.value end props end
# File lib/rabbit/element/text-renderer.rb, line 19 def text_renderer? true end
# File lib/rabbit/element/text-renderer.rb, line 333 def compute_next_font_size(previous_size, scale) if previous_size (previous_size * scale).ceil else nil end end
Generated with the Darkfish Rdoc Generator 2.