Better default handling, more samples

This commit is contained in:
Andy Meneely
2014-07-17 15:54:53 -04:00
parent 9da4d0a499
commit 06cf063126
5 changed files with 29 additions and 5 deletions
+6
View File
@@ -8,6 +8,12 @@ module Squib
raise 'Not implemented!'
end
#
# font: description string, including family, styles, and size.
#
# => e.g. 'Arial bold italic 12'
# For the official documentation the string, see the [Pango docs](http://ruby-gnome2.sourceforge.jp/hiki.cgi?Pango%3A%3AFontDescription#style).
# This [description](http://www.pygtk.org/pygtk2reference/class-pangofontdescription.html) is also quite good.
def text(range: :all, str: '', font: :use_set, x: 0, y: 0, **options)
range = rangeify(range)
str = [str] * @cards.size unless str.respond_to? :each
+7
View File
@@ -0,0 +1,7 @@
module Squib
module Constants
DEFAULT_FONT = 'Arial 36'
end
end
+3
View File
@@ -1,16 +1,19 @@
require 'squib/card'
require 'squib/input_helpers'
require 'squib/constants'
module Squib
class Deck
include Enumerable
include Squib::InputHelpers
include Squib::Constants
attr_reader :width, :height
attr_reader :cards
attr_reader :text_hint
def initialize(width: 825, height: 1125, cards: 1, &block)
@width=width; @height=height
@font = 'Sans 36'
@cards = []
cards.times{ @cards << Squib::Card.new(self, width, height) }
if block_given?
+3 -2
View File
@@ -29,8 +29,9 @@ module Squib
module_function :colorify
def fontify (font)
font = 'Arial 36' if font==:use_set
font
font = @font if font==:use_set
font = Squib::DEFAULT_FONT if font==:default
font
end
module_function :fontify