Class: Postscript::Model::Operators::Font::Scalefont

Inherits:
Postscript::Model::Operator show all
Defined in:
lib/postscript/model/operators/font.rb

Overview

Returns a new font dictionary scaled to the given size.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Postscript::Model::Operator

#accept, #operator?, register_as

Constructor Details

#initialize(font:, size:) ⇒ Scalefont

Returns a new instance of Scalefont.



30
31
32
33
34
# File 'lib/postscript/model/operators/font.rb', line 30

def initialize(font:, size:)
  @font = font
  @size = size
  freeze
end

Instance Attribute Details

#fontObject (readonly)

Returns the value of attribute font.



29
30
31
# File 'lib/postscript/model/operators/font.rb', line 29

def font
  @font
end

#sizeObject (readonly)

Returns the value of attribute size.



29
30
31
# File 'lib/postscript/model/operators/font.rb', line 29

def size
  @size
end

Class Method Details

.from_operands(stack) ⇒ Object



35
36
37
38
39
# File 'lib/postscript/model/operators/font.rb', line 35

def self.from_operands(stack)
  size = stack.pop_number
  font = stack.pop
  new(font: font, size: size)
end