Sha256: 21db5556288c75b8cb3df75e654f8145bf4fe8ad004fac63a85ac1c3f1bf55b6

Contents?: true

Size: 947 Bytes

Versions: 19

Compression:

Stored size: 947 Bytes

Contents

proc_name = "slide-number"

@slide_number_props ||= {
  "size" => @xx_small_font_size,
  "font_family" => @font_family,
}

@slide_number_color || nil
@slide_number_position ||= :bottom

match(Slide) do |slides|
  slides.delete_post_draw_proc_by_name(proc_name)

  break if @slide_number_uninstall

  slides.add_post_draw_proc(proc_name) do |slide, canvas, x, y, w, h, simulation|
    unless simulation
      text = Text.new("#{slide.index}/#{canvas.slide_size - 1}")
      text.font @slide_number_props
      text.align = Pango::Layout::ALIGN_RIGHT
      text.compile(canvas, x, y, w, h)
      layout = text.layout
      layout.set_width(w * Pango::SCALE)
      case @slide_number_position
      when :bottom
        number_y = canvas.height - slide.margin_bottom - text.height
      when :top
        number_y = slide.margin_top
      end
      canvas.draw_layout(text.layout, x, number_y, @slide_number_color)
    end
    [x, y, w, h]
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
rabbit-2.2.0 lib/rabbit/theme/slide-number/slide-number.rb
rabbit-2.1.9 lib/rabbit/theme/slide-number/slide-number.rb
rabbit-2.1.8 lib/rabbit/theme/slide-number/slide-number.rb
rabbit-2.1.7 lib/rabbit/theme/slide-number/slide-number.rb
rabbit-2.1.6 lib/rabbit/theme/slide-number/slide-number.rb
rabbit-2.1.5 lib/rabbit/theme/slide-number/slide-number.rb
rabbit-2.1.4 lib/rabbit/theme/slide-number/slide-number.rb
rabbit-2.1.3 lib/rabbit/theme/slide-number/slide-number.rb
rabbit-2.1.2 lib/rabbit/theme/slide-number/slide-number.rb
rabbit-2.1.1 lib/rabbit/theme/slide-number/slide-number.rb
rabbit-2.1.0 lib/rabbit/theme/slide-number/slide-number.rb
rabbit-2.0.9 lib/rabbit/theme/slide-number/slide-number.rb
rabbit-2.0.8 lib/rabbit/theme/slide-number/slide-number.rb
rabbit-2.0.7 lib/rabbit/theme/slide-number/slide-number.rb
rabbit-2.0.6 lib/rabbit/theme/slide-number/slide-number.rb
rabbit-2.0.5 lib/rabbit/theme/slide-number/slide-number.rb
rabbit-2.0.4 lib/rabbit/theme/slide-number/slide-number.rb
rabbit-2.0.3 lib/rabbit/theme/slide-number/slide-number.rb
rabbit-2.0.2 lib/rabbit/theme/slide-number/slide-number.rb