Module: Booky::Layout::Base
- Defined in:
- lib/booky/layout/base.rb,
lib/booky/layout/base/p.rb,
lib/booky/layout/base/h0.rb,
lib/booky/layout/base/h1.rb,
lib/booky/layout/base/h2.rb,
lib/booky/layout/base/h3.rb,
lib/booky/layout/base/h4.rb,
lib/booky/layout/base/toc.rb,
lib/booky/layout/base/tof.rb,
lib/booky/layout/base/chart.rb,
lib/booky/layout/base/image.rb,
lib/booky/layout/base/table.rb,
lib/booky/layout/base/title.rb,
lib/booky/layout/base/author.rb,
lib/booky/layout/base/import.rb,
lib/booky/layout/base/outline.rb,
lib/booky/layout/base/footnote.rb,
lib/booky/layout/base/subtitle.rb,
lib/booky/layout/base/copyright.rb,
lib/booky/layout/base/blockquote.rb,
lib/booky/layout/base/charts/bar.rb,
lib/booky/layout/base/charts/base.rb,
lib/booky/layout/base/charts/line.rb,
lib/booky/layout/base/numbered_list.rb,
lib/booky/layout/base/unnumbered_list.rb,
lib/booky/layout/base/code.rb
Defined Under Namespace
Modules: Charts
Classes: Author, Blockquote, Chart, Code, Copyright, Footnote, H0, H1, H2, H3, H4, Image, Import, NumberedList, Outline, P, Subtitle, Table, Title, Toc, Tof, UnnumberedList
Constant Summary
collapse
- COLORS =
['000000', '646464', 'B6B6B6', 'ECECEC']
Class Method Summary
collapse
Class Method Details
.document(options = {}) ⇒ Object
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/booky/layout/base.rb', line 29
def self.document options = {}
options.merge!({
:page_size => "A4",
:margin => [3.cm, 3.cm, 3.cm, 3.cm,]
})
Prawn::Document.new options do |document|
document.font_families.update(
"Ubuntu" => {
:normal => "#{Booky.root}/lib/fonts/Ubuntu-R.ttf",
:bold => "#{Booky.root}/lib/fonts/Ubuntu-B.ttf",
:italic => "#{Booky.root}/lib/fonts/Ubuntu-L.ttf",
:italic_light => "#{Booky.root}/lib/fonts/Ubuntu-LI.ttf"
},
"Monaco" => {
:normal => "#{Booky.root}/lib/fonts/Monaco.ttf"
})
document.font "Ubuntu"
document.font_size 12
document.default_leading 3
yield(document)
end
end
|
.numbering_options(document) ⇒ Object
56
57
58
59
60
61
62
63
64
65
66
|
# File 'lib/booky/layout/base.rb', line 56
def self.numbering_options document
document.number_pages "<page> of <total>", {
:start_count_at => Booky::Layout.config.has_cover ? 2 : 1,
:page_filter => lambda{ |pg| Booky::Layout.config.has_cover ? (pg != 1) : true },
:at => [document.bounds.left, -3.cm],
:align => :center,
:size => 10,
:style => :italic,
:color => COLORS[2]
}
end
|