Better default handling, more samples
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
module Squib
|
||||
module Constants
|
||||
|
||||
DEFAULT_FONT = 'Arial 36'
|
||||
|
||||
end
|
||||
end
|
||||
@@ -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?
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user