File: paymentfont.rb

package info (click to toggle)
ruby-prawn-icon 3.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 3,228 kB
  • sloc: ruby: 1,370; makefile: 5
file content (36 lines) | stat: -rw-r--r-- 851 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# All example code may be executed by calling `rake legend`

require_relative '../lib/prawn/icon'
require_relative 'example_helper'

Prawn::Document.generate('paymentfont.pdf') do
  deja_path = Prawn::Icon.configuration.font_directory
    .join('DejaVuSans.ttf')
    .to_s

  font_families.update({
    'deja' => { normal: deja_path }
  })

  font('deja')

  icons = icon_keys(self, 'pf')
  required_pages = number_of_pages(self, 'pf')

  define_grid(columns: 6, rows: 12, gutter: 16)

  sub_header = 'PaymentFont'
  link = 'https://paymentfont.com'
  page_header sub_header, link

  first_page_icons icons do |icon_key|
    # Just call the +icon+ method and pass in an icon key
    icon icon_key, size: 20, align: :center
  end

  start_new_page

  page_icons icons, required_pages do |icon_key|
    icon icon_key, size: 20, align: :center
  end
end