Created
January 18, 2009 00:23
-
-
Save practicingruby/48501 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| DFONT_FILE = "#{Prawn::BASEDIR}/data/fonts/Action Man.dfont" | |
| puts "There are #{Prawn::Font::DFont.font_count(DFONT_FILE)} fonts in #{DFONT_FILE}:" | |
| Prawn::Font::DFont.named_fonts(DFONT_FILE).each do |name| | |
| puts "* #{name}" | |
| end | |
| puts | |
| puts "generating sample document in 'dfont.pdf'..." | |
| Prawn::Document.generate "dfont.pdf" do | |
| fill_color "0000ff" | |
| font DFONT_FILE, :font => "ActionMan-Bold", :size => 24 | |
| text "Introducing Action Man!" | |
| move_text_position 24 | |
| font_families["Action Man"] = { | |
| :normal => { :file => DFONT_FILE, :font => "ActionMan" }, | |
| :bold => { :file => DFONT_FILE, :font => "ActionMan-Bold" }, | |
| :italic => { :file => DFONT_FILE, :font => "ActionMan-Italic" }, | |
| :bold_italic => { :file => DFONT_FILE, :font => "ActionMan-BoldItalic" } | |
| } | |
| font "Action Man", :size => 16 | |
| text "Action Man is feeling normal here." | |
| move_text_position 16 | |
| font "Action Man", :style => :bold, :size => 16 | |
| text "Action Man is feeling bold here!" | |
| move_text_position 16 | |
| font "Action Man", :style => :italic, :size => 16 | |
| text "Here, we see Action Man feeling italicized. Slick!" | |
| move_text_position 16 | |
| font "Action Man", :style => :bold_italic, :size => 16 | |
| text "Lastly, we observe Mr. Action Man being bold AND italicized. Excellent!" | |
| end | |
| puts "done" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment