Procházet zdrojové kódy

Initial commit

master
The Stranjer před 5 roky
revize
dc35bce657
16 změnil soubory, kde provedl 104 přidání a 0 odebrání
  1. binární
      VTCGoblinHand.ttf
  2. binární
      VTCGoblinHandBold.ttf
  3. binární
      VTCGoblinHandItalic.ttf
  4. binární
      VTCGoblinHandSC.ttf
  5. binární
      abess.ttf
  6. binární
      compmalf.ttf
  7. binární
      cover.png
  8. binární
      cover.xcf
  9. binární
      goudy-bold.ttf
  10. binární
      goudy-italic.ttf
  11. binární
      goudy.ttf
  12. binární
      lilith.ttf
  13. binární
      ultramarines.ttf
  14. binární
      unispace rg.ttf
  15. binární
      writeup.pdf
  16. +104
    -0
      writeup.rb

binární
VTCGoblinHand.ttf Zobrazit soubor


binární
VTCGoblinHandBold.ttf Zobrazit soubor


binární
VTCGoblinHandItalic.ttf Zobrazit soubor


binární
VTCGoblinHandSC.ttf Zobrazit soubor


binární
abess.ttf Zobrazit soubor


binární
compmalf.ttf Zobrazit soubor


binární
cover.png Zobrazit soubor

Před Za
Šířka: 612  |  Výška: 792  |  Velikost: 762KB

binární
cover.xcf Zobrazit soubor


binární
goudy-bold.ttf Zobrazit soubor


binární
goudy-italic.ttf Zobrazit soubor


binární
goudy.ttf Zobrazit soubor


binární
lilith.ttf Zobrazit soubor


binární
ultramarines.ttf Zobrazit soubor


binární
unispace rg.ttf Zobrazit soubor


binární
writeup.pdf Zobrazit soubor


+ 104
- 0
writeup.rb Zobrazit soubor

@@ -0,0 +1,104 @@
require "prawn"
require "prawn/table"
require "pry"

class Prawn::Document
def background_color(color)
tmp_color = fill_color
canvas do
fill_color color
fill_rectangle [bounds.left, bounds.top], bounds.right, bounds.top
end
fill_color tmp_color
end
end

class Awakened2069
FONT_SIZE_CHAPTER = 48
FONT_SIZE_BODY = 10

attr_accessor :pdf, :chapter_title

def start_chapter(chapter_name)
@chapter_title = chapter_name
puts "Starting #{chapter_title}"

pdf.start_new_page

pdf.outline.update do
puts "\tAdding #{@awakened2069.chapter_title} on page #{page_number}"
section(@chapter_title, :destination => page_number)
end

puts "\tSetting font size"
pdf.font_size Awakened2069::FONT_SIZE_CHAPTER
pdf.font "Abess"
puts "\tPrinting chapter to document"
pdf.text chapter_title, :align => :center

puts "\tRestoring body text"
pdf.font "Goudy"
pdf.font_size FONT_SIZE_BODY
end


def generate
@pdf = Prawn::Document.new(:margin => 0)
pdf.font_families.update(
"Goudy" => {
:normal => "goudy.ttf",
:bold => "goudy-bold.ttf",
:italic => "goudy-italic.ttf"
},
"Abess" => {
:normal => "abess.ttf"
},
"Lilith" => {
:normal => "lilith.ttf"
},
"Goblin Hand" => {
:normal => "VTCGoblinHand.ttf",
:bold => "VTCGoblinHandBold.ttf",
:italic => "VTCGoblinHandItalic.ttf"
},
"Ultramarines" => {
:normal => "ultramarines.ttf"
},
"Unispace" => {
:normal => "unispace rg.ttf"
}
)

pdf.outline.instance_variable_set(:@awakened2069, self)

pdf.image("cover.png", :width => 612, :height => 792)

pdf.start_new_page(:margin => 50)

pdf.font "Ultramarines"
pdf.font_size 72
pdf.text "Awakened 2069", :align => :center

pdf.font "Goudy"
pdf.font_size 36
pdf.text "\nGuide To The Mage: the Awakening, Second Edition Game On Discord. \n\nInvite Code:", :align => :center

pdf.font "Unispace"
pdf.text "25MpfjP", :align => :center

pdf.font "Goudy"

pdf.font_size 24
pdf.text "\n\nAll content in this manual is inspired by the Storyteller and the players", :align => :center

start_chapter "Introduction"



pdf.render_file("writeup.pdf")
end
end


awakened2069 = Awakened2069.new
awakened2069.generate

Načítá se…
Zrušit
Uložit